Merge pull request #50 from trustedsec/quickcrack

Quickcrack wordlist and rule directory enumeration and choice.
This commit is contained in:
Justin Bollinger
2024-09-28 15:30:28 -04:00
committed by GitHub
3 changed files with 33 additions and 25 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
config.json
hashcat.pot

View File

@@ -12,7 +12,6 @@
"hcatThoroughCombinatorMasks": ["0","1","2","3","4","5","6","7","8","9"," ","-","_","+",",","!","#","$","\"","%","&","'","(",")","*",",",".","/",":",";","<","=",">","?","@","[","\\","]","^","`","{","|","}","~"],
"hcatThoroughBaseList": "rockyou.txt",
"hcatGoodMeasureBaseList": "rockyou.txt",
"hcatRules": ["best64.rule","d3ad0ne.rule", "T0XlC.rule", "dive.rule"],
"hcatPrinceBaseList": "rockyou.txt",
"pipalPath": "/path/to/pipal",
"pipal_count" : 10,

View File

@@ -61,12 +61,6 @@ except KeyError as e:
print('{0} is not defined in config.json using defaults from config.json.example'.format(e))
pipalPath = default_config['pipalPath']
try:
hcatRules = config_parser['hcatRules']
except KeyError as e:
print('{0} is not defined in config.json using defaults from config.json.example'.format(e))
hcatRules = default_config['hcatRules']
try:
hcatDictionaryWordlist = config_parser['hcatDictionaryWordlist']
except KeyError as e:
@@ -977,32 +971,46 @@ def quick_crack():
wordlist_choice = None
rule_choice = None
selected_hcatRules = []
while wordlist_choice is None:
raw_choice = input("\nEnter path of wordlist or wordlist directory.\n"
"Press Enter for default optimized wordlists [{0}]:".format(hcatOptimizedWordlists))
if raw_choice == '':
wordlist_choice = hcatOptimizedWordlists
else:
if os.path.exists(raw_choice):
wordlist_choice = raw_choice
wordlist_files = sorted(os.listdir(hcatWordlists))
print("\nWordlists:")
for i, file in enumerate(wordlist_files, start=1):
print(f"{i}. {file}")
while wordlist_choice is None:
try:
raw_choice = input("\nEnter path of wordlist or wordlist directory.\n"
"Press Enter for default optimized wordlists [{0}]: ".format(hcatOptimizedWordlists))
if raw_choice == '':
wordlist_choice = hcatOptimizedWordlists
elif os.path.exists(raw_choice):
wordlist_choice = raw_choice
elif 1 <= int(raw_choice) <= len(wordlist_files):
if os.path.exists(hcatWordlists + '/' + wordlist_files[int(raw_choice) - 1]):
wordlist_choice = hcatWordlists + '/' + wordlist_files[int(raw_choice) - 1]
print(wordlist_choice)
else:
wordlist_choice = None
print('Please enter a valid wordlist or wordlist directory.')
except ValueError:
print("Please enter a valid number.")
rule_files = sorted(os.listdir(hcatPath + '/rules'))
print("\nWhich rule(s) would you like to run?")
rule_number = 1
print('(0) To run without any rules')
for rule in hcatRules:
print('({0}) {1}'.format(rule_number, rule))
rule_number += 1
print('(99) YOLO...run all of the rules')
print('0. To run without any rules')
for i, file in enumerate(rule_files, start=1):
print(f"{i}. {file}")
print('99. YOLO...run all of the rules')
while rule_choice is None:
raw_choice = input('Enter Comma separated list of rules you would like to run. To run rules chained use the + symbol.\n'
'For example 1+1 will run {0} chained twice and 1,2 would run {0} and then {1} sequentially.\n'
'Choose wisely: '.format(hcatRules[0], hcatRules[1]))
'Choose wisely: '.format(rule_files[0], rule_files[1]))
if raw_choice != '':
rule_choice = raw_choice.split(',')
if '99' in rule_choice:
for rule in hcatRules:
for rule in rule_files:
selected_hcatRules.append('-r {hcatPath}/rules/{selected_rule}'.format(selected_rule=rule, hcatPath=hcatPath))
elif '0' in rule_choice:
selected_hcatRules = ['']
@@ -1013,14 +1021,14 @@ def quick_crack():
choices = choice.split('+')
for rule in choices:
try:
combined_choice = '{0} {1}'.format(combined_choice, '-r {hcatPath}/rules/{selected_rule}'.format(selected_rule=hcatRules[int(rule) - 1],
combined_choice = '{0} {1}'.format(combined_choice, '-r {hcatPath}/rules/{selected_rule}'.format(selected_rule=rule_files[int(rule) - 1],
hcatPath=hcatPath))
except:
continue
selected_hcatRules.append(combined_choice)
else:
try:
selected_hcatRules.append('-r {hcatPath}/rules/{selected_rule}'.format(selected_rule=hcatRules[int(choice) - 1],hcatPath=hcatPath))
selected_hcatRules.append('-r {hcatPath}/rules/{selected_rule}'.format(selected_rule=rule_files[int(choice) - 1],hcatPath=hcatPath))
except IndexError:
continue