Crack the Passphrase! Each group has been assigned a unique passphrase. Visit th
ID: 665348 • 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. You’ll need to write code similar to the Safe Cracker (Lecture 24) to discover your group’s passphrase. 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
Explanation / Answer
#!/usr/bin/python
# -*- coding: utf-8 -*-
import crypt
import string
def testPass(cryptPass):
salt = cryptPass.split("$")[2]
salt = "$6$" + salt + "$"
allChar = string.printable
for char1 in range(len(allChar))
for char2 in range(len(allChar))
word = allChar[char1] + allChar[char2]
word = word.strip(' ')
cryptWord = crypt.crypt(word, salt)
if cryptWord == cryptPass:
print '[+] Found Password: ' + word + ' '
return
return
def main():
passFile = open('shapass.txt')
for line in passFile.readlines():
if ':' in line:
user = line.split(':')[0]
cryptPass = line.split(':')[1].strip(' ')
print '[*] Cracking Password For: ' + user
testPass(cryptPass)
if __name__ == '__main__':
main()