From 9edd468cafd4829781ef81bfaf15e3ecd30699c7 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 19 Jul 2010 08:37:45 +0000 Subject: [PATCH] multithreading save to session on abort --- lib/techniques/blind/inference.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index dbd907d6d..c35b47e85 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -354,6 +354,17 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), replaceNewlineTabs(output, stdout=True))) iolock.release() + #TODO: more + if not conf.threadContinue: + if int(threading.currentThread().getName()) == numThreads - 1: + partialValue = unicode() + for v in value: + if isinstance(v, basestring) and v is not None: + partialValue += v + + if len(partialValue) > 0: + dataToSessionFile(replaceNewlineTabs(partialValue)) + except (sqlmapConnectionException, sqlmapValueException), errMsg: print conf.threadException = True @@ -381,7 +392,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None # Start the threads for numThread in range(numThreads): - thread = threading.Thread(target=downloadThread) + thread = threading.Thread(target=downloadThread, name=str(numThread)) thread.start() threads.append(thread) @@ -497,7 +508,6 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None break finalValue += val - dataToSessionFile(replaceNewlineTabs(val)) if showEta: