Advertisement
rfmonk

testPass.py

Nov 18th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. #! /usr/bin/env python
  2. # credit for this belongs to the book
  3. # violent python
  4.  
  5.  
  6. import crypt
  7. def testPass(cryptPass):
  8.     salt = cryptPass[0:2]
  9.     dictFile = open('dictionary.txt', 'r')
  10.     for word in dictFile.readlines():
  11.         word = word.strip('\n')
  12.         cryptWord = crypt.crypt(word, salt)
  13.         if (cryptWord == cryptPass):
  14.             print "[+] Found Password: "+word+"\n"
  15.             return
  16.     print "[-] Password Not Found.\n"
  17.     return
  18. def main():
  19.     passFile = open('passwords.txt')
  20.     for line in passFile.readlines():
  21.         if ":" in line:
  22.             user = line.split(':')[0]
  23.             cryptPass = line.split(':')[1].strip(' ')
  24.             print "[*] Cracking Password For: "+user
  25.             testPass(cryptPass)
  26. if __name__ == "__main__":
  27.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement