Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Windows

Journal Journal: Unfinished Business

As a late new years resolution of mine, I have decided that I need to complete projects that I start up. It is a mark of successful people to never leave a project incomplete. So I'm gonna do that starting with an easy one: Un-DOS

Un-DOS is a project I started back in December of 2004. Yeesh. Talk about procrastination. But I wanna finsh the motherfucker. Even if it is pointless. It is a legitimate project I started, so I'm gonna do it.

So first off, fuck SourceForge. I'm hosting on code.google.com. It's way easier, and I don't have to get approval or some shit like that. Plus, they use a web-accessable Subversion, right off the bat. Rawk.

Since this project is a Winblows project, I needed Winblows. I installed VirtualBox on DevSin, and installed Windows XP on it. VirtualBox is cool as shit. VMWare was bing a bitch, so I just went with something that had packages in the repository.

It's a snap to set up. Anyway, I'm VNC'd and SSH'd from my desktop into my development box, which has a virtual machine running on it. Talk about confusing. Eventually I'd like to get a KVM set up so I don't have to VNC and SSH in. But until then, this'll work. Everything is set up and we're ready to rock 'n roll.

Let the fun begin!
Security

Journal Journal: Security Initiative 2008: Learn2Attack

With half of the year gone, I feel it's time for an update on Security Initiative 2008. So far, I have:
  • Been religious about triple locking my doors.
  • Set up an encrypted 1TB external HDD.
  • Implemented a shredder for my mail.
  • Implemented a recycling scheme - Maybe not security related, but it makes me happy.
  • Learned about Wi-Fi hacking - Admittedly this is far overdue, but better late than never
  • Learned about Bluetooth hacking - This is also far overdue.
  • Got back into reading Aggressive Network Self-Defense. This is an amazing book.
  • Started using Nessus and Metasploit, and nmap more effectively
  • Allowed open wireless connections onto my router.
    • This is security-oriented because it shows that my machines are secure in front of or behind my firewall
    • And it allows me to investigate those connecting to my network - If you connect, you assume the rist.
  • Gotten my laptop up and running with Wi-Fi.

Here's what I have left to do:

  • Wipe/format/encrypt unused external drives
  • Encrypt laptop partition
  • Implement an "Internet only" connection and a "work only" connection to secure my network and increase proficiency and work ethic.
  • Set up an OpenBSD firewall
  • Implement a Strike Back policy
  • Set up a Honeypot
  • Obtain a collection of pwnd boxes from people who have attacked me.
  • Become 1337 and untouchable.

I think this is a feasable goal to reach by the end of the year. So here's the story for today. I have a list of about 16 hosts that have attacked my machine. Basically, they just tried a bunch of brute force logins on SSH. Nice try, fuckwits. So my original assumption was that these motherfuckers must die. But after reading ANSD, I realized that they are probably just pawns used by another source. So I did some scans. Both nmap and Nessus, and Nessus reported that the ones that were up were indeed vulnerable to the infamous "FTP Bounce" attack. This basically allows you to proxy your scans through one machine to another.

So right now I have two main targets. One in China, and one in Egypt. They are both interesting boxes, both seemingly Linux with a ton of open ports just begging to be pwned. So I scanned the China box, being my preferred favorite. Those Chinese motherfuckers hack us all the goddamned time. Why not hack them back? BlackHat FTW!

So Nessus reported that the China box was open to the FTP Bounce. Unfortunately, other than some kind of lame db2 local exploits, there's not much else. So I am now bouncing scans off of China to scan Egypt. Will report in with more info. Here's the command:

$ sudo nmap -v -O -sS -P0 -b anonymous:anon@<FTP SERVER IP> <HOST TO SCAN>

Wireless Networking

Journal Journal: First Venture with Linux Laptop in a Coffee Shop

Victory is mine!!!

I have finally managed to enable wireless networking on my Averatec 2370. There were issues with some "doesn't support scanning" and "no ioctls" errors. But I sorted all that shit out by disabling all rt drivers that were not specifically rt73. rt73usb? /etc/modprobe.d/blacklist that shit. rt2x00usb? blacklist that shit. It should look like this:

$ sudo lsmod | grep rt | grep -v parport
rt73 203648 1
firmware_class 15104 1 rt73

Aaaaannnd we're good.

I even did a quick war walk down the street. There are a ton of fucking APs just in my neighborhood reachable with my shitty little embedded wifi card. Let the games begin.

KDE

Journal Journal: application/octet-stream Issue in Konqueror

Taken from this minimalist page: http://users.pandora.be/Ice9/Linux%20stuff/Linux_tips.html

Couldn't find MIME type application/octet-stream.

KDE returns "Couldn't find MIME type application/octet-stream" at startup and/or Konqueror returns the same error message when launching whatever application.

Start the Control Center and open KDE Components/File Associations (kcontrol) Expand "application", you will probably see that there's no entry for "octet-stream". Click on "Add...", for "Group" select "application" and for "Type Name" fill in "octet-stream". This should fix it.

Alternatively, I also read that you could delete the file /home/userID/.kde/share/mimelnk/application/octet-stream.desktop I tried it and it also works but I'm not too comfortable deleting files without really knowing what they do, so if you decide to do this it will be at your own risk.

First method worked. Rawk.

Java

Journal Journal: Getting Java to Work at Work

Since the systems are kind of locked down here, I had to make some special scripts to get Java to compile here. I'm also using Ant for the first time. The first one is a "make" script.

make.bat

@echo off
REM set javac=C:\software\J2SDK1.5.0_04\bin\javac
REM set classpath=C:\Projects\cf_sched
REM $javac -classpath $classpath

set antpath=C:\software\ant\1.6.1\bin\

%antpath%ant.bat %1

The second one is a "run" script:

C:\software\J2SDK1.5.0_04\bin\java -classpath . %1

Then I was able to move all my GNU win32 software into my path, and I'm using Console.

So with all that said and done, this little Java code works:

C:\Projects\helloworld>cat Hello.java
// Hello.java
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
C:\Projects\helloworld>make

C:\Projects\helloworld>set javac=C:\software\J2SDK1.5.0_04\bin\javac

C:\Projects\helloworld>set classpath=C:\Projects\cf_sched

C:\Projects\helloworld>set antpath=C:\software\ant\1.6.1\bin\

C:\Projects\helloworld>C:\software\ant\1.6.1\bin\ant.bat
Buildfile: build.xml

compile:

BUILD SUCCESSFUL
Total time: 0 seconds
C:\Projects\helloworld>run Hello
C:\Projects\helloworld>C:\software\J2SDK1.5.0_04\bin\java -classpath . Hello
Hello, world!

Windows

Journal Journal: Tabbed PuTTY Sessions

This week has been horrible. Almost had my laptop back up and running and then I fucked it up. Now I haven't been able to get my PXE server working again in order to try a reinstall. Fuck.

But one thing has brightened my day. It's a little piece of Frenchie software called PuTTY Connection Manager. It lets me tab all my sessions out and easily manage them in one fucking window. This is exactly what I've been looking for! It is nearly PERFECT!

And seeing as how the Firefox project is going to be on hold for a while, this is going to have to tide me over for a little bit.

It is available here: http://puttycm.free.fr/
Unix

Journal Journal: DNS, /etc/hosts, etc.

I just about went crazy today. Like, a serious mental breakdown. The little fucking blinking light from my IM program telling me that I can't just be left the fuck alone just about drove me to commit acts of random chaos.

And aside from that, my laptop is still fucked.

