Created
September 15, 2022 17:25
-
-
Save jstnkndy/cc3dc2ea6e9fcd961854e377f625d9d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
''' | |
This script can be used to identify passwords that are being used across multiple accounts. | |
Example: python3 password_reuse.py <file in username:hash format> | |
''' | |
import sys | |
from pprint import pprint | |
from collections import defaultdict | |
if len(sys.argv) != 2: | |
print('Usage: {} <hash file in username:hash format>'.format(sys.argv[0])) | |
sys.exit() | |
hash_file = sys.argv[1] | |
data = [line.rstrip() for line in open(hash_file).readlines()] | |
d = defaultdict(list) | |
for line in data: | |
username, password_hash = line.split(":") | |
d[password_hash].append(username) | |
for nt_hash in d: | |
if len(d[nt_hash]) > 1: | |
print("{} - {}".format(nt_hash, d[nt_hash])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment