Monday, October 21, 2013

Proper Case for Names using ColdFusion REReplace

Format a string so that it appears like a properly formatted name. For example: "jaMes" becomes "James" or "dr. spock" becomes "Dr. Spock".

The code uses a single line of semi-complex Regex through the REReplace() function.

First it changes the input string to lower case, then it searches for all instances of:
  • a character at the beginning of the string
  • a character preceded by a blank (tab or space) ..and replaces the match with it's uppercase equivalent..

Associated Code :
<CFPARAM name="fullName" default="dr. spock">

<CFSETformattedName = REReplace(LCase(fullName), "(^[[:alpha:]]|[[:blank:]][[:alpha:]])", "\U\1\E", "ALL")>

<CFOUTPUT>#formattedName#</CFOUTPUT>

Tuesday, October 1, 2013

Intrusion detection honeypots simplify network security | Security Central - InfoWorld

You should see the look on people’s faces when I tell them certain aspects of applications I write are actually honeypots designed to make hackers waste time trying to figure out what a particular value represents.

One cool trick I use is in the links that pass values from one page in an application to the next.

The real value has a Base64 hashed value – it looks simply like a bunch of characters thrown together. Then there is another value in the link that simply says RecordID=123456.

Of course ‘RecordID’ is the honeypot.

The value is simply a RandRange() command producing a random number.

The idea is that the would-be hacker will first go for the easy numeric value and try to figure out what that is for before they try to take apart the Base64 (salted of course) value.

Anyway, give this article on InfoWorld a read, it has other nice information about how to employ honeypots.

Intrusion detection honeypots simplify network security | Security Central - InfoWorld