But anyway, the point of this journal is to help me remember common tasks I always forget how to do. For instance, setting my hostname and shit like that.

Most of this is stolen from: http://www.cpqlinux.com/hostname.html

DNS Server File

/etc/resolv.conf

search om.cox.net
nameserver 68.105.28.11
nameserver 68.105.29.11
nameserver 68.105.28.12

Checking your Linux host name

First, see if your host name is set correclty using the following commands:

uname -n
hostname -a
hostname -s
hostname -d
hostname -f
hostname

If the above commands return correctly with no errors then all may be well; however, you may want to read on to verify that all settings are correct. Configuring /etc/hosts If your IP address is assigned to you by a DHCP server, then /etc/hosts is configured as follows:

127.0.0.1 mybox.mydomain.com localhost.localdomain localhost mybox

If you have a static IP address, then /etc/hosts is configured as follows:

127.0.0.1 localhost.localdomain localhost
192.168.0.10 mybox.mydomain.com mybox

Setting the Host Name using "hostname"

After updating the /etc/hosts file correctly, the "hostname" command should be run as follows to set your hostname:

hostname mybox.mydomain.com

Checking /etc/HOSTNAME (if present)

You may or may not have the file /etc/HOSTNAME:

mybox.mydomain.com

Checking /etc/sysconfig/network

If you have a static IP address, then /etc/sysconfig/network is configured as follows:

NETWORKING=yes
HOSTNAME="mybox.mydomain.com"
...

If your IP address is assigned to you by a DHCP server, and you wish to update the local DNS server through Dynamic DNS, then /etc/sysconfig/network is configured as follows:

NETWORKING=yes
HOSTNAME="mybox.mydomain.com"
DHCP_HOSTNAME="mybox.mydomain.com"
...

It makes more sense to move this "DHCP_HOSTNAME" variable into /etc/sysconfig/network-scripts/ifcfg-eth0 (or appropriate NIC cfg file). So the above section has been moved, see below. If you have only 1 NIC, then the above struck section works fine, but with more than 1 NIC it makes no sense. Maybe this is true for the "'HOSTNAME" line too, maybe that line should be moved into /etc/sysconfig/network-scripts/ifcfg-eth0 as well. I will investigate further. By default RHL places HOSTNAME=localhost.localdomain in /etc/sysconfig/network. Checking /proc/sys/kernel/hostname

This is checked with the following command:

cat /proc/sys/kernel/hostname

If you need to set this file, you can either reboot or set it now with the following command:

echo mybox.mydomain.com > /proc/sys/kernel/hostname

Dynamic DNS

Updating the local DNS server with your host name and DHCP IP For Red Hat Linux if you receive your IP address from a DHCP server, you may update the local DNS server by adding the following line to the correct ifcfg file in /etc/sysconfig/network-scripts, such as ifcfg-eth0 or ifcfg-eth1:

DHCP_HOSTNAME="mybox.mydomain.com"

or if running Debian, edit /etc/network/interfaces as follows (adding the hostname line):

iface eth0 inet dhcp
hostname mybox.mydomain.com

Updated information about ddns:

Kill the dhclient process ("killall dhclient") - make sure it is gone. Then restart networking

service network restart

For more info in Debian, see "man interfaces" and scroll down to "The dhcp Method".

WINS

Updating the local WINS server with your host name and IP If you wish to update the local WINS server, then use SAMBA, and configure it to point to the local WINS server. samba.html i.e. update the /etc/samba/smb.conf "wins server = " entry with the WINS server addresses for your network - be sure not to enable "wins support = yes" as that will make Linux a WINS server.

Changing the hostname while in X-Windows

Changing the hostname while in X-Windows can be problematic. Most often, new windows cannot be opened. Either

  1. Change the hostname while the X-Windows is not running
  2. In X-Windows change the hostname, then restart X-Windows.
Software

Journal Journal: ColdFusion Syntax File for Vim

cf.vim in the syntax directory. Contains a bunch (not all) CF 8 tags, and a bunch of our custom tags.

" Vim syntax file
" Language: ColdFusion
" Maintainer: Toby Woodwark (toby.woodwark+vim@gmail.com)
" Last Change: 2005 Nov 25
" Filenames: *.cfc *.cfm
" Version: Macromedia ColdFusion MX 7
" Usage: Note that ColdFusion has its own comment syntax
" i.e. <!--- --->

" For version 5.x, clear all syntax items.
" For version 6.x+, quit if a syntax file is already loaded.
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif

" Use all the stuff from the HTML syntax file.
" TODO remove this; CFML is not a superset of HTML
if version < 600
source <sfile>:p:h/html.vim
else
runtime! syntax/html.vim
endif

syn sync fromstart
syn sync maxlines=200
syn case ignore

" Scopes and keywords.
syn keyword cfScope contained cgi cffile request caller this thistag cfcatch variables application server session client form url attributes arguments
syn keyword cfBool contained yes no true false

" Operator strings.
" Not exhaustive, since there are longhand equivalents.
syn keyword cfOperator contained xor eqv and or lt le lte gt ge gte eq neq not is mod contains
syn match cfOperatorMatch contained "[\+\-\*\/\\\^\&][\+\-\*\/\\\^\&]\@!"
syn cluster cfOperatorCluster contains=cfOperator,cfOperatorMatch

" Tag names.

syn keyword cfTagName contained cf_SSI cf_UPEmail_Addr cf_UPFile2Query cf_ValidEMail cf_app_outage cf_clientTimeout
syn keyword cfTagName contained cf_clusterRun cf_compress cf_excel cf_network_connection cf_qoq cf_query_size
syn keyword cfTagName contained cf_runOnAll cf_upAreas cf_upBrowser cf_upCOED cf_upChart cf_upChartSeries
syn keyword cfTagName contained cf_upContent cf_upDepartments cf_upDirectory cf_upFile cf_upGraphViz cf_upHTML2PDF
syn keyword cfTagName contained cf_upImageRotate cf_upJMSQueueReceiver cf_upJMSQueueSender cf_upJMSTopicSender
syn keyword cfTagName contained cf_upJMSTopicsReceiver cf_upLDAP cf_upLoad cf_upLocations cf_upMach_Name cf_upMergePDF
syn keyword cfTagName contained cf_upPieChart cf_upPrintTable cf_upProperCase cf_upRemoveDupes cf_upSMSTAD
syn keyword cfTagName contained cf_upStock cf_upTivoli cf_upXMF cf_upZip cf_upiSiloX cfx_long2Image cfx_upBarcode
syn keyword cfTagName contained cfx_upEAM cfx_upExecute cfx_upMeter cfx_upPrintService
syn keyword cfTagName contained cfabort cfapplet cfapplication cfajaximport cfajaxproxy cfargument cfassociate cfbreak cfcache
syn keyword cfTagName contained cfcalendar cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection
syn keyword cfTagName contained cfcomponent cfcontent cfcookie cfdefaultcase cfdirectory cfdiv cfdocument
syn keyword cfTagName contained cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror cfexecute
syn keyword cfTagName contained cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid
syn keyword cfTagName contained cfgridcolumn cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage
syn keyword cfTagName contained cfimport cfinclude cfindex cfinput cfinsert cfinvoke cfinvokeargument cflayout cflayoutarea
syn keyword cfTagName contained cfldap cflocation cflock cflog cflogin cfloginuser cflogout cfloop cfmail
syn keyword cfTagName contained cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate cfobject cfobjectcache
syn keyword cfTagName contained cfoutput cfparam cfpdf cfpdfform cfpdfparam cfpdfsubform cfpod cfpop cfprocessingdirective
syn keyword cfTagName contained cfprocparam cfprocresult cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow
syn keyword cfTagName contained cfreturn cfsavecontent cfschedule cfscript cfsearch cfselect cfset cfsetting
syn keyword cfTagName contained cfsilent cfslider cfstoredproc cfswitch cftable cftextarea cfthread cfthrow cftimer
syn keyword cfTagName contained cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx cfxml

" Tag parameters.
syn keyword cfArg contained abort accept access accessible action addNewLine addr_lookup addtoken agentname
syn keyword cfArg contained alias align alternateRowColor appendkey appletsource application applicationTLA
syn keyword cfArg contained applicationtimeout applicationtoken appname archive argumentcollection arguments
syn keyword cfArg contained asciiextensionlist attachmentpath attribute_list attributecollection attributes
syn keyword cfArg contained autoTrim autowidth backgroundcolor backgroundvisible basetag bcc bgcolor bind bindingname
syn keyword cfArg contained blockfactor body bold border branch cachedafter cachedwithin casesensitive categories
syn keyword cfArg contained category categorytree cc cfsqltype charset chartStyle chartTitle chartheight chartwidth
syn keyword cfArg contained checked class clientmanagement clientstorage cluster codebase colheaderalign colheaderbold
syn keyword cfArg contained colheaderfont colheaderfontsize colheaderitalic colheaders colheadertextcolor collection
syn keyword cfArg contained colorlist colspacing columnList columns combineFormat command completepath component
syn keyword cfArg contained compressedFilename compressionType condition connection connectionFactory contentid
syn keyword cfArg contained context contextbytes contexthighlightbegin contexthighlightend contextpassages
syn keyword cfArg contained cookiedomain criteria custom1 custom2 custom3 custom4 data dataSymbol dataSymbolSize dataalign
syn keyword cfArg contained databackgroundcolor datacollection datalabelstyle datalist datasource date daynames dbname
syn keyword cfArg contained dbserver dbtype dbvarname debug default definition_file definition_string degreeEnd degreeStart
syn keyword cfArg contained degrees delstatic_File delete deletebutton deletefile delim delimiter delimiters depth3d
syn keyword cfArg contained description destination destinationDirectory detail directory disabled display displayname disposition
syn keyword cfArg contained dn domain email emailTo empID enablecab enablecfoutputonly enabled encoded encryption enctype
syn keyword cfArg contained endZone1 endZone2 endZonen enddate endrange endrow endtime entry environment errorcode event_class
syn keyword cfArg contained event_source exception existing expand expires expireurl expression extendedinfo extends
syn keyword cfArg contained extensions external failifexists failto file fileContents fileExtension fileField fileList
syn keyword cfArg contained fileName filefield filename files filter firstName firstdayofweek firstname firstrowasheaders folder
syn keyword cfArg contained font fontFace fontbold fontembed fontitalic fontsize foregroundcolor format formfields formula
syn keyword cfArg contained freezePaneHeight from function generateuniquefilenames getasbinary grid griddataalign
syn keyword cfArg contained gridlines groovecolor group groupcasesensitive header headerTitles headeralign headerbold
syn keyword cfArg contained headerfont headerfontsize headeritalic headerlines headertextcolor height highlighthref
syn keyword cfArg contained hint href hrefkey hscroll hspace htmloutput htmltable id idletimeout imageDir imageFile
syn keyword cfArg contained imageHeight imageResize imageWidth img imgopen imgstyle includeHeadWhite index inline input
syn keyword cfArg contained inseconds insert insertbutton interval ipAddress isolation italic item itemcolumn ixl_file key
syn keyword cfArg contained keyonly label labelColumn labelformat labelsList lableAngle lableList language lastName lastname
syn keyword cfArg contained lata lineWidth list listgroups locale localfile log loginstorage lookandfeel macroTick mailerid
syn keyword cfArg contained mailto majorTick marginbottom marginleft marginright margintop markersize markerstyle mask
syn keyword cfArg contained maxRecords maxlength maxrows message messageType messagenumber method mimeattach mimetype minorTick
syn keyword cfArg contained mode modifytype monthnames mouseOver multipart multiple name nameConflict namecomplict nameconflict
syn keyword cfArg contained namespace new newFile newFileName newImageSize new_content newdirectory noDataMessage notsupported
syn keyword cfArg contained null numberformat numofseries numofzones object omit onchange onclick onerror onkeydown onkeyup onload
syn keyword cfArg contained onmousedown onmouseup onreset onsubmit onvalidate operation oracleServerName oracleServerPort
syn keyword cfArg contained oracleServerSid orderby orientation orig_content outage_end outage_start output outputFile outputPath
syn keyword cfArg contained output_file outputfile overwrite ownerpassword pageencoding pageheight pagetype pagewidth paintstyle
syn keyword cfArg contained param_1 param_2 param_3 param_4 param_5 parent passive passthrough password path pathToIni pattern
syn keyword cfArg contained pdf_filename pdf_options pdf_path permissions picturebar pieslicestyle port porttypename prefix
syn keyword cfArg contained preloader preservedata previouscriteria procedure processName propFile protocol provider providerdsn
syn keyword cfArg contained proxybypass proxypassword proxyport proxyserver proxyuser publish query queryParams query_name queryasroot
syn keyword cfArg contained queryposition radius range rebind recurse redirect referral refreshlabel remotefile replyTo replyto
syn keyword cfArg contained report requestor requesttimeout required reset resolveurl result resultsPerPage resultset retryTimes
syn keyword cfArg contained retrycount returnasbinary returncode returntype returnvariable role roles rowheaderalign rowheaderbold
syn keyword cfArg contained rowheaderfont rowheaderfontsize rowheaderitalic rowheaders rowheadertextcolor rowheaderwidth
syn keyword cfArg contained rowheight scale scaleFrom scaleFrom2 scaleStep scaleStep2 scaleTo scaleTo2 scalefrom scaleto scope
syn keyword cfArg contained scriptprotect scriptsrc secure securitycontext select selectcolor selected selecteddate selectedindex
syn keyword cfArg contained selectmode selector separator seriesLabel seriesType seriescolor serieslabel seriesplacement server
syn keyword cfArg contained serverTLA server_name serviceName serviceport serviceportname sessionmanagement sessiontimeout
syn keyword cfArg contained setclientcookies setcookie setdomaincookies severity show3d showDataLabel showDataSymbol showFreezePane
syn keyword cfArg contained showGridLines showLegend showPages showRecordCount showborder showdebugoutput showerror showlegend
syn keyword cfArg contained showmarkers showxgridlines showygridlines size skin skipList sort sortascendingbutton sortcontrol
syn keyword cfArg contained sortdescendingbutton sortxaxis source sourceDirectory specialType spoolenable sql sql src start startGroup
syn keyword cfArg contained startRow startZone1 startZone2 startZonen startdate startrange startrow starttime static_fileName static_path
syn keyword cfArg contained status statuscode statustext step stoponerror string style subject suggestions sumColumns sumColumnsEachPage
syn keyword cfArg contained sumColumnsOnly sumColumnsTitle sumRows sumRowsTitle suppresswhitespace swapXY tablename tableowner
syn keyword cfArg contained tablequalifier taglib target task template text textcolor textqualifier thread throwonerror throwonfailure
syn keyword cfArg contained throwontimeout time timeOut timeOut timeout timespan tipbgcolor tipstyle title titleAlign to tooltip
syn keyword cfArg contained top toplevelvariable transfermode type typeList uid unit url urlparams urlpath useRicola2 user userID
syn keyword cfArg contained useragent userid username userpassword usetimezoneinfo validate validateat value valueColumn valueList
syn keyword cfArg contained valuecolumn values valuesdelimiter valuesdisplay var variable vertical view virtual visible
syn keyword cfArg contained vscroll vspace warning_end warning_start webservice width wmode wraptext wsdlfile x xAxisTitle xaxistitle
syn keyword cfArg contained xaxistype xmlMsgBody xoffset y yAxis yAxisTitle yaxistitle yaxistype yoffset

