cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.
torzillo_89761
Historic F5 Account

Problem this snippet solves:

This is an iRule implementation of the popular Hangman Game. The iRule requires a data group definition containing the words, which has been attached as "classwords.txt". The iRule also requires a virtual server with an HTTP profile. If you don't use the attached data group for your words make sure to change the ::hangmanWordSize variable to the appropriate number.

Everything is done in the HTTP_REQUEST event, so interaction with the user is done through redirects, cookies, and HTTP responses from the LTM.

This has been tested to work on 9.4.5 and 10.0.0, but it should work on 9.3 as well.

If the browser does not support session cookies it will cause the iRule to behave unpredictably. It won't work, and there may be some bugs with continuous redirects. This has been tested to work properly with Firefox, IE7-8, and Google Chrome. Other browsers might work fine, although I know Lynx won't work properly.

You will see quite a few comments in the code as this was designed for training purposes to demonstrate the use of cookies, string manipulation, and displaying GIF/PNG using base64 encoding.

This wasn't designed to be used on a production system, but why not give your users something fun to do while waiting for the servers to come back online instead of the boring "This page is under construction" message?

Code :

when RULE_INIT {

#If $::mydebug is set to 1 then the program will do a lot of logging
set ::mydebug 0
#Set this variable to the size of the data group containing the
#hangman words
#This could be converted to a data group to prevent CMP demotion
set ::hangmanWordSize 21497

#These two variables are commented out because scoring is not yet implemented
#
#set ::hangmanHighScore 0
#set ::hangmanHighUser "Nobody has won yet."

#This iRule is designed to be done entirely in the HTTP_REQUEST event
#The client does GET requests, and the iRule interacts with the user through
#cookies and redirects.  The path in the URI is used to determine what
#action to take.
#
#The GIFs are base-64 encoded.  They could have been placed in /var/class
#on the LTM but this would make the code less cut and paste friendly.
#There is an associated data group required for this iRule.  You can create
#your own word list as follows:
# class Hangwords TCL doesnt let me put a brace here but there should be one
# "1 aardvardk"
# "2 aback"
# "3 abacus"
# etc.  The words should only contain lowercase letters a-z, no spaces,
# dashes, or other punctuation are allowed in the words.
#
#This code was written by Tony Torzillo to demonstrate iRule functionality.
#
#TODO:  Implement scoring - thought about using a global associative array
#or just continuing to use cookies.  Wanted to avoid globals, but if we want
#to track the high score for all users we would have to use at least a global
#for that.
#
#Implement cookie encryption - had a lot of cookie debugging to do.  Wanted to
#implement AES encryption for the cookies so that someone can't cheat.
#
#Implement input validation - No input validation currently when someone puts in a
#userID.  This code might be vulnerable to exploits and tampering since a lot of validation
#isn't done.  There was some attempt to protect against forceful browsing, but it isn't
#that robust.
#
#Implement cookie validation - someone could really mess the code up by putting in some
#strange cookie values with something like Fiddler.  Also if cookie encryption is implemented
#you have to make sure to account for the case where the cookies can't be decrypted.  This
#can happen if someone loads the iRule into memory in RULE_INIT and overwrites the existing
#key. I didn't want to implement cookie encryption without cookie validation.
#
#This iRule has been tested to work on 9.4.5 and 10.0.0.  It should work on 9.3 as well
#but I haven't tested it.  It doesn't make use of "values" introduced in 9.4, but I can't
#guarantee it will work.
#
#This code should not be used on a production system as it may have security flaws or
#problems with continuous redirects.
#
#This code has been tested with IE7, IE8, Firefox 1.5.0.4, and Google Chrome 1.0.154.65
#Different browsers handle cookies differently - apparently we all interpret RFC 2109 just
#a little differently, so this may not work with other browsers like Opera and Safari.
}

