From db536427f07e18f37f1324a02cfa54c5216b2884 Mon Sep 17 00:00:00 2001 From: stamparm Date: Thu, 4 Jul 2013 15:34:00 +0200 Subject: [PATCH] Adding a question for storing hashes to a temporary file (after a mention of it on Twitter) --- lib/core/option.py | 1 + lib/utils/hash.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 6d32dbb1b..526d35d30 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1661,6 +1661,7 @@ def _setKnowledgeBaseAttributes(flushAll=True): kb.reduceTests = None kb.stickyDBMS = False kb.stickyLevel = None + kb.storeHashesChoice = None kb.suppressResumeInfo = False kb.technique = None kb.testMode = False diff --git a/lib/utils/hash.py b/lib/utils/hash.py index 1f7555a86..df0916b25 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -358,11 +358,19 @@ def storeHashesToFile(attack_dict): if not attack_dict: return + if kb.storeHashesChoice is None: + message = "do you want to store hashes to a temporary file " + message += "for eventual further processing with other tools [y/N] " + test = readInput(message, default="N") + kb.storeHashesChoice = test[0] in ("y", "Y") + + if not kb.storeHashesChoice: + return + handle, filename = tempfile.mkstemp(prefix="sqlmaphashes-", suffix=".txt") os.close(handle) - infoMsg = "writing hashes to file '%s' " % filename - infoMsg += "for eventual further processing with other tools" + infoMsg = "writing hashes to a temporary file '%s' " % filename logger.info(infoMsg) items = set()