" ColdFusion Functions.
syn keyword cfFunctionName contained Abs ajaxOnLoad ajaxLink GetFunctionList Max ACos GetGatewayHelper Mid AddSOAPRequestHeader
syn keyword cfFunctionName contained GetHttpRequestData Min isJSON serializeJSON deSerializeJSON AddSOAPResponseHeader GetHttpTimeString
syn keyword cfFunctionName contained ArrayAppend GetLocale Month ArrayAvg GetLocaleDisplayName MonthAsString Minute
syn keyword cfFunctionName contained ArrayClear GetMetaData Now ArrayDeleteAt GetMetricData NumberFormat
syn keyword cfFunctionName contained ArrayInsertAt GetPageContext ParagraphFormat ArrayIsEmpty GetProfileSections
syn keyword cfFunctionName contained ParseDateTime ArrayLen GetProfileString Pi ArrayMax GetSOAPRequest
syn keyword cfFunctionName contained PreserveSingleQuotes ArrayMin GetSOAPRequestHeader Quarter ArrayNew
syn keyword cfFunctionName contained GetSOAPResponse QueryAddColumn ArrayPrepend GetSOAPResponseHeader QueryAddRow
syn keyword cfFunctionName contained ArrayResize GetTempDirectory QueryNew ArraySet GetTempFile QuerySetCell
syn keyword cfFunctionName contained ArraySort GetTickCount QuotedValueList ArraySum GetTimeZoneInfo Rand ArraySwap
syn keyword cfFunctionName contained GetToken Randomize ArrayToList Hash RandRange Asc Hour REFind ASin
syn keyword cfFunctionName contained HTMLCodeFormat REFindNoCase Atn HTMLEditFormat ReleaseComObject BinaryDecode
syn keyword cfFunctionName contained IIf RemoveChars BinaryEncode IncrementValue RepeatString BitAnd InputBaseN
syn keyword cfFunctionName contained Replace BitMaskClear Insert ReplaceList BitMaskRead Int ReplaceNoCase
syn keyword cfFunctionName contained BitMaskSet IsArray REReplace BitNot IsBinary REReplaceNoCase BitOr IsBoolean
syn keyword cfFunctionName contained Reverse BitSHLN IsCustomFunction Right BitSHRN IsDate RJustify BitXor
syn keyword cfFunctionName contained IsDebugMode Round Ceiling IsDefined RTrim CharsetDecode IsLeapYear Second
syn keyword cfFunctionName contained CharsetEncode IsNumeric SendGatewayMessage Chr IsNumericDate SetEncoding
syn keyword cfFunctionName contained CJustify IsObject SetLocale Compare IsQuery SetProfileString CompareNoCase
syn keyword cfFunctionName contained IsSimpleValue SetVariable Cos IsSOAPRequest Sgn CreateDate IsStruct Sin
syn keyword cfFunctionName contained CreateDateTime IsUserInRole SpanExcluding CreateObject IsValid SpanIncluding
syn keyword cfFunctionName contained CreateODBCDate IsWDDX Sqr CreateODBCDateTime IsXML StripCR CreateODBCTime
syn keyword cfFunctionName contained IsXmlAttribute StructAppend CreateTime IsXmlDoc StructClear CreateTimeSpan
syn keyword cfFunctionName contained IsXmlElem StructCopy CreateUUID IsXmlNode StructCount DateAdd IsXmlRoot
syn keyword cfFunctionName contained StructDelete DateCompare JavaCast StructFind DateConvert JSStringFormat
syn keyword cfFunctionName contained StructFindKey DateDiff LCase StructFindValue DateFormat Left StructGet
syn keyword cfFunctionName contained DatePart Len StructInsert Day ListAppend StructIsEmpty DayOfWeek
syn keyword cfFunctionName contained ListChangeDelims StructKeyArray DayOfWeekAsString ListContains StructKeyExists
syn keyword cfFunctionName contained DayOfYear ListContainsNoCase StructKeyList DaysInMonth ListDeleteAt StructNew
syn keyword cfFunctionName contained DaysInYear ListFind StructSort DE ListFindNoCase StructUpdate DecimalFormat
syn keyword cfFunctionName contained ListFirst Tan DecrementValue ListGetAt TimeFormat Decrypt ListInsertAt
syn keyword cfFunctionName contained ToBase64 DeleteClientVariable ListLast ToBinary DirectoryExists ListLen
syn keyword cfFunctionName contained ToScript DollarFormat ListPrepend ToString Duplicate ListQualify Trim Encrypt
syn keyword cfFunctionName contained ListRest UCase Evaluate ListSetAt URLDecode Exp ListSort URLEncodedFormat
syn keyword cfFunctionName contained ExpandPath ListToArray URLSessionFormat FileExists ListValueCount Val Find
syn keyword cfFunctionName contained ListValueCountNoCase ValueList FindNoCase LJustify Week FindOneOf Log Wrap
syn keyword cfFunctionName contained FirstDayOfMonth Log10 WriteOutput Fix LSCurrencyFormat XmlChildPos FormatBaseN
syn keyword cfFunctionName contained LSDateFormat XmlElemNew GetTempDirectory LSEuroCurrencyFormat XmlFormat
syn keyword cfFunctionName contained GetAuthUser LSIsCurrency XmlGetNodeType GetBaseTagData LSIsDate XmlNew
syn keyword cfFunctionName contained GetBaseTagList LSIsNumeric XmlParse GetBaseTemplatePath LSNumberFormat
syn keyword cfFunctionName contained XmlSearch GetClientVariablesList LSParseCurrency XmlTransform
syn keyword cfFunctionName contained GetCurrentTemplatePath LSParseDateTime XmlValidate GetDirectoryFromPath
syn keyword cfFunctionName contained LSParseEuroCurrency Year GetEncoding LSParseNumber YesNoFormat GetException
syn keyword cfFunctionName contained LSTimeFormat GetFileFromPath LTrim

syn cluster htmlTagNameCluster add=cfTagName
syn cluster htmlArgCluster add=cfArg,cfHashRegion,cfScope
syn cluster htmlPreproc add=cfHashRegion

syn cluster cfExpressionCluster contains=cfFunctionName,cfScope,@cfOperatorCluster,cfScriptStringD,cfScriptStringS,cfScriptNumber,cfBool

" Evaluation; skip strings ( this helps with cases like nested IIf() )
syn region cfHashRegion start=+#+ skip=+"[^"]*"\|'[^']*'+ end=+#+ contains=@cfExpressionCluster,cfScriptParenError

" <cfset>, <cfif>, <cfelseif>, <cfreturn> are analogous to hashmarks (implicit evaluation) and has 'var'
syn region cfSetRegion start="<cfset " start="<cfreturn " start="<cfelseif " start="<cfif " end='>' keepend contains=@cfExpressionCluster,cfSetLHSRegion,cfSetTagEnd,cfScriptType
syn region cfSetLHSRegion contained start="<cfreturn" start="<cfelseif" start="<cfif" start="<cfset" end=" " keepend contains=cfTagName,htmlTag
syn match cfSetTagEnd contained '>'

" CF comments: similar to SGML comments
syn region cfComment start='<!---' end='--->' keepend contains=cfCommentTodo
syn keyword cfCommentTodo contained TODO FIXME XXX TBD WTF

" CFscript
syn match cfScriptLineComment contained "\/\/.*$" contains=cfCommentTodo
syn region cfScriptComment contained start="/\*" end="\*/" contains=cfCommentTodo
" in CF, quotes are escaped by doubling
syn region cfScriptStringD contained start=+"+ skip=+\\\\\|""+ end=+"+ extend contains=@htmlPreproc,cfHashRegion
syn region cfScriptStringS contained start=+'+ skip=+\\\\\|''+ end=+'+ extend contains=@htmlPreproc,cfHashRegion
syn match cfScriptNumber contained "-\=\<\d\+L\=\>"
syn keyword cfScriptConditional contained if else
syn keyword cfScriptRepeat contained while for in
syn keyword cfScriptBranch contained break switch case try catch continue
syn keyword cfScriptFunction contained function
syn keyword cfScriptType contained var
syn match cfScriptBraces contained "[{}]"
syn keyword cfScriptStatement contained return

syn cluster cfScriptCluster contains=cfScriptParen,cfScriptLineComment,cfScriptComment,cfScriptStringD,cfScriptStringS,cfScriptFunction,cfScriptNumber,cfScriptRegexpString,cfScriptBoolean,cfScriptBraces,cfHashRegion,cfFunctionName,cfScope,@cfOperatorCluster,cfScriptConditional,cfScriptRepeat,cfScriptBranch,cfScriptType,@cfExpressionCluster,cfScriptStatement

" Errors caused by wrong parenthesis; skip strings
syn region cfScriptParen contained transparent skip=+"[^"]*"\|'[^']*'+ start=+(+ end=+)+ contains=@cfScriptCluster
syn match cfScrParenError contained +)+

syn region cfscriptBlock matchgroup=NONE start="<cfscript>" end="<\/cfscript>"me=s-1 keepend contains=@cfScriptCluster,cfscriptTag,cfScrParenError
syn region cfscriptTag contained start='<cfscript' end='>' keepend contains=cfTagName,htmlTag

" Define the default highlighting.
if version >= 508 || !exists("did_cf_syn_inits")
if version < 508
let did_cf_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif

HiLink cfTagName Statement
HiLink cfArg Type
HiLink cfFunctionName Function
HiLink cfHashRegion PreProc
HiLink cfComment Comment
HiLink cfCommentTodo Todo
HiLink cfOperator Operator
HiLink cfOperatorMatch Operator
HiLink cfScope Title
HiLink cfBool Constant

HiLink cfscriptBlock Special
HiLink cfscriptTag htmlTag
HiLink cfSetRegion PreProc
HiLink cfSetLHSRegion htmlTag
HiLink cfSetTagEnd htmlTag

HiLink cfScriptLineComment Comment
HiLink cfScriptComment Comment
HiLink cfScriptStringS String
HiLink cfScriptStringD String
HiLink cfScriptNumber cfScriptValue
HiLink cfScriptConditional Conditional
HiLink cfScriptRepeat Repeat
HiLink cfScriptBranch Conditional
HiLink cfScriptType Type
HiLink cfScriptStatement Statement
HiLink cfScriptBraces Function
HiLink cfScriptFunction Function
HiLink cfScriptError Error
HiLink cfScrParenError cfScriptError

delcommand HiLink
endif

let b:current_syntax = "cf"

" vim: ts=8 sw=2

After you've created that, add this line to filetype.vim:

" Cold Fusion
au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf

Software

Journal Journal: .vimrc Updated

Old .vimrc is old. Updating!

let html_wrong_comments = 1
set wm=8 " set wrapmargin
set nohls " turn off highlight on search
set et " turn on expand tab
set tabstop=4
set autoindent
set smartindent
set printoptions=number:y
set ignorecase "ic: ignores case when pattern matching
set smartcase "scs: ignores ignorecase when pattern contains uppercase characters
set hlsearch "hls: highlights search results; ctrl-n or :noh to unhighlight
set linebreak "lbr: causes vim to not wrap text in the middle of a word
set wrap " defaults to line wrap
set showmode " Shows current vi mode in lower left
set wildmenu " Command line suggestions with tab
set wildmode=longest:full,list:full "wim: helps wildmenu auto-completion
set nocompatible " get the most out of vim, sacrifice vi compatibility
set backspace=indent,eol,start " extend functionality for backspace

nmap <leader>z :%s#\<<c-r>=expand("<cword>")<cr>\>#

" colorscheme adjustments :hi lists the symbols and values for this
colo evening " change the colorscheme

" Some custom color modifications. reference :help highlight and :help cterm
" set mode message ( --INSERT-- ) to green
highlight ModeMsg cterm=bold ctermfg=2 ctermbg=black
" set the active statusline to black on white
highlight StatusLine ctermfg=7 ctermbg=9
" set inactive statusline to black on grey
highlight StatusLineNC ctermfg=8 ctermbg=9
syntax on

" turn on comment continuation for C style comments
" formatoptions r adds new comment line automagically
set fo+=r
" only apply on C comments
set com=s1:/*,mb:*,ex:*/

"
" AUTO-COMMANDS
" for Makefiles
autocmd BufEnter ?akefile* set noet ts=8 sw=8 nocindent

" for source code
autocmd BufEnter *.cpp,*.h,*.c,*.java,*.pl,*.js,*.cfm,*.cfc,*.bat,*.html,*.xml set et ts=4 sw=4 cindent

" make the preprocessor stuff a lighter color
hi PreProc ctermfg=yellow
hi Constant cterm=underline,bold ctermfg=9
" turn on comment continuation for C style comments
set fo+=r " formatoptions r adds new comment line automagically
" only apply on C comments, and mail forwarding "> "
set com=s1:/*,mb:*,ex:*/,:>,fb:-

" skeletons

" cf__ sets up ColdFusion page
ab gb__ <div class="ricGroupbox" ric:title="Your groupbox title" ric:collapsible="expanded"><CR><CR><CR></div><UP><UP>

ab cf__ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><CR><html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"><CR><cfset title = "ColdFusion Application"><CR><cfset appName = "Sample Application"><CR><head><CR><SPACE><SPACE><SPACE><SPACE><title><CR><SPACE><SPACE><SPACE><SPACE><cfoutput><CR><SPACE><SPACE><SPACE><SPACE>#title#<CR><BS><BS><BS><BS><SPACE><SPACE><SPACE><SPACE></cfoutput><CR><BS><BS><BS><BS></title><CR><script src="/uit/ricola/2.1/ricola.js" type="text/javascript"></script><CR></head><CR><body><CR><div class="ricAppTemplate" ric:app="<cfoutput>#appName#</cfoutput>" ric:title="<cfoutput>#title#"</cfoutput>><CR>

"ab cfc__ <!--- Application.cfc ---> <CR><CR> <cfcomponent displayname="Application" output="false" hint="Handle the application."> <CR><CR><SPACE><SPACE><SPACE><SPACE> <!--- set up the application ---><CR><cfset this.name = this.applicationTimeout = createTimeSpan(0,2,0,0) /><CR><!--- defaults to cf administrator value ---><CR><cfset this.clientManagement="true|false"/><CR><!--- defaults to cf administrator value ---><CR><cfset this.clientStorage = cookie|registry|datasourceName /><CR><SPACE><SPACE><SPACE><SPACE><cfset this.loginStorage = cookie|session /> <CR><SPACE><SPACE><SPACE><SPACE> <cfset this.sessionManagement = true|false /> <CR><SPACE><SPACE><SPACE><SPACE> <!--- defaults to cf administrator value ---> <CR><SPACE><SPACE><SPACE><SPACE> <cfset this.sessionTimeout = createTimeSpan(0,0,20,0) /> <CR><SPACE><SPACE><SPACE><SPACE> <cfset this.setClientCookies = true|false /> <CR><SPACE><SPACE><SPACE><SPACE> <cfset this.setDomainCookies = true|false /> <CR><SPACE><SPACE><SPACE><SPACE> <!--- defaults to cf administrator value ---> <CR><SPACE><SPACE><SPACE><SPACE> <cfset this.scriptProtect = none|all|list /> <CR><CR><SPACE><SPACE><SPACE><SPACE> <!--- define the page request properties ---> <CR><SPACE><SPACE><SPACE><SPACE> <cfsetting requesttimeout="20" showdebugoutput="false" enablecfoutputonly="false" /> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onApplicationStart" access="public" returntype="boolean" output="false" hint="fires when the application is first created."> <CR><CR> <!--- This is the perfect place to define application-scoped variables (ex. application.DSN for data source structures). If this method is invoked manually, be sure to call structClear() on the application scope before you re-initialize the data values. This will help to ensure a clean refresh. The return boolean signals as to whether or not the application loaded successfully. Returning false will halt the processing of the rest of the events of the current page request. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn true /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onSessionStart" access="public" returntype="void" output="false" hint="fires when the session is first created."> <CR> <!--- This is the perfect place to define session-scoped variables (ex. session.cart for eCommerce cart data). If this method is invoked manually, be sure to call structClear() on the session scope before you re-initialized the data values. HOWEVER! before clearing the scope, get a copy of the CFID/CFTOKEN values so that you can store them back into the session during re-initialization. ColdFusion will not automatically re-create these values as calling this event method is not actually restarting the session. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onRequestStart" access="public" returntype="boolean" output="false" hint="fires at first part of page processing."> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfargument name="TargetPage" type="string" required="true" /> <CR><CR> <!--- This the perfect place to define request-specific and other request-scoped variables (ex. request.attributes for the union of the form/URL scopes). This is also a good place to do universal form value scrubbing (such as removing smart quotes and trimming form field values). If your application or sessions can handle manual re-initialization, this is a good place to check for those URL flags (ex. structKeyExists(URL, 'resetApp')) and then manually invoke the OnApplicationStart() or OnSessionStart() application events. If you are using the OnRequest() method and you expect this application to be used for flash remoting or CFC-based web service calls, this is the ideal time at which to check for the request type (standard page request vs. web service) and if need be, delete the OnRequest() method from the Application.cfc (ex. structDelete(this, "OnRequest")). If the return value is false, the page processing will be halted. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn true /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onRequest" access="public" returntype="void" output="true" hint="fires after pre page processing is complete."> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfargument name="TargetPage" type="string" required="true" /> <CR><CR> <!--- If you include this event then you must include the requested page via a cfinclude tag. The relative path of the template is passed as the only argument to this function. If you include the page in this manner, the processed template becomes what is essentially a "Mix-In" of the Application.cfc, meaning that it is actually part of the Application.cfc code. If you do this, the processed page will have access to the this and variables scopes of the Application.cfc. If the request page is included in this manner, it also means that the requested page will have access to all methods defined in the Application.cfc. This is the perfect place to handle login management. Since this method determines which template gets executed, this is where you can check login status and conditionally include the login template rather than the requested template. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <!--- include the requested page. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfinclude template="#arguments.TargetPage#" /> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onRequestEnd" access="public" returntype="void" output="true" hint="fires after the page processing is complete."> <CR><CR> <!--- This is the perfect place to handle page logging. By doing it here (especially if the first command is a <cfflush> tag), the user experience will not be affected by any processing overhead of this event method. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onSessionEnd" access="public" returntype="void" output="false" hint="fires when the session is terminated."> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfargument name="sessionScope" type="struct" required="true" /> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfargument name="applicationScope" type="struct" required="false" default="#structNew()#" /> <CR><CR> <!--- This is the perfect place to clean up sessions that have timed out (ex. deleting uncommitted shopping cart information). This method does not have inherent access to the application scope or the session scope (as the OnRequestEnd() method has access to the request scope). In order to access those scopes, you must use the passed in arguments. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onApplicationEnd" access="public" returntype="void" output="false" hint="fires when the application is terminated."> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfargument name="applicationScope" type="struct" required="false" default="#structNew()#" /> <CR><CR> <!--- This is the perfect place to log information about the application. This method does not have inherent access to the application scope. In order to access that scope, you must used the passed in argument. ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cffunction name="onError" access="public" returntype="void" output="true" hint="fires when an exception occures that is not caught by a try/catch."> <cfargument name="Exception" type="any" required="true" /> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfargument name="EventName" type="string" required="false" default="" /> <CR><CR> <!--- This event gets called when an event fires and allows you to handle that error and include an error handling template if you so desire. However, this event cannot display anything to the user if the error occurs during the OnApplicationEnd() or OnSessionEnd() events as those are not request-related (unless called explicitly during a request). One thing to be aware of (as of MX7) is that the <cflocation> tag throws a runtime Abort exception (which makes sense if you understand that the <cflocation> tag halts the page and flushes header information to the browser). As a work around to this, you can check the passed in Exception type and if its a Abort exception do not process the error: <cfif NOT compareNoCase(arguments.Exception.RootCause.Type, "coldfusion.runtime.AbortException")> <!--- do not process this error ---> <cfreturn /> </cfif> ---> <CR><CR><SPACE><SPACE><SPACE><SPACE> <cfreturn /> <CR><CR><SPACE><SPACE><SPACE><SPACE> </cffunction> <CR><CR> </cfcomponent>
" some abbreviations
ab teh the
ab shoudl should

" ColdFusion abbreviations
ab <<< &lt;
ab >>> &gt;
ab cfq <cfquery><CR></cfquery><up>
ab cfo <cfoutput><CR></cfoutput><up>
"ab cfl <cfloop><CR></cfloop><up><left>
ab cfd <cfdump var="##"><left><left><left>
ab cfquery <cfquery><CR></cfquery><up>
ab cfoutput <cfoutput><CR></cfoutput><up>
"ab cfloop <cfloop><CR></cfloop><up><left>
ab group__ <script language="JavaScript"><cr>StartGroupBox("Get Code","Align: Center");<cr></script><cr><CF_SSI VIRTUAL="/ssi/apps/groupbox/endgroupbox.txt">

" This is supposed to add autocompletion
set dict+="C:\Documents and Settings\icom942\Desktop\Vim\vim71\dict\CF.dict"
silent sv C:\Documents and Settings\icom942\Desktop\Vim\vim71\dict\CF.dict
q

" Mappings
" cmap handles command-line mappings.
" imap handles insert-only mappings.
" map maps keys in normal, visual, and operator-pending mode.
" map! maps keys in Vim's command and insert modes.
" nmap maps keys in normal mode only.
" omap maps keys in operator-pending mode only.
" vmap maps keys in visual mode only.

" ColdFusion comments
imap <f1> <!--- ---><left><left><left><left><left>
imap <c-e> <cfexit />
nmap <c-e> i<cfexit /><esc>

nmap <insert> p
imap <insert> <esc>pi

" Get rid of stupid windows ^M EOL characters
nmap <c-m> :%s/<c-v><c-m>/\r\n/g <cr> :%s/<c-v><c-@>//g <cr>

" Set up an 80 column comment
imap <F3> <!---------------------------------------------------------------------------->

" XXX: Need to Make a function that auto-comments my shit.
" nmap <f3> :execute 's/' . getline(".") . '/test/'<cr>

" Coldfusion loop all set up
imap <f2> <cfloop<space>index="i"<space>from=""<space>to=""<space>step="1"><CR></cfloop><up><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right>

" ctrl-space makes an html space
imap <c-space> &nbsp;
imap <c-return> <br /><space><bs>

" Shift manipulate tabs
nmap <c-t> :tabnew <cr>
nmap <s-right> :tabnext <cr>
nmap <s-left> :tabprevious <cr>
nmap <c-w> :tabclose <cr>

nmap <s-l> <s-v>~
nmap <m-l> ~

" Alt-r set up a href
imap <m-r> <a href=""></a><left><left><left><left>

" Show or hide line numbers
nmap <c-n><c-n> :set invnumber <cr>

" Save with ctrl-s
nmap <c-s> :w <cr>
nmap <c-o> :browse confirm e <cr>
nmap <m-o> :browse confirm view <cr>
" Gives Ctrl-c Ctrl-v copy and paste functionality
vmap <c-c> y
vmap <c-x> x
imap <c-v> <esc>pi
nmap <c-v> :call paste#Paste()<cr>

" NERD comments. Works on highlighted lines or lines under cursor.
vmap <s-c> :call NERDComment(0, "toggle")<cr>
nmap <s-c> <esc>:call NERDComment(1, "toggle")<cr>
vmap <s-s> :call NERDComment(0, "sexy")<cr>
nmap <s-s> <esc>:call NERDComment(1, "sexy")<cr>

map K :!cmd.exe /c "C:\Program Files\Internet Explorer\iexplore.exe" "http://www.google.com/search?hl=en&q=coldfusion+<cword>"<CR>

":execute '%s/mytext/' . myvar . '/'

" Refresh _vimrc without reloading vim
nmap <C-F5> :source C:\Documents and Settings\icom942\Desktop\Vim\_vimrc <CR>

runtime ftplugin/man.vim

Debian

Journal Journal: PXE Booting for Debian Install

So my laptop was refusing to boot from a CD. It was basically being a little bitch about it. But it would boot from PXE. So I decided to try that.

The steps below were plagerized from http://www.debian-administration.org/articles/478

If you're looking to perform a lot of system recovery, or system installation, then network booting with PXE is ideal. PXE allows you to boot up a system and have it automatically get an IP address via DHCP and start booting a kernel over the network.

PXE itself stands for "Pre-boot eXecution Environment", which describes how it works in the sense that the clients using it haven't booted in a traditional manner.

In order to use PXE you need to setup a boot-server which will allow client systems to :

  • Request an IP address (via DHCP)
  • Download a kernel (via TFTP)

With both of these services in place any system which supports PXE/network-booting (you might need to enable it in the BIOS) should be able to gain an IP address, fetch a kernel, and boot without an installed operating system.

(This is ideal for systems which can't be booted by a traditional approach; for example your new AMD-64 system which doesn't have a CD/DVD drive!) Our Setup

For the purposes of this article we'll assume:

  • We're working with a small network 192.168.1.0/24
  • We'll allow all local machines to boot and get an IP address via DHCP from the range 196.168.1.70-192.168.1.100
  • Our "boot-server" is the host "itchy" with IP address 192.168.1.50
  • We will serve the same kernel to each host.

In our example we'll configure a PXE-server which will allow remote systems to run the Debian Etch installer, but nothing here is specific to that. PXE allows you to configure a system to boot from an arbitrary kernel (and matching ramdisk if you wish to use one). With the correct configuration you can even cause the clients to mount a remote file-system via NFS and have a diskless thin-client system. TFTP Setup

TFTP is a very simple file-transfer protocol, which is very similar to FTP but which doesn't use any kind of authentication. If you're not already running a TFTP server you can install one by running:

root@itchy:~# apt-get install tftpd-hpa

Once installed you'll need to enable it by editing the file /etc/default/tftpd-hpa. You should change RUN_DAEMON to yes, leaving you with contents like these:

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"

Now create the root directory, if it is missing, and start the server:

root@itchy:~# mkdir -p /var/lib/tftpboot
root@itchy:~# /etc/init.d/tftpd-hpa start
Starting HPA's tftpd: in.tftpd.

NOTE: If "Starting HPA's tftpd: in.tftpd" doesn't end with a newline, you might be having problems. Check to make sure it's not already running or it's not being run by xinetd.

Once our systems have retrieved an IP address via DHCP they will request files from beneath the /var/lib/tftpboot root directory. We'll come back to the contents of this directory shortly.

DHCP Setup

If you don't already have a DHCP server configured upon your LAN you'll need to install one. If you're using a small home router, or similar, to provide local DHCP services you must disable this first. (Since we require the DHCP server to pass back some extra options to clients which the majority of routers won't allow). Discussing a full DHCP installation is mostly beyond the scope of this introduction but the thing we're trying to do is fairly simple. The goal of the DHCP server in this setup is twofold:

  • We obviously want to use it to allow clients to request and receive an IP address.
  • We want to cause the DHCP "answer" to give some extra details to the clients which are requesting an address:
    • The address of the TFTP server.
    • The initial filename to request from the TFTP server.

The most common DHCP server is the dhcp-server package, and you can install this by running:

root@itchy:~# apt-get install dhcp3-server

Once installed the server is configured in the file /etc/dhcp3/dhcpd.conf, and there are a lot of available options described there. For our example we'll use the following configuration:

option domain-name-servers 62.31.64.39, 62.31.112.39;
default-lease-time 86400;
max-lease-time 604800;
authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.70 192.168.1.100;
filename "pxelinux.0";
next-server 192.168.1.50;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}

Here we've configured the server to give out IP addresses from the range 192.168.1.70-100, set the default gateway to be 192.168.1.1 and use our ISP's nameservers.

