diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d344ba6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.json diff --git a/config.json b/config.json.example similarity index 66% rename from config.json rename to config.json.example index 1313211..6780e5c 100644 --- a/config.json +++ b/config.json.example @@ -4,8 +4,13 @@ "hcatTuning": "--force", "hcatWordlists": "/Passwords/wordlists", "hcatOptimizedWordlists": "/Passwords/optimized_wordlists", + "hcatDictionaryWordlist": ["rockyou.txt"], + "hcatCombinationWordlist": ["rockyou.txt","rockyou.txt"], + "hcatHybridlist": ["rockyou.txt"], "hcatMiddleCombinatorMasks": ["2","4"," ","-","_","+",",",".","&"], "hcatMiddleBaseList": "rockyou.txt", "hcatThoroughCombinatorMasks": ["0","1","2","3","4","5","6","7","8","9"," ","-","_","+",",","!","#","$","\"","%","&","'","(",")","*",",",".","/",":",";","<","=",">","?","@","[","\\","]","^","`","{","|","}","~"], - "hcatThoroughBaseList": "rockyou.txt" + "hcatThoroughBaseList": "rockyou.txt", + "hcatGoodMeasureBaseList": "rockyou.txt", + "hcatPrinceBaseList": "rockyou.txt" } \ No newline at end of file diff --git a/hate_crack.py b/hate_crack.py index 8c731ae..f5187c1 100755 --- a/hate_crack.py +++ b/hate_crack.py @@ -11,6 +11,7 @@ import random import re import json import binascii +import shutil # python2/3 compatability try: @@ -18,20 +19,73 @@ try: except NameError: pass - hate_path = os.path.dirname(os.path.realpath(__file__)) +if not os.path.isfile(hate_path + '/config.json'): + print('Initializing config.json from config.json.example') + shutil.copy(hate_path + '/config.json.example',hate_path + '/config.json') +if not os.path.isfile(sys.argv[1]): + print('{0} is not a valid file containing hashes'.format(sys.argv[1])) + quit(1) + + with open(hate_path + '/config.json') as config: config_parser = json.load(config) - hcatPath = config_parser['hcatPath'] - hcatBin = config_parser['hcatBin'] - hcatTuning = config_parser['hcatTuning'] - hcatWordlists = config_parser['hcatWordlists'] - hcatOptimizedWordlists = config_parser['hcatOptimizedWordlists'] +with open(hate_path + '/config.json.example') as defaults: + default_config = json.load(defaults) + +hcatPath = config_parser['hcatPath'] +hcatBin = config_parser['hcatBin'] +hcatTuning = config_parser['hcatTuning'] +hcatWordlists = config_parser['hcatWordlists'] +hcatOptimizedWordlists = config_parser['hcatOptimizedWordlists'] + +try: + hcatDictionaryWordlist = config_parser['hcatDictionaryWordlist'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatDictionaryWordlist = default_config['hcatDictionaryWordlist'] +try: + hcatHybridlist = config_parser['hcatHybridlist'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatHybridlist = default_config[e.args[0]] +try: + hcatCombinationWordlist = config_parser['hcatCombinationWordlist'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatCombinationWordlist = default_config[e.args[0]] +try: hcatMiddleCombinatorMasks = config_parser['hcatMiddleCombinatorMasks'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatMiddleCombinatorMasks = default_config[e.args[0]] +try: hcatMiddleBaseList = config_parser['hcatMiddleBaseList'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatMiddleBaseList = default_config[e.args[0]] +try: hcatThoroughCombinatorMasks = config_parser['hcatThoroughCombinatorMasks'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatThoroughCombinatorMasks = default_config[e.args[0]] +try: hcatThoroughBaseList = config_parser['hcatThoroughBaseList'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatThoroughBaseList = default_config[e.args[0]] +try: + hcatPrinceBaseList = config_parser['hcatPrinceBaseList'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatPrinceBaseList = default_config[e.args[0]] +try: + hcatGoodMeasureBaseList = config_parser['hcatGoodMeasureBaseList'] +except KeyError as e: + print('{0} is not defined in config.json using defaults from config.json.example'.format(e)) + hcatGoodMeasureBaseList = default_config[e.args[0]] + if sys.platform == 'darwin': hcatExpanderBin = "expander.app" @@ -42,6 +96,14 @@ else: hcatCombinatorBin = "combinator.bin" hcatPrinceBin = "pp64.bin" +def verify_wordlist_dir(directory, wordlist): + if os.path.isfile(wordlist): + return wordlist + elif os.path.isfile(directory + '/' + wordlist): + return directory + '/' + wordlist + else: + print('Invalid path for {0}. Please check configuration and try again.'.format(wordlist)) + quit(1) # hashcat biniary checks for systems that install hashcat binary in different location than the rest of the hashcat files if os.path.isfile(hcatBin): @@ -52,22 +114,17 @@ else: print('Invalid path for hashcat binary. Please check configuration and try again.') quit(1) -if os.path.isfile(hcatMiddleBaseList): - pass -elif os.path.isfile(hcatWordlists+'/'+hcatMiddleBaseList): - hcatMiddleBaseList = hcatWordlists+'/'+hcatMiddleBaseList -else: - print('Invalid path for hcatMiddleBaseList. Please check configuration and try again.') - quit(1) - -if os.path.isfile(hcatThoroughBaseList): - pass -elif os.path.isfile(hcatWordlists+'/'+hcatThoroughBaseList): - hcatThoroughBaseList = hcatWordlists+'/'+hcatThoroughBaseList -else: - print('Invalid path for hcatThoroughBaseList. Please check configuration and try again.') - quit(1) - +#verify and convert wordlists to fully qualified paths +hcatMiddleBaseList = verify_wordlist_dir(hcatWordlists, hcatMiddleBaseList) +hcatThoroughBaseList = verify_wordlist_dir(hcatWordlists, hcatThoroughBaseList) +hcatPrinceBaseList = verify_wordlist_dir(hcatWordlists, hcatPrinceBaseList) +hcatGoodMeasureBaseList = verify_wordlist_dir(hcatWordlists, hcatGoodMeasureBaseList) +for x in range(len(hcatDictionaryWordlist)): + hcatDictionaryWordlist[x] = verify_wordlist_dir(hcatWordlists, hcatDictionaryWordlist[x]) +for x in range(len(hcatHybridlist)): + hcatHybridlist[x] = verify_wordlist_dir(hcatWordlists, hcatHybridlist[x]) +hcatCombinationWordlist[0] = verify_wordlist_dir(hcatWordlists, hcatCombinationWordlist[0]) +hcatCombinationWordlist[1] = verify_wordlist_dir(hcatWordlists, hcatCombinationWordlist[1]) hcatHashCount = 0 @@ -99,8 +156,7 @@ def ascii_art(): \ Y // __ \| | \ ___/ \ \____| | \// __ \\ \___| < \___|_ /(____ /__| \___ >____\______ /|__| (____ /\___ >__|_ \ \/ \/ \/_____/ \/ \/ \/ \/ - Public Release - Version 1.04 + Version 1.05 """) @@ -161,40 +217,41 @@ def hcatDictionary(hcatHashType, hcatHashFile): hcatProcess.kill() - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hcatHashType} {hash_file} --session {session_name} --remove -o {hash_file}.out {hcatWordlists}/rockyou.txt " - "-r {hcatPath}/rules/d3ad0ne.rule {tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatPath=hcatPath, - hcatBin=hcatBin, - hcatHashType=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - hcatWordlists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + for wordlist in hcatDictionaryWordlist: + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hcatHashType} {hash_file} --session {session_name} --remove -o {hash_file}.out {hcatWordlist} " + "-r {hcatPath}/rules/d3ad0ne.rule {tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatPath=hcatPath, + hcatBin=hcatBin, + hcatHashType=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + hcatWordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hcatHashType} {hash_file} --session {session_name} --remove -o {hash_file}.out {hcatWordlists}/rockyou.txt " - "-r {hcatPath}/rules/T0XlC.rule {tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatPath=hcatPath, - hcatBin=hcatBin, - hcatHashType=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - hcatWordlists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hcatHashType} {hash_file} --session {session_name} --remove -o {hash_file}.out {hcatWordlist} " + "-r {hcatPath}/rules/T0XlC.rule {tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatPath=hcatPath, + hcatBin=hcatBin, + hcatHashType=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + hcatWordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() hcatDictionaryCount = lineCount(hcatHashFile + ".out") - hcatBruteCount @@ -311,13 +368,15 @@ def hcatCombination(hcatHashType, hcatHashFile): global hcatCombinationCount global hcatProcess hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 {word_lists}/rockyou.txt " - "{word_lists}/rockyou.txt {tuning} --potfile-path={hate_path}/hashcat.pot".format( + "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 {left} " + "{right} {tuning} --potfile-path={hate_path}/hashcat.pot".format( hcatBin=hcatBin, hash_type=hcatHashType, hash_file=hcatHashFile, session_name=os.path.basename(hcatHashFile), word_lists=hcatWordlists, + left=hcatCombinationWordlist[0], + right=hcatCombinationWordlist[1], tuning=hcatTuning, hate_path=hate_path), shell=True) @@ -334,103 +393,104 @@ def hcatCombination(hcatHashType, hcatHashFile): def hcatHybrid(hcatHashType, hcatHashFile): global hcatHybridCount global hcatProcess - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 6 -1 ?s?d {word_lists}/rockyou.txt ?1?1 " - "{tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatBin=hcatBin, - hash_type=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - word_lists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + for wordlist in hcatHybridlist: + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 6 -1 ?s?d {wordlist} ?1?1 " + "{tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + wordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 6 -1 ?s?d {word_lists}/rockyou.txt ?1?1?1 " - "{tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatBin=hcatBin, - hash_type=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - word_lists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 6 -1 ?s?d {wordlist} ?1?1?1 " + "{tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + wordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 6 -1 ?s?d {word_lists}/rockyou.txt " - "?1?1?1?1 {tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatBin=hcatBin, - hash_type=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - word_lists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 6 -1 ?s?d {wordlist} " + "?1?1?1?1 {tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + wordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 7 -1 ?s?d ?1?1 {word_lists}/rockyou.txt " - "{tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatBin=hcatBin, - hash_type=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - word_lists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 7 -1 ?s?d ?1?1 {wordlist} " + "{tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + wordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 7 -1 ?s?d ?1?1?1 {word_lists}/rockyou.txt " - "{tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatBin=hcatBin, - hash_type=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - word_lists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 7 -1 ?s?d ?1?1?1 {wordlist} " + "{tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + wordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 7 -1 ?s?d ?1?1?1?1 {word_lists}/rockyou.txt " - "{tuning} --potfile-path={hate_path}/hashcat.pot".format( - hcatBin=hcatBin, - hash_type=hcatHashType, - hash_file=hcatHashFile, - session_name=os.path.basename(hcatHashFile), - word_lists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), shell=True) - try: - hcatProcess.wait() - except KeyboardInterrupt: - print('Killing PID {0}...'.format(str(hcatProcess.pid))) - hcatProcess.kill() + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --remove -o {hash_file}.out -a 7 -1 ?s?d ?1?1?1?1 {wordlist} " + "{tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + wordlist=wordlist, + tuning=hcatTuning, + hate_path=hate_path), shell=True) + try: + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() - hcatHybridCount = lineCount(hcatHashFile + ".out") - hcatHashCracked + hcatHybridCount = lineCount(hcatHashFile + ".out") - hcatHashCracked # YOLO Combination Attack @@ -592,15 +652,14 @@ def hcatPrince(hcatHashType, hcatHashFile): hcatHashCracked = lineCount(hcatHashFile + ".out") hcatProcess = subprocess.Popen( "{hate_path}/princeprocessor/{prince_bin} --case-permute --elem-cnt-min=1 --elem-cnt-max=16 -c < " - "{word_lists}/rockyou.txt | {hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out " + "{hcatPrinceBaseList} | {hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out " "-r {hate_path}/princeprocessor/rules/prince_optimized.rule {tuning} --potfile-path={hate_path}/hashcat.pot".format( hcatBin=hcatBin, prince_bin=hcatPrinceBin, hash_type=hcatHashType, hash_file=hcatHashFile, session_name=os.path.basename(hcatHashFile), - word_lists=hcatWordlists, - optimized_lists=hcatOptimizedWordlists, + hcatPrinceBaseList=hcatPrinceBaseList, tuning=hcatTuning, hate_path=hate_path), shell=True) try: @@ -615,12 +674,13 @@ def hcatGoodMeasure(hcatHashType, hcatHashFile): global hcatProcess hcatProcess = subprocess.Popen( "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -r {hcatPath}/rules/combinator.rule " - "-r {hcatPath}/rules/InsidePro-PasswordsPro.rule {word_lists}/rockyou.txt {tuning} " + "-r {hcatPath}/rules/InsidePro-PasswordsPro.rule {hcatGoodMeasureBaseList} {tuning} " "--potfile-path={hate_path}/hashcat.pot".format( hcatPath=hcatPath, hcatBin=hcatBin, hash_type=hcatHashType, hash_file=hcatHashFile, + hcatGoodMeasureBaseList=hcatGoodMeasureBaseList, session_name=os.path.basename(hcatHashFile), word_lists=hcatWordlists, tuning=hcatTuning, @@ -778,7 +838,7 @@ def cleanup(): # Quick Dictionary Attack with Optional Chained Best64 Rules def quick_crack(): - hcatChainsInput = int(input("\nHow many times would you like to chain the best64.rule? (0): ") or 0) + hcatChainsInput = int(input("\nHow many times would you like to chain the best64.rule? (1): ") or 1) hcatChains = '' if hcatChainsInput > 0: for n in range(1, hcatChainsInput): @@ -870,9 +930,6 @@ def pathwell_crack(): # PRINCE Attack def prince_attack(): - if not os.path.isfile(hcatWordlists + '/rockyou.txt'): - print("rockyou.txt not found in {0} Please verify and try again").format(hcatWordlists) - return hcatPrince(hcatHashType, hcatHashFile) diff --git a/readme.md b/readme.md index 4809d12..0befcaf 100644 --- a/readme.md +++ b/readme.md @@ -57,8 +57,7 @@ $ ./hate_crack.py 1000 \ Y // __ \| | \ ___/ \ \____| | \// __ \\ \___| < \___|_ /(____ /__| \___ >____\______ /|__| (____ /\___ >__|_ \ \/ \/ \/_____/ \/ \/ \/ \/ - Public Release - Version 1.03 + Version 1.05 (1) Quick Crack @@ -165,6 +164,13 @@ https://jeffh.net/2018/04/26/combinator_methods/ ------------------------------------------------------------------- ### Version History +Version 1.05 + Abstraction of rockyou.txt so that you can use whatever dictionary that you would like to specified in the config.json + Minor change the quickcrack that allows you to specify 0 for number of times best64 is chained + +Version 1.04 + Two new attacks Middle Combinator and Thorough Combinator + Version 1.03 Introduction of new feature to use session files for multiple concurrent sessions of hate_crack Minor bug fix