-
RSS Links
Categories
- /bike
- /blog
- /categoryless
- /coffee
- /dev/random
- /food
- /freenetworks
- /friends
- /funny
- /geek
- /GirTheCadillac
- /Lebowski
- /Life
- /LifeWithDog
- /me
- /metrix
- /music
- /National Wireless Summit 2006
- /phonecamera
- /photo
- /potpourri
- /seadrunks
- /seattle
- /seattlewireless
- /shmoocon
- /softball
- /StupidShellTricks
- /sysadmin
- /travel
- /unix
- /work
- cons
- monitoring
- pyramid
- ruby
Archives
- January 2011
- December 2010
- September 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- December 2008
- December 2007
- August 2007
- July 2007
- May 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- June 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005
- March 2005
- February 2005
- January 2005
- December 2004
- November 2004
- October 2004
- September 2004
- August 2004
- July 2004
- June 2004
- February 2004
- January 2004
- December 2003
- November 2003
- August 2003
whore.cgi
In my spare time I help sysadmin the box this site is on.
This generally means getting vhosts setup for people and showing them how to setup their mail client etc… Recently Jason moved his site and mail over so I have been setting up the webserver for him and what not. He sends me an email asking to make sure that his cgi-bin has execute permissions. So I go ahead and make sure the permissions are set properly and then as a good sysdamin, I decide to whip out a little one line bash cgi to test his cgi-bin and make sure my work there is done.
So it basically started out as:
#!/bin/bash
echo Content-type: text/plain
echo “”
echo “<html><head><title>whore</title></head><body>whore</body></html>”
A simple little cgi that produces a lame web page that says “whore”. Whore is a term of endearment for us, we call each other whores all the time, so it I figured it would be kind of funny.
Then I thought, a cgi that produces a static page is really no fun. I need something dynamic about the page, I know I will change the format of the word “whore” every time the cgi gets executed. By this time I have invested about 15 minutes of time into this and I can see it progressively getting worse.
I decide that I will construct about 5 different formats of the word whore, and randomly select one each time the page is loaded. So then I think to myself, “Oh crap, how do you generate a random number in bash?”. Well that led to my next time suck:
Articles about random number generation in Bash
So know I am into this about 40 minutes, I have read some different ways to do what I want to do. I need to get this done so I can move on with my life.
Here is the result: whore.cgi
And the resulting code, becuase you really need to be able to do this.
So to answer your question Jason, yes it looks your cgi-bin working… like a whore!