From b15631cf2f6e54e602f1276f409255942f271bd5 Mon Sep 17 00:00:00 2001 From: bandrel Date: Tue, 6 Feb 2018 12:55:59 -0500 Subject: [PATCH] introduction of hex conversion for recycling --- hate_crack.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/hate_crack.py b/hate_crack.py index 37b3332..2502c4b 100755 --- a/hate_crack.py +++ b/hate_crack.py @@ -12,6 +12,7 @@ import time import random import re import json +import binascii # python2/3 compatability try: @@ -401,9 +402,16 @@ def hcatLMtoNT(): # Recycle Cracked Passwords def hcatRecycle(hcatHashType, hcatHashFile, hcatNewPasswords): global hcatProcess + working_file = hcatHashFile + '.working' if hcatNewPasswords > 0: - hcatProcess = subprocess.Popen("cat {hash_file}.out | cut -d : -f 2 > {hash_file}.working".format( - hash_file=hcatHashFile), shell=True).wait() + hcatProcess = subprocess.Popen("cat {hash_file}.out | cut -d : -f 2 > {working_file}".format( + hash_file=hcatHashFile, working_file=working_file), shell=True).wait() + converted = convert_hex(working_file) + + # Overwrite working file with updated converted words + with open(working_file, 'w') as f: + f.write("\n".join(converted)) + hcatProcess = subprocess.Popen( "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out {hash_file}.working " "-r {hcatPath}/rules/d3ad0ne.rule {tuning} --potfile-path={hate_path}/hashcat.pot".format( @@ -560,6 +568,20 @@ def yolo_combination(): hcatYoloCombination(hcatHashType, hcatHashFile) +# convert hex words for recycling +def convert_hex(working_file): + processed_words = [] + regex = r'^\$HEX\[(\S+)\]' + with open(working_file, 'r') as f: + for line in f: + match = re.search(regex, line.rstrip('\n')) + if match: + processed_words.append(binascii.unhexlify(match.group(1)).decode('utf-8')) + else: + processed_words.append(line.rstrip('\n')) + + return processed_words + # Display Cracked Hashes def show_results(): if os.path.isfile(hcatHashFile + ".out"):