New: Puzzle Hunts are Everywhere: a web-crawling puzzle-hunt robot that didn't work

When the applications for the Ghost Patrol game started appearing, it was pretty humbling. New videos kept showing up on YouTube. The videos... the videos made me glad that my team (Mystic Ghosti) had submitted a cryptic crossword puzzle instead of a video. There was some tough competition.

One video was an advertisement for the Ghostatron 5000, a "ghost capturing device" oddly reminiscent of a Pac-man game. Embedded in the video was a not-so-secret message "number of dots". There was also the URL of a page allowing you to purchase a Ghostatron 5000--but only if you entered the correct password into a little web form. Aha, no doubt the password was the number of dots. But, uhm, what number of dots? Number of dots in a Pac-man layout? Number of dots in a Seurat painting?

I figured it was probably the number of dots in a Pac-man game. I tried counting those. I counted them a couple of times, got a couple of answers. I tried counting a third time as a tie-breaker--and got a third answer. Counting dots was too hard for my puny puny brain. I wasn't even sure I was on the right track. It was time to think about brute force.

In trying out some previous guesses, I had some idea of how the password checker worked. If you entered the guess "able", then the password checker would put you on the page http://www.princeton.edu/~bdbennet/able.html . Since there was no such web page, I figured "able" was not the password. Peeking at the form page's source code confirmed that this was what was going on:

<SCRIPT LANGUAGE="JavaScript">
function testResults (form) {
    var TestVar = form.inputbox.value;
    window.location="./"+TestVar+".html"; 
   
}

To test the hypothesis that the password was a "number of dots", I could check the pages
http://www.princeton.edu/~bdbennet/1.html
http://www.princeton.edu/~bdbennet/2.html
http://www.princeton.edu/~bdbennet/3.html

...

So I threw together a program to check those. Well, not all possible numbers. There are many numbers. I just checked the numbers from 1...999:

import time
import urllib

for count in range(1, 1000):
  time.sleep(1)  # wait a second, in case princeton.edu is too puny to handle a robot (unlikely)
  u = urllib.urlopen("http://www.princeton.edu/~bdbennet/%d.html" % count)
  for line in u.readlines():
      if line.find("<TITLE>404 Not Found</TITLE>") > -1:  # if no such page
          print count,                                                   # print status
          if not count % 10: print
          break
  else:                                                                  # but if page found
      print
      print "HEY"                                                        # say HEY
      print count
      break

My program never said HEY. So I was on the wrong track. I never got on the right track. I never solved that puzzle.

Labels: ,

Posted 2008-08-17

 Anonymous said...

You have a break statement in both branches. It's only going to test the 0th element of your list.

22 August, 2008 12:16
 lahosken said...

@Anonymous: one of those elses belongs to the inner for loop, not to the if. In Python, a for loop can have an else clause. It triggers if you finish the loop by running out of data (that is, it won't trigger if you break out of the loop.)

22 August, 2008 21:22