From 50dde39e68da090ba12c987824fe57c2c2cebe47 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 7 Jun 2011 10:32:18 +0000 Subject: [PATCH] minor update --- lib/core/threads.py | 7 ++++--- lib/techniques/blind/inference.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/core/threads.py b/lib/core/threads.py index 470559a41..0c5b21b70 100644 --- a/lib/core/threads.py +++ b/lib/core/threads.py @@ -60,9 +60,10 @@ def exceptionHandledFunction(threadFunction): kb.threadContinue = False kb.threadException = True raise - except: - kb.threadContinue = False - kb.threadException = True + except Exception, errMsg: + # thread is just going to be silently killed + print + logger.error("thread %s: %s" % (threading.currentThread().getName(), errMsg)) def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardException=True, threadChoice=False): threads = [] diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index 0bf0f4528..9e81f651a 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -390,7 +390,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None except (sqlmapConnectionException, sqlmapValueException), errMsg: print kb.threadException = True - logger.error("thread %d: %s" % (numThread + 1, errMsg)) + logger.error("thread %s: %s" % (threading.currentThread().getName(), errMsg)) except KeyboardInterrupt: kb.threadException = True @@ -409,7 +409,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None print kb.threadException = True errMsg = unhandledExceptionMessage() - logger.error("thread %d: %s" % (numThread + 1, errMsg)) + logger.error("thread %s: %s" % (threading.currentThread().getName(), errMsg)) traceback.print_exc() # Start the threads