We've also used next-server to point to the TFTP server we're using (which is the same host as our DHCP server, but doesn't need to be). We've chosen the default name of pxelinux.0 as the name of the file for booting clients to request.

Using dnsmasq instead

Personally I use the dnsmasq package to provide DHCP services upon my LAN, since this is small and simple and provides other useful abilities, setting up PXE booting with dnsmasq just requires the addition of the following line to /etc/dnsmasq.conf:

dhcp-boot=pxelinux.0,itchy,192.168.1.50

(Again we've setup the filename along with the name and IP address of the TFTP server which is "itchy" / 192.168.1.50 in this example)

Restarting the service after this change is as simple as:

root@itchy:~# /etc/init.d/dnsmasq restart
Restarting DNS forwarder and DHCP server: dnsmasq.

PXE Configuration Now that we've configured the TFTP and DHCP servers we need to go back and complete the configuration. By default when a client boots up it will use its own MAC address to specify which configuration file to read - however after trying several options it will fall back to requesting a default file.

We need to create that that file, which will contain the list of kernels which are available to boot, we'll firstly need to create a directory to hold it:

root@itchy:~# mkdir /var/lib/tftpboot/pxelinux.cfg

Now save the following as /var/lib/tftpboot/pxelinux.cfg/default:

DISPLAY boot.txt

DEFAULT etch_i386_install

LABEL etch_i386_install
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz --
LABEL etch_i386_linux
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz --

LABEL etch_i386_expert
kernel debian/etch/i386/linux
append priority=low vga=normal initrd=debian/etch/i386/initrd.gz --

LABEL etch_i386_rescue
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz rescue/enable=true --

PROMPT 1
TIMEOUT 0

This file instructs the client to display the contents of the file boot.txt so create that too:

- Boot Menu -
=============

etch_i386_install
etch_i386_linux
etch_i386_expert
etch_i386_rescue

The only remaining job is to download the official Etch installer kernel and associated files and save them in the directories specified in the default file we created:

root@itchy:~# cd /var/lib/tftpboot/
root@itchy:~# wget http://ftp.uk.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0

root@itchy:~# mkdir -p /var/lib/tftpboot/debian/etch/i386
root@itchy:~# cd /var/lib/tftpboot/debian/etch/i386
root@itchy:~# wget http://ftp.uk.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/linux
root@itchy:~# wget http://ftp.uk.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz

When these commands have been completed we'll have the following structure:

root@itchy:~# apt-get tree
root@itchy:~# tree /var/lib/tftpboot/
/var/lib/tftpboot/
|-- boot.txt
|-- debian
| `-- etch
| `-- i386
| |-- initrd.gz
| `-- linux
|-- pxelinux.0
`-- pxelinux.cfg
`-- default

4 directories, 5 files

(We only used debian/etch here in case we want to offer other installers in the future. You can put everything in one directory if you wish, just update pxelinux.cfg/default to match.)

We should now be ready to test the setup.

We've installed a pxelinux.0 file which will instruct booting clients to request pxelinux.cfg/default. This will then make a list of boot options available, which are displayed by the simple boot menu file we created.

The files which are used for booting are stored beneath the TFTP root directory and thus accessible to booting clients.

Sample Run

A sample remote boot looks like this:

PXE entry point found (we hope) at 9AE5:00D6
My IP address seems to be C0A80146 192.168.1.70
FTFTP prefix:
Trying to load: pxelinux.cfg/01-00-14-22-a1-53-85
Trying to load: pxelinux.cfg/C0A80146
Trying to load: pxelinux.cfg/C0A8014
Trying to load: pxelinux.cfg/C0A801
Trying to load: pxelinux.cfg/C0A80
Trying to load: pxelinux.cfg/C0A8
Trying to load: pxelinux.cfg/C0A
Trying to load: pxelinux.cfg/C0
Trying to load: pxelinux.cfg/C
Trying to load: pxelinux.cfg/default
- Boot Menu -
=============

etch_i386_install
etch_i386_linux
etch_i386_expert
etch_i386_rescue

As you can see the system here attempted to load several configuration files, based upon its MAC address (01-00-14-22-a1-53-85) initially then falling back to the octets in the IP address it was given by DHCP (192.167.1.70).

Finally it managed to load a working configuration using the last-chance default file we created. This in turn instructed it to show the boot menu we created.

From here on the system will boot into whichever kernel you specify. (We could configure the system to timeout here and just boot into a default option, but we didn't.)

From here on you should understand how PXE can be used to boot an arbitrary kernel and initial ramdisk. Later we'll look at mounting a remote file-system over NFS to provide a diskless thin-client.

Side Note: If you did want to keep the bootserver around for future use you could always just cause it to automatically boot from the local disk after a short timeout. That would just need your pxelinux.cfg/default file to look like this:

timeout 120
default local
prompt 1

LABEL local
DISPLAY boot.txt
localboot 0

LABEL etch_i386_install
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz --
...
...

Debian

Journal Journal: Fixing APT

APT broke on me the other day. I got an ugly error telling me it couldn't upgrade libc6 because it was trying to overwrite the same folder that nspluginwrapper was in.

Fuck you, I said. Do it anyway. So I tried moving my softlink for libc6. That broke my whole machine. I had to go in with Slax and recreate the link.

Then I found a nice little piece on linuxquestions.org that said this:

Ok, try to download libc deb package (are you running testing or stable?) and force installation with dpgk -i --force-overwrite

Well, the error told me where the package was. So I went for it:

$ cd /var/cache/apt/archives
$ sudo dpkg -i --force-overwrite libc6_2.3.6.ds1-13etch5_amd64.deb

ding ding ding! We have a winrar!

Also, I got b& on 4chan. Installing Tor to get around it.

Unix

Journal Journal: Bad Interpreter: Permission Denied

Just found an interesting one. When you're trying to run a bash script and you get this:

/bin/bash: bad interpreter: Permission denied It's because you don't have exec permissions on that partition. Read the fucking fstab.

This won't work:

/dev/Volume00/privdir /privdir ext3 rw,suid,dev,noexec,auto,nouser,async 1 2

This will:

/dev/Volume00/privdir /privdir ext3 rw,suid,dev,auto,nouser,async 1 2

Debian

Journal Journal: libc.so.6 3

For future reference, removing the libc.so.6 soft link is a bad idea in any case. You will have to boot a live cd just to reapply the soft link (I booted Slax, because Knoppix is a piece of shit sometimes).

But seriously. If you remove that link, you will lose access to pretty much anything that was written in C/C++. Like cp. And mv. And fucking ln. Yeah. So you'll be fucked. Don't do it.

Right now I've got some issues with apt being broken. I get this crap:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree... Done
Correcting dependencies... Done
The following extra packages will be installed:
libc6
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc6
1 upgraded, 0 newly installed, 0 to remove and 166 not upgraded.
2 not fully installed or removed.
Need to get 0B/4183kB of archives.
After unpacking 207kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 124006 files and directories currently installed.)
Preparing to replace libc6 2.3.6.ds1-13etch2 (using .../libc6_2.3.6.ds1-13etch5_amd64.deb) ...
Unpacking replacement libc6 ...
dpkg: error processing /var/cache/apt/archives/libc6_2.3.6.ds1-13etch5_amd64.deb (--unpack):
trying to overwrite `/usr/lib64', which is also in package nspluginwrapper
Errors were encountered while processing:
/var/cache/apt/archives/libc6_2.3.6.ds1-13etch5_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Currently investigating a fix.

Software

Journal Journal: Software Engineering Crybabies

So my Software Engineering group project is finally over. I passed!!! But the grade was pretty aweful. I got a B- in the class. Another member of my group got a B- and was crying to me about it because he had a 95% in the class and got a 53% on the project because he hardly participated. What a piece of shit. Yeah. How about you let me do all the work, you can write up a doc on the last day and expect full credit? Umm... I don't think it works like that. Eat shit.

I'm typing this out on the 'rent's laptop. The keyboard sucks. It would not be ideal for coding. I can barely hit the gt and lt buttons for tags.

Getting lots done at work, mostly for my ColdFusion 8 presentation. Lots of new features, but lots we can't use because of our environment. Also hashing out some bugs that are being brought to our attention. Specifically, custom tags now seem to be case sensitive if they're in the current directory, but not if you define a custom mapping or in the global directory. Sent it up to Adobe. We'll see what they say.

The scheduler is looking very cool, but I have to get my build environment for Java set up. It's gonna be a complicated one. Three different dependencies, Ant, all kinds of shit.

Well, I guess we're eating steaks so I'm out.

Slashdot Top Deals

"Gotcha, you snot-necked weenies!" -- Post Bros. Comics

Working...