This commit is contained in:
Miroslav Stampar 2015-09-08 11:10:47 +02:00
parent 924e31c414
commit e59a220199

View File

@ -10,7 +10,7 @@ import threading
import time import time
import traceback import traceback
from thread import error as threadError from thread import error as ThreadError
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
@ -89,9 +89,9 @@ def exceptionHandledFunction(threadFunction):
kb.threadContinue = False kb.threadContinue = False
kb.threadException = True kb.threadException = True
raise raise
except Exception, errMsg: except Exception, ex:
# thread is just going to be silently killed # thread is just going to be silently killed
logger.error("thread %s: %s" % (threading.currentThread().getName(), errMsg)) logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message))
def setDaemon(thread): def setDaemon(thread):
# Reference: http://stackoverflow.com/questions/190010/daemon-threads-explanation # Reference: http://stackoverflow.com/questions/190010/daemon-threads-explanation
@ -145,8 +145,8 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
try: try:
thread.start() thread.start()
except threadError, errMsg: except ThreadError, ex:
errMsg = "error occurred while starting new thread ('%s')" % errMsg errMsg = "error occurred while starting new thread ('%s')" % ex.message
logger.critical(errMsg) logger.critical(errMsg)
break break
@ -178,10 +178,10 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
if forwardException: if forwardException:
raise raise
except (SqlmapConnectionException, SqlmapValueException), errMsg: except (SqlmapConnectionException, SqlmapValueException), ex:
print print
kb.threadException = True kb.threadException = True
logger.error("thread %s: %s" % (threading.currentThread().getName(), errMsg)) logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message))
except: except:
from lib.core.common import unhandledExceptionMessage from lib.core.common import unhandledExceptionMessage