Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import crypt
  2. import optparse
  3.  
  4. def testPass(cryptPass, dname):
  5. salt = cryptPass[0:2]
  6. dictFile = open(dname, 'r')
  7. for word in dictFile.readlines():
  8. word = word.strip('\n')
  9. cryptWord = crypt.crypt(word,salt)
  10. if (cryptWord == cryptPass):
  11. print "[+] Found Password: "+word+"\n"
  12. return
  13. print "[-] Password Not Found. \n"
  14. return
  15.  
  16. def Main():
  17. parser = optparse.OptionParser("usage %prog "+"-f <passwordFile> -d <dictionary>")
  18. parser.add_option('-f', dest='pname', type='string', help='specify password file')
  19. parser.add_option('-d', dest='dname', type='string', help='specify dictionary file')
  20. (options, args) = parser.parse_args()
  21. if (options.pname == None or (options.dname == None)):
  22. print parser.usage
  23. exit(0);
  24. else:
  25. pname = options.pname
  26. dname = options.dname
  27.  
  28. passFile = open(pname, 'r')
  29. for line in passFile.readlines():
  30. if ":" in line:
  31. user = line.split(":")[0]
  32. cryptPass = line.split(":")[1].strip(' ')
  33. print "[*] Cracking password for:"+user
  34. testPass(cryptPass, dname)
  35.  
  36. if __name__ == '__main__':
  37. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement