From 6cbb927012866d6629a2265e9f1be52fd9abb6e9 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Mon, 25 Jul 2011 11:05:49 +0000 Subject: [PATCH] Partial fix for -o not resumed at following runs if missing from command line --- lib/controller/checks.py | 1 + lib/core/common.py | 14 ++++++++++++++ lib/core/option.py | 9 ++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 696a6c146..75e1d3054 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -465,6 +465,7 @@ def checkSqlInjection(place, parameter, value): injection.conf.titles = conf.titles injection.conf.string = conf.string injection.conf.regexp = conf.regexp + injection.conf.optimize = conf.optimize if conf.beep or conf.realTest: beep() diff --git a/lib/core/common.py b/lib/core/common.py index ae6ddbcd3..1d588f3d7 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -2454,6 +2454,17 @@ def isTechniqueAvailable(technique=None): else: return getTechniqueData(technique) is not None +def setOptimize(): + #conf.predictOutput = True + conf.keepAlive = True + conf.threads = 3 if conf.threads < 3 else conf.threads + conf.nullConnection = not any([conf.data, conf.textOnly, conf.titles, conf.string, conf.regexp]) + + if not conf.nullConnection: + debugMsg = "turning off --null-connection switch used indirectly by switch -o" + logger.debug(debugMsg) + + def initTechnique(technique=None): """ Prepares proper page template and match ratio for technique specified @@ -2472,6 +2483,9 @@ def initTechnique(technique=None): setattr(conf, key, value) debugMsg = "resuming configuration option '%s' (%s)" % (key, value) logger.debug(debugMsg) + + if value and key == "optimize": + setOptimize() else: warnMsg = "there is no injection data available for technique " warnMsg += "'%s'" % enumValueToNameLookup(PAYLOAD.TECHNIQUE, technique) diff --git a/lib/core/option.py b/lib/core/option.py index a812df087..39c1ebee2 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -48,6 +48,7 @@ from lib.core.common import readCachedFileContent from lib.core.common import readInput from lib.core.common import runningAsAdmin from lib.core.common import sanitizeStr +from lib.core.common import setOptimize from lib.core.common import UnicodeRawConfigParser from lib.core.convert import urldecode from lib.core.data import conf @@ -1304,13 +1305,7 @@ def __cleanupOptions(): conf.multipleTargets = True if conf.optimize: - #conf.predictOutput = True - conf.keepAlive = True - conf.threads = 3 if conf.threads < 3 else conf.threads - conf.nullConnection = not any([conf.data, conf.textOnly, conf.titles, conf.string, conf.regexp]) - if not conf.nullConnection: - debugMsg = "turning off --null-connection switch used indirectly by switch -o" - logger.debug(debugMsg) + setOptimize() if conf.data: conf.data = urldecode(conf.data)