From 4184b4f4132174ea5d62c4c8c8701df1d92c4c8a Mon Sep 17 00:00:00 2001 From: bandrel Date: Tue, 8 May 2018 10:58:04 -0400 Subject: [PATCH] Abstracted the wordlists and masks and put them in the configfile --- config.json | 6 +- hate_crack.py | 178 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 119 insertions(+), 65 deletions(-) diff --git a/config.json b/config.json index 9c3c920..1313211 100644 --- a/config.json +++ b/config.json @@ -3,5 +3,9 @@ "hcatBin": "hashcat", "hcatTuning": "--force", "hcatWordlists": "/Passwords/wordlists", - "hcatOptimizedWordlists": "/Passwords/optimized_wordlists" + "hcatOptimizedWordlists": "/Passwords/optimized_wordlists", + "hcatMiddleCombinatorMasks": ["2","4"," ","-","_","+",",",".","&"], + "hcatMiddleBaseList": "rockyou.txt", + "hcatThoroughCombinatorMasks": ["0","1","2","3","4","5","6","7","8","9"," ","-","_","+",",","!","#","$","\"","%","&","'","(",")","*",",",".","/",":",";","<","=",">","?","@","[","\\","]","^","`","{","|","}","~"], + "hcatThoroughBaseList": "rockyou.txt" } \ No newline at end of file diff --git a/hate_crack.py b/hate_crack.py index 100361c..9fb26b2 100755 --- a/hate_crack.py +++ b/hate_crack.py @@ -28,6 +28,10 @@ with open(hate_path + '/config.json') as config: hcatTuning = config_parser['hcatTuning'] hcatWordlists = config_parser['hcatWordlists'] hcatOptimizedWordlists = config_parser['hcatOptimizedWordlists'] + hcatMiddleCombinatorMasks = config_parser['hcatMiddleCombinatorMasks'] + hcatMiddleBaseList = config_parser['hcatMiddleBaseList'] + hcatThoroughCombinatorMasks = config_parser['hcatThoroughCombinatorMasks'] + hcatThoroughBaseList = config_parser['hcatThoroughBaseList'] if sys.platform == 'darwin': hcatExpanderBin = "expander.app" @@ -48,6 +52,24 @@ 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) + + + hcatHashCount = 0 hcatHashCracked = 0 hcatBruteCount = 0 @@ -440,83 +462,111 @@ def hcatYoloCombination(hcatHashType, hcatHashFile): # Middle fast Combinator Attack def hcatMiddleCombinator(hcatHashType, hcatHashFile): global hcatProcess - masks = ["2","4"," ","-","_","+",",",".","&"] - - for x in range(len(masks)): - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 -j '${middle_mask}' {word_lists}/rockyou.txt " - "{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, - middle_mask=masks[x], - hate_path=hate_path), - shell=True).wait() - + masks = hcatMiddleCombinatorMasks + try: + for x in range(len(masks)): + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 -j '${middle_mask}' {left} " + "{right} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + left=hcatMiddleBaseList, + right=hcatMiddleBaseList, + tuning=hcatTuning, + middle_mask=masks[x], + hate_path=hate_path), + shell=True) + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() # Middle thorough Combinator Attack def hcatThoroughCombinator(hcatHashType, hcatHashFile): global hcatProcess - masks = ["0","1","2","3","4","5","6","7","8","9"," ","-","_","+",",","!","#","$","\"","%","&","\'","(",")","*",",",".","/",":",";","<","=",">","?","@","[","\\","]","^","`","{","|","}","~"] - - 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=hcatBin, - hash_type=hcatHashType, - hash_file=hcatHashFile, - word_lists=hcatWordlists, - tuning=hcatTuning, - hate_path=hate_path), - shell=True).wait() - - for x in range(len(masks)): + masks = hcatThoroughCombinatorMasks + try: hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 -j '${middle_mask}' {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), + left=hcatThoroughBaseList, + right=hcatThoroughBaseList, word_lists=hcatWordlists, tuning=hcatTuning, - middle_mask=masks[x], hate_path=hate_path), - shell=True).wait() - - for x in range(len(masks)): - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 -k '${end_mask}' {word_lists}/rockyou.txt " - "{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, - end_mask=masks[x], - hate_path=hate_path), - shell=True).wait() - - for x in range(len(masks)): - hcatProcess = subprocess.Popen( - "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 " - "-j '${middle_mask}' -k '${end_mask}' {word_lists}/rockyou.txt " - "{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, - middle_mask=masks[x], - end_mask=masks[x], - hate_path=hate_path), - shell=True).wait() + shell=True) + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() + try: + for x in range(len(masks)): + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 " + "-j '${middle_mask}' {left} {right} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + left=hcatThoroughBaseList, + right=hcatThoroughBaseList, + word_lists=hcatWordlists, + tuning=hcatTuning, + middle_mask=masks[x], + hate_path=hate_path), + shell=True) + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() + try: + for x in range(len(masks)): + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 " + "-k '${end_mask}' {left} {right} {tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + left=hcatThoroughBaseList, + right=hcatThoroughBaseList, + word_lists=hcatWordlists, + tuning=hcatTuning, + end_mask=masks[x], + hate_path=hate_path), + shell=True) + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill() + try: + for x in range(len(masks)): + hcatProcess = subprocess.Popen( + "{hcatBin} -m {hash_type} {hash_file} --session {session_name} --remove -o {hash_file}.out -a 1 " + "-j '${middle_mask}' -k '${end_mask}' {left} {right} {tuning} --potfile-path={hate_path}/hashcat.pot".format( + hcatBin=hcatBin, + hash_type=hcatHashType, + hash_file=hcatHashFile, + session_name=os.path.basename(hcatHashFile), + left=hcatThoroughBaseList, + right=hcatThoroughBaseList, + word_lists=hcatWordlists, + tuning=hcatTuning, + middle_mask=masks[x], + end_mask=masks[x], + hate_path=hate_path), + shell=True) + hcatProcess.wait() + except KeyboardInterrupt: + print('Killing PID {0}...'.format(str(hcatProcess.pid))) + hcatProcess.kill()