Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1821a00

Browse files
committed
Ctrl+C in dictionary attack phase will now not abort the whole enumeration; also, question for common suffixes will now be asked only once
1 parent 5560196 commit 1821a00

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

lib/utils/hash.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def hashRecognition(value):
307307
return retVal
308308

309309
def dictionaryAttack(attack_dict):
310+
suffix_list = [""]
310311
hash_regexes = []
311312
results = []
312313

@@ -369,12 +370,11 @@ def dictionaryAttack(attack_dict):
369370
logger.info(infoMsg)
370371
kb.wordlist = getFileItems(dictpath, None, False)
371372

372-
message = "do you want to use common password suffixes? (slow!) [y/N] "
373-
test = readInput(message, default="N")
373+
message = "do you want to use common password suffixes? (slow!) [y/N] "
374+
test = readInput(message, default="N")
374375

375-
suffix_list = [""]
376-
if test[0] in ("y", "Y"):
377-
suffix_list += COMMON_PASSWORD_SUFFIXES
376+
if test[0] in ("y", "Y"):
377+
suffix_list += COMMON_PASSWORD_SUFFIXES
378378

379379
infoMsg = "starting dictionary attack (%s)" % __functions__[hash_regex].func_name
380380
logger.info(infoMsg)
@@ -427,7 +427,9 @@ def dictionaryAttack(attack_dict):
427427
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))
428428

429429
except KeyboardInterrupt:
430-
raise
430+
warnMsg = "Ctrl+C detected in dictionary attack phase"
431+
logger.warn(warnMsg)
432+
return results
431433

432434
except:
433435
warnMsg = "there was a problem while hashing entry: %s. " % repr(word)
@@ -477,7 +479,9 @@ def dictionaryAttack(attack_dict):
477479
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))
478480

479481
except KeyboardInterrupt:
480-
raise
482+
warnMsg = "Ctrl+C detected in dictionary attack phase"
483+
logger.warn(warnMsg)
484+
return results
481485

482486
except:
483487
warnMsg = "there was a problem while hashing entry: %s. " % repr(word)

0 commit comments

Comments
 (0)