Adm1n_0v3rride

UNIX password cracker

Jan 3rd, 2018
142
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3. import crypt
  4.        
  5.         def testPass(cryptPass):
  6.                 salt = cryptPass[0:2]
  7.                 dictFile = open('dictionary.txt','r')
  8.  
  9. for word in dictFile.readlines():
  10.      word = word.strip('\n')
  11.     cryptWord = crypt.crypt(word,salt)
  12.  
  13. if (cryptWord == cryptPass):
  14.  print "[+] Found Password: "+word+"\n"
  15.  return
  16. print "[-] Password Not Found.\n"
  17. return
  18.  
  19. def main():
  20.     passFile = open('passwords.txt')
  21.  
  22. for line in passFile.readlines():
  23.     if ":" in line:
  24.     user = line.split(':')[0]
  25.     cryptPass = line.split(':')[1].strip(' ')
  26.     print "[*] Cracking Password For: "+user
  27.     testPass(cryptPass)
  28.  
  29. if __name__ == "__main__":
  30. main()
RAW Paste Data