when HTTP_REQUEST {
  if { $::mydebug} { log local0. "in HTTP_REQUEST" }
  #This iRule will do different things based on the path passed in.
  #Different image names in the path will cause it to display a GIF or PNG
  #It does this by sending a b64encoded GIF or PNG back with an HTTP response
  #when that image is referenced - i.e. /hangman.gif could be referenced within
  #the iRule with   
  #I realize that this could have been put in /var/class to make the code cleaner
  #but I wanted it to be cut and paste friendly.

  switch -glob [string tolower [HTTP::path]] {
/hangman.gif {
HTTP::respond 200 content [b64decode \
"R0lGODlhtgFQAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD/\
/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzA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7l0nnW+\
8DRfiGK6Upby2L8czvFx4UtjIJPOt+I8539WtiCszU+iVOXc1kpMTW927lATXdbQIqxew1r5v/Us\
soTj+GXoAldHapRtnzLKRJqlSayzMmZuU90824rQzK0ag/GAhUXn/lC5z/s1Mp7jrE8WkxauIjrb\
tYwI5duUS9EkzvDMII3ZeY2G0tTt8qU51K/fQQ/MbirZuagc0Q1N4Vveml2gI2noYrnaJV59tazf\
EutZ2zpJo721rudS6137mioC/rWw0RLsYRt7LMU+trK9kuxlOzsrZX62tMnSaAdP+9pfMWecsc1t\
aItUz90Ot7jHTe5ym/vc6E73rAICADs="] "Content-Type" "image-gif"

return ok

}
/hangman0.png {
HTTP::respond 200 content [b64decode \
"iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI\
WXMAAAsSAAALEgHS3X78AAAAB3RJTUUH1QUSFAoGtHRxSwAAAslJREFUeJzt3EEKhDAUBUGVuf+V\
9QgKDnxiV53gbdJkEbJtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMCdfXoA487pAR+x\
5Fk6pgcAcwQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwn7TA1jGkk9dH0g/hXYDgDABgDABgDAB\
gDABgDABgDABgDABgDABgDABgDABgDABgDABgDABgDABgDABgDABgDABgDABgDB/AvLVv/54wA0A\
wgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQA\
wgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQA\
wgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQA\
wgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQAwgQA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Ty+OVx8XsAiYggHQTv0+ImwnTgKur+VIUWqB
Xk+7uXUUNzskngikNHodGVgDaCmHdrmtt3hoALSUASC4ehAcosFDXF2dAaDSPuBB4jzA2eqjRcAW
84VVyZWAyRgAKrkSMBkDQCVXAiZjAKjkduBkDACV3A6cjC+sShYBkzEAVLIImIwBoJJFwGQMAJUs
AiZjAKhkETAZX1iVLAImYwCoZBEwGQNAJYuAyRgAKlkETMYAUMkiYDK+sCpZBEzGAFDJImAyBoBK
FgGTMQBUsgiYjAGgkkXAZHxhVbIImIwBoJJFwGQMAJUsAiZjAKhkETAZA0Ali4DJ+MKqZBEwGQNA
JYuAyRgAKlkETMYAUMkiYDIGgEoWAZPxhVXJImAyBoBKFgGTMQBUsgiYjAGgkkXAZAwAlSwCJuML
q5JFwGQMAJXKImA9ArAI2GIGgEr1+6EDbAe2FZ+rhQwAlZaAl4lRwDai4c8BC6O8KV07W0d9A9pU
zgAPEQFwPdH4DwEvjfKmdO2Mrf0tSmYS2EEUAi8Qjf/CSO/o2hrUFGcj21Ijb1oaoNQBYA1ASswA
kBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNA
SswAkBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDAAp
MQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTE
DAApMQNASswAkBIzAKTEDAApMQNASmxs1DeggVgd9Q1oZPpqw44ApMQMACkxA0BKzACQEjMApMQM
ACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0CSJEmSJEmSJEmSJEmSJEmSJEmSJEmS
JEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSpLX9H6j6uTz5QPV+AAAAAElFTkSuQmCC"] "Content-Type" "image-png"

return ok

}
/hangman4.png {
HTTP::respond 200 content [b64decode \
"iVBORw0KGgoAAAANSUhEU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K
zACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkx
A0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMApMQM
ACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMA
pMQMACkxA0BKzACQEjMApMQMACkxA0BKbKLtG1Ajltq+AbVmoDbsCEBKzACQEjMApMQMACkxA0BK
zACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKzACQEjMAJEmSJEmSJEmSJEmSJEmSJEmSJEmS
JEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEla2f8AEmOb1hmWYikAAAAASUVORK5CYII="] "Content-Type" "image-png"

return ok

}
/hangman5.png {
HTTP::respond 200 content [b64decode \
"iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAAsSAAALEgHS3X78AAAAB3RJTUUH1QUSFQgtKzyAvgAACpVJREFUeJzt3duPVWcZx/HvMFQQ
0aFULKDUGCpRNFJaT9WamtroRWNiNGn0xnijMTZq1Bv/BqOJifHSC9OrGkONSoyHKJ5IPbTRaIvR
igottKW0HaF0OMyMF89azisyzOzZa++91nq+n2QyDMOsvcjez2+9+3nf9Q5IkiRJkiRJkiRJkiRJ
kiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkqSVTE36BDRxi5M+gZ7oZC2tm/QJSJoc
A0BKzACQEjMApMQMACkxA0BKzACQEjMApMQMACkxA0BKbP2kT0Cd0cmlrquQeim0IwApMQNASswA
kBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDAApMQNASswAkBIzAKTEDACt1uZJ
n4CaZwDkNkhR3w3cBGwd0bloAtwSLKetwA3AnQP8zBeBvwC/Bg4BDwNnGz8zjVVf93nT8t4IvBe4
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NgQaYwDktpWCNgQaYgDk9UKFXC4JnvS+qogBkNNmxX+mf0+y
DVXCAMhn3OJ/oa+Nsy1VwADIZdLiH+d7hkDFDIA8tlr84/yMIVApAyCHaYt/nJ81BCpkALSvr+If
5z6GQGUMgLb1Xfzj3NcQqIgB0K7tKv5xtmEIVMIAaNN2F/842zIEKmAAtGdWxT/ONg2BgTMA2jLr
4h9n24bAgBkA7ZhX8Y/zGIbAQBkAbZh38Y/zWIbAABkA9RtK8Y/zmIbAwBgAdRta8Y/z2IbAgBgA
9Rpq8XcMgQoYAHUaevF3DIGBMwDqU0vxdwyBATMA6lJb8XcMgYEyAOpRa/F3DIEBMgDqUHvxdwyB
gTEAhq+V4u8YAgNiAAxba8XfMQQGwgAYrlaLv2MIDIABMEytF3/HEJgzA2B4shR/xxCYIwOgHi0W
f6fl323QDIA6ZCiQDL/j4BgAw3N6IWQqjMy/+1z4H6zs+uozVFlLjgCkxAwAKTEDQErMAJASMwCk
xAwAKTEDQErMAJASMwCkxAwAKTEDQErMAJASMwCkxAwAKTEDQErMAJASMwCkxAwAKTEDQErMAJAS
MwCkxAwAKbEqL2Ws/+Of0Mprqhp2BCAlZgBIiRkAUmIGgJSYASAlZgBIiRkAUmIGgJSYASAlZgBI
iRkAUmIGgJSYASAlZgBIiRkAkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJ
kiRJkiRJkiRt7n8pxODdWqySZgAAAABJRU5ErkJggg=="] "Content-Type" "image-png"

return ok

}
/flash.html {
if {[HTTP::cookie exists HangmanCookie]}{
set userID [substr [HTTP::cookie HangmanCookie] 7 ":"]
set hangword [findstr [HTTP::cookie HangmanCookie] "hangword," 9 ":"]
if {$::mydebug} { log local0. "userID=$userID and hangword = $hangword" }
} else {
#If they got in here it was probably by forceful browsing, so send
#them back to the main page.  The cookie needs to be set before moving
#forward.
HTTP::redirect "/index.html"
return ok
}

#Test to see if there are any wrong answers and change that variable to the
#number wrong
if {[HTTP::cookie exists HangmanWrong]} {
set wronganswers [HTTP::cookie HangmanWrong]
} else {
set wronganswers 0
}

#Figure out how long the hangman word is
set lettercount [string length $hangword]

#Iteratively print the letters as dashes - filling in letters if there is a correct
#guess
#create a blank string called letterstring
set letterstring ""
#See if there were any correct guesses first and set a variable to that
#value
if { [HTTP::cookie exists HangmanGuesses] } {
set guesses [HTTP::cookie HangmanGuesses]
} else {
set guesses "_"
}
if {$::mydebug} { log local0. "Guesses = $guesses" }

#create a list of letters from the hangman word
#This is used to determine if a character should be printed on the
#hangman board or not.  This creates a list by making each letter
#into a member of the list - so "abcdef" becomes { a b c d e f }
#You can then reference them with [lindex $hangletterlist 0]
#which in this example would be "a" because it is the 0th letter in
#the list.
set hangletterlist [split $hangword {}]

#OK - iterate through the whole list of letters in the word and determine
#if any of the existing guesses there are correct.  If so then print them
#accordingly
#Assume that there are no right guesses and if there are then display them
#If the user has as many rightguesses as letters then they win
set rightguesses 0

#Wrong guesses isn't used yet - this could be implemented later though
#set wrongguesses 0

for { set i 0 } { $i < $lettercount } { incr i } {
set currentletter [string toupper [lindex $hangletterlist $i]]
if {$::mydebug} { log local0. "Currentletter = $currentletter" }
if { $guesses contains $currentletter } {
set letterstring "$letterstring $currentletter"
incr rightguesses
} else {
set letterstring "$letterstring  _"
#incr wrongguesses
}
}
#If the number of guesses is the same as the letter count they won.
if { $rightguesses >= $lettercount } {
if {$::mydebug} { log local0. "Going to redirect to win.html" }
HTTP::respond 302 Location "/win.html?userID=$userID&hangword=$hangword" 
#Set-Cookie: $cookies
return ok

if {$::mydebug} { log local0. "Should have redirected so I shouldn't be here" }
}
if {$::mydebug} { log local0. "Letterstring = $letterstring" }
#Keystring is the keyboard that is displayed to the user.
#If they already guessed wrong then don't display that key as an HREF.  Bold it.
#

set keystring ""
#Build a keystring so that if the guesses were wrong you don't include an
#HREF.
    if { [HTTP::cookie exists HangmanWrongGuesses] } {
set badguesses "[HTTP::cookie HangmanWrongGuesses]"
}   else {
set badguesses "0"
}
if {$::mydebug} { log local0. "Badguesses = $badguesses" }
#Create a list representing the keyboard and iterate through it to determine
#if each letter should be represented as a link or as a bolded character.
#A bolded character means it has already been pressed, either in a correct guess
#or in a wrong guess.
#
#To add a space into the keyboard, just insert a "-" into the list
#To add a space and a line break, just insert a "_" into the list
foreach keyletter { Q W E R T Y U I O P _ A S D F G H J K L _ - Z X C V B N M} {
if {$::mydebug} { log local0. "Keyletter = $keyletter" }
if { (not ($keyletter eq "_") ) and ( ($badguesses contains $keyletter) or ($guesses contains $keyletter) )} {
set keystring "$keystring\n$keyletter"
} else {
if {$keyletter eq "_"} {
set keystring "$keystring\n  "
} elseif {$keyletter eq "-"} {
set keystring "$keystring\n  "
}
else {
set keystring "$keystring\n$keyletter"
}
}
}



if {$::mydebug} { log local0. "Keystring = $keystring" }

#This code will display a keyboard.  If a user presses a key
#then this will be the path that is called
if { $wronganswers < 7 } {
#All of this is just a bunch of HTML to create keys that the user
#can click on.  Then we can check the path and see what letter they pressed.
#Kind of a cool way to do user input, since we don't use any forms or anything.
#Just good old HTML the way Dr. Berners Lee intended it to be. :)
HTTP::respond 200 content "






$letterstring

$keystring

" return ok } else { #The user lost because wronganswers is not < 7 #so now get rid of the cookies if { $::mydebug } { log local0. "User lost" } set wronganswers 0 HTTP::respond 302 Location "/lost.html?hangword=$hangword&userID=$userID" return ok } } /lost.html* { if {$::mydebug} { log local0. "I'm in your lost section logging your irulez" } #Get the word that they passed in if { [HTTP::query] contains "hangword=" } { set hangword [findstr [HTTP::query] "hangword=" 9 "&"] } else { set hangword "Undefined." } if { [HTTP::query] contains "userID=" } { set userID [findstr [HTTP::query] "userID=" 7 "&"] } else { set userID "Undefined." } HTTP::respond 200 content " You lost

I am so sorry that you lost. Please try again.

The super tricky word that finally did you in was $hangword. Please press here to start over " return ok } /win.html* { if {$::mydebug} { log local0. "I'm in your win section winning your irulez" } if { [HTTP::query] contains "userID=" } { set userID [findstr [HTTP::query] "userID=" 7 "&"] } if { [HTTP::query] contains "hangword=" } { set hangword [findstr [HTTP::query] "hangword=" 9 "&"] } #Before we do any operations on variables we should check to see if they exist first #if userID doesn't exist then we will behave differently. if { [info exists userID] } { HTTP::respond 200 content " You won

You won. You are so awesome $userID.

The winning word was $hangword. Please press here to keep going " return ok } else { HTTP::respond 200 content " Where did you come from

I am not sure how you arrived here but this is the win page.

If you want to play and really win press here. " return ok } } /?.html { #Get the letter that was pressed from the PATH set letter [substr "[HTTP::path]" 1 "."] if {($letter >= "A") and ($letter <= "Z") } { if {$::mydebug} { log local0. "Letter pressed was $letter" } if {[HTTP::cookie exists HangmanCookie]}{ set userID [substr [HTTP::cookie HangmanCookie] 7 ":"] set hangword [findstr [HTTP::cookie HangmanCookie] "hangword," 9 ":"] if {$::mydebug} { log local0. "Letter pressed was $letter userID=$userID and hangword = $hangword" } #Check to see if the word contains the letter pressed if {"[string toupper $hangword]" contains "$letter" } { #If it has the letter you need to display the new #string - for now just redirect back #Getting in here means that the user guessed the letter properly if {$::mydebug} { log local0. "The letter $letter was in $hangword" } if {[HTTP::cookie exists HangmanGuesses]}{ set guesses [HTTP::cookie HangmanGuesses] set guesses "$guesses,$letter" } else { set guesses "$letter" } HTTP::respond 302 Location "/flash.html" "Set-Cookie" \ HangmanGuesses=$guesses return ok } else { #We have to store the letters they guessed wrong as well if {[HTTP::cookie exists HangmanWrongGuesses]}{ set guesses [HTTP::cookie HangmanWrongGuesses] set guesses "$guesses,$letter" } else { set guesses "$letter" } #If there ia a cookie called HangmanWrong, then increment it #if there isn't then create it. if {[HTTP::cookie exists HangmanWrong] } { if {$::mydebug} {log local0. "Had a hangman wrong cookie"} set hangmanWrong "[HTTP::cookie HangmanWrong]" incr hangmanWrong set cookies "HangmanWrong=$hangmanWrong\r\nSet-Cookie: HangmanWrongGuesses=$guesses" HTTP::respond 302 Location "/flash.html" Set-Cookie $cookies return ok } else { set hangmanWrong "1" if {$::mydebug} {log local0. "No hangmanwrong cookie"} set cookies "HangmanWrong=$hangmanWrong\r\nSet-Cookie: HangmanWrongGuesses=$guesses" HTTP::respond 302 Location "/flash.html" Set-Cookie $cookies return ok } } } else { #If they got in here it was probably by forceful browsing, so send #them back to the main page. The cookie needs to be set before moving #forward. HTTP::redirect "/index.html" return ok } } else { #This code should only execute if someone put something manually into the URL #bar to try and mess with the program. HTTP::respond 200 content "You pressed a key You pressed $letter, which is not a valid letter" return ok } } /cookieclear.html { #This code was necessary because cookies weren't clearing properly when done all at once #Tried this to do them manually. Cookies can be a bit difficult to clean up. #This hack will remove the cookies by setting the expire time to an hour #earlier in relative time # #Create a string with all the cookies to send back #This one expires all the cookies #Internet Explorer doesn't process Max-Age - so much for RFC-2109 #Firefox doesn't process expires=-3600 - not sure why #Must do both to support both browsers if { [HTTP::cookie exists HangmanWrong] or [HTTP::cookie exists HangmanGuesses] or \ [HTTP::cookie exists HangmanCookie] or [HTTP::cookie exists HangmanWrongGuesses] } { HTTP::respond 302 Location "/cookieclear.html" Set-Cookie \ "HangmanWrong=null; expires=-3600; max-age=0;\ \r\nSet-Cookie: HangmanGuesses=null; expires=-3600; max-age=0;\ \r\nSet-Cookie: HangmanCookie=null; expires=-3600; max-age=0;\ \r\nSet-Cookie: HangmanWrongGuesses=null; expires=-3600; max-age=0;" return ok } #If they got to here there are no more cookies in the cookie jar. Time to go to the grocery #store and buy some more. #Ok, nice metaphor but we are just going to redirect back to index.hmtl. If they aren't gone it #will come back. Hope we don't get stuck in a loop. #Keep the userID - should be in the Referer header if { [HTTP::header referer] contains "userID=" } { set userID [findstr "[HTTP::header referer]" "userID=" 7 "&"] HTTP::respond 302 Location "/index.html?userID=$userID" return ok } else { HTTP::respond 302 Location "/index.html" return ok } } /index.html - / { #Check to see if any cookies exist. They shouldn't since this is the start of the program. if { [HTTP::cookie exists "HangmanCookie" ] or [HTTP::cookie exists "HangmanWrong"] \ or [HTTP::cookie exists "HangmanGuesses"] or [HTTP::cookie exists "HangmanWrongGuesses"] } { #If there is already a cookie then the user shouldn't be here. #They probably messed with the URL bar manually. HTTP::respond 302 Location "/cookieclear.html" return ok } else { #This is where we need to set the userID if { [HTTP::uri] contains "userID=" } { #Search for userID in query string set userID [findstr "[HTTP::query]" "userID=" 7 "&"] #This is to search through the data group to get the random word #the variable $::hangmanWordSize is a variable that represents #the number of words in the data group, or "class" set randomnumber [expr { int ($::hangmanWordSize * rand()) }] #Since the class is separated by spaces we can just get the one with #that index #The words in the class have the format of "Number Word" #So if you reference "1 aardvark" you can get the word #aardvark using findclass set myword [findclass "$randomnumber" $::Hangmanwords " "] set cookies "HangmanCookie=userID,$userID:hangword,$myword" HTTP::respond 302 Location "/flash.html" Set-Cookie $cookies return ok #This is just the intro page if there was no userID in the URI #Just put the basic page up } else { HTTP::respond 200 content "Hangman
The hangman game is one in which you attempt to guess the letters in a word. The number of letters in the word will be represented by dashes. You have 7 chances to guess the word, and each time you are wrong you will see a new body part created. Please enter a username below and press enter to start the game.

This whole game is done by an iRule with a single event. There are $::hangmanWordSize words available in this game.

Username:
" return ok } } } } if {$::mydebug} { log local0. "The PATH was [HTTP::path]" } } # Data Group Definition

Comments
Vsevolod_Petrov
Cirrostratus
Cirrostratus
Hi, Data Group was lost, I guess by moving to a newer Codeshare. Can anyone share the Data Group for this game?
Jason_Adams
F5 Employee
F5 Employee
The Original Hangman Game can be found here: https://tstdmzdevcentral.olympus.f5net.com/wiki/Print.aspx?Page=iRules.Hangman_Game
Version history
Last update:
‎17-Mar-2015 16:45
Updated by:
Contributors