Skip to content

Instantly share code, notes, and snippets.

@chrismaddalena
Created April 15, 2019 13:56
Show Gist options
  • Save chrismaddalena/03605ad5115f754d4a553217917fb895 to your computer and use it in GitHub Desktop.
Save chrismaddalena/03605ad5115f754d4a553217917fb895 to your computer and use it in GitHub Desktop.
def process_hashes(hash_file):
"""Process the hashes in the provided file and return a dictionary."""
# Create hashes of the hashes, lol
with open(hash_file, 'r') as hash_dump:
hashes = {}
for line in hash_dump:
# Ignore machine accounts
if not '$' in line:
# Separate DOMAIN\USER from NTLM and USER from DOMAIN
array = line.split(':::')
username = array[0].split('\\')[1]
# Ignore the empty/no password NTLM hash
if not array[1] == '31d6cfe0d16ae931b73c59d7e0c089c0':
hashes[username] = array[1].strip()
return hashes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment