Skip to content

Instantly share code, notes, and snippets.

@miketweaver
Created October 13, 2017 05:33
Show Gist options
  • Save miketweaver/3c3649fd2884e63a73a589036b24bb3e to your computer and use it in GitHub Desktop.
Save miketweaver/3c3649fd2884e63a73a589036b24bb3e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import hashlib
import binascii
score = 0
hashfile = "newformat.txt"
# Notes:
# Chars 0-39 are the first 40 chars of the hash
# Char 40 = :
# If it is normal then char 41 to the end is the password
# If it is in $HEX[] format then the HEX password is char 46 to the second to last character
with open(hashfile) as fp:
for line in fp:
line = line.strip()
if (line[40:46]+line[-1:] == ":$HEX[]"):
if (hashlib.sha1(binascii.unhexlify(line[46:-1])).hexdigest() == line[0:40] ):
print line
score+=1
elif (hashlib.sha1(line[41:]).hexdigest() == line[0:40]):
print line
score+=1
print("Score is: " + str(score))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment