From e7e23d1b7981c809bb52916271d3a2d7fa2a32d3 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 7 Jun 2011 17:16:01 +0000 Subject: [PATCH] fix for a Ctrl+C bug reported by nightman@email.de --- doc/THANKS | 2 +- lib/techniques/error/use.py | 13 ++++++------- lib/techniques/inband/union/use.py | 13 ++++++------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/doc/THANKS b/doc/THANKS index 452c615ef..884c46f68 100644 --- a/doc/THANKS +++ b/doc/THANKS @@ -517,7 +517,7 @@ mitchell for reporting a bug nightman - for reporting several bugs + for reporting considerable amount of bugs pacman730 for reporting a bug diff --git a/lib/techniques/error/use.py b/lib/techniques/error/use.py index adadc704b..cfdd9ccff 100644 --- a/lib/techniques/error/use.py +++ b/lib/techniques/error/use.py @@ -319,6 +319,11 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False): stopLimit = 1 try: + threadData = getCurrentThreadData() + numThreads = min(conf.threads, stopLimit-startLimit) + threadData.shared.limits = range(startLimit, stopLimit) + threadData.shared.outputs = [] + if stopLimit > TURN_OFF_RESUME_INFO_LIMIT: kb.suppressResumeInfo = True infoMsg = "suppressing possible resume console info because of " @@ -329,11 +334,6 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False): for lock in lockNames: kb.locks[lock] = threading.Lock() - threadData = getCurrentThreadData() - numThreads = min(conf.threads, stopLimit-startLimit) - threadData.shared.limits = range(startLimit, stopLimit) - threadData.shared.outputs = [] - def errorThread(): threadData = getCurrentThreadData() @@ -361,8 +361,6 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False): runThreads(numThreads, errorThread) - outputs = threadData.shared.outputs - except KeyboardInterrupt: warnMsg = "user aborted during enumeration. sqlmap " warnMsg += "will display partial output" @@ -375,6 +373,7 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False): logger.critical(errMsg) finally: + outputs = threadData.shared.outputs kb.suppressResumeInfo = False if not outputs: diff --git a/lib/techniques/inband/union/use.py b/lib/techniques/inband/union/use.py index f3706e415..987932c5e 100644 --- a/lib/techniques/inband/union/use.py +++ b/lib/techniques/inband/union/use.py @@ -259,6 +259,11 @@ def unionUse(expression, unpack=True, dump=False): stopLimit = 1 try: + threadData = getCurrentThreadData() + numThreads = min(conf.threads, stopLimit-startLimit) + threadData.shared.limits = range(startLimit, stopLimit) + threadData.shared.value = "" + if stopLimit > TURN_OFF_RESUME_INFO_LIMIT: kb.suppressResumeInfo = True infoMsg = "suppressing possible resume console info because of " @@ -269,11 +274,6 @@ def unionUse(expression, unpack=True, dump=False): for lock in lockNames: kb.locks[lock] = threading.Lock() - threadData = getCurrentThreadData() - numThreads = min(conf.threads, stopLimit-startLimit) - threadData.shared.limits = range(startLimit, stopLimit) - threadData.shared.value = "" - def unionThread(): threadData = getCurrentThreadData() @@ -325,8 +325,6 @@ def unionUse(expression, unpack=True, dump=False): runThreads(numThreads, unionThread) - value = threadData.shared.value - if conf.verbose == 1: clearConsoleLine(True) @@ -342,6 +340,7 @@ def unionUse(expression, unpack=True, dump=False): logger.critical(errMsg) finally: + value = threadData.shared.value kb.suppressResumeInfo = False if not value: