Crack the Passphrase! Each group has been assigned a unique passphrase. Visit th
ID: 665489 • Letter: C
Question
Crack the Passphrase!
Each group has been assigned a unique passphrase. Visit this page:
http://cgi.soic.indiana.edu/~johfdunc/password.html
The page links to a word list and explains how the passphrases were generated. When each group guesses their passphrase, it will be recorded here:
http://cgi.soic.indiana.edu/~johfdunc/pw_guesses.txt
You’ll need to write a program to load the word list (use a local copy OR the online version) (10 points), search all possible combinations (30 points), and print out a message to alert you to when the correct passphrase is found (10 points).
(10 point BONUS) Find the correct passphrase for your group. You don’t need to submit it – we’ll see it in the log file if your group guesses the passphrase correctly. I don’t recommend trying this search randomly! There are enough words that if you can check 10 words per second, searching the entire space (without duplication) will take a single program up to 1 day.
Should be written in Python. Nested for loops should be used.
To clarify, just one .py file should be submitted, using nested for loops to crack the code similar to this:
import urllib
num1 = 0
num2 = 0
num3 = 0
num4 = 0
while True:
url= "http://cgi.soic.indiana.edu/~johfdunc/secret_vault.cgi?groupname=
Group+1&num1=" + str(num1) + "&num2=" + str(num2) +
"&num3=" + str(num3) + "&num4=" + str(num4)
print url
try:
con = urllib.urlopen(url)
webpage = con.read()
con.close()
except:
print "Error opening:", url
webpage = ""
Explanation / Answer
import urllib page = "" num1 = 0 num2 = 0 num3 = 0 url = "http://cgi.soic.indiana.edu/~johfdunc/secret_vault.cgi?groupname=Group+1&num1=&num2=&num3=" #url2 = "http://cgi.soic.indiana.edu/~johfdunc/secret_vault.cgi?groupname=Group+1&num1=2&num2=9&num3=6" con = urllib.urlopen(url) webpage = con.read() con.close() for i in range(0,10): for j in range(0,10): for k in range(0,10): url = "http://cgi.soic.indiana.edu/~johfdunc/secret_vault.cgi?groupname=Group+1" num1 = i num2 = j num3 = k url += "&num1=" + str(num1) + "&num2=" + str(num2) + "&num3=" + str(num3) try: con = urllib.urlopen(url) except IOError: print "IOError..." else: webpage = con.read() con.close() if "Wrong!" not in webpage: page = webpage break else: page = "" continue if "Wrong!" not in webpage: page = webpage break if "Wrong!" not in webpage: page = webpage break print page