Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions extra-scripts/timecrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,28 @@ def main():
passwords that are popular in an organisation.
""")

# Keep hash file as FileType since it's less likely to have encoding issues
argparser.add_argument('hashes', type=FileType('r'), help='Output of timeroast.py')
argparser.add_argument('dictionary', type=FileType('r'), help='Line-delimited password dictionary')
# Change dictionary to just take the filename as a string
argparser.add_argument('dictionary', type=str, help='Line-delimited password dictionary')
args = argparser.parse_args()

crackcount = 0
for rid, password in try_crack(args.hashes, args.dictionary):
print(f'[+] Cracked RID {rid} password: {password}')
crackcount += 1

# Open the dictionary file with proper encoding and error handling
try:
with open(args.dictionary, 'r', encoding='utf-8', errors='ignore') as dictfile:
for rid, password in try_crack(args.hashes, dictfile):
print(f'[+] Cracked RID {rid} password: {password}')
crackcount += 1
except FileNotFoundError:
print(f'ERROR: Dictionary file not found: {args.dictionary}', file=sys.stderr)
sys.exit(1)
except IOError as e:
print(f'ERROR: Could not read dictionary file: {e}', file=sys.stderr)
sys.exit(1)

print(f'\n{crackcount} passwords recovered.')

if __name__ == '__main__':
main()


main()