1
0
UAHCode/CPE449/passwordAttacks/rainbowtable.py

24 lines
630 B
Python
Raw Normal View History

2022-08-28 19:39:08 +00:00
import sys
import hashlib
passwordListFile = sys.argv[1]
passwords = [ ]
hashArr = []
hashDictonary = { }
index = 0
passwordFile = open(passwordListFile)
passwordList = passwordFile.readlines()
for password in passwordList:
2022-08-29 17:00:58 +00:00
if not password.startswith("#!comment:"):
passCleanEncoded = password.rstrip().lstrip().encode("utf_16_le")
hash = hashlib.new("md4")
hash.update(passCleanEncoded)
hashDictonary[hash.hexdigest()] = password
2022-08-28 19:39:08 +00:00
hashDictonarySorted = sorted(hashDictonary)
for hashEntry in hashDictonarySorted:
msg = hashEntry + ":" + hashDictonary[hashEntry]
print(msg.rstrip())