From 612ee08a0b0eba5edc324fefbefe14b04ba542ae Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 3 Dec 2010 13:19:34 +0000 Subject: [PATCH] added response time kb attribute --- lib/controller/checks.py | 2 ++ lib/controller/controller.py | 2 +- lib/core/common.py | 4 ++-- lib/core/option.py | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 462c16d78..d7e2ba46c 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -734,7 +734,9 @@ def checkConnection(suppressOutput=False): logger.info(infoMsg) try: + start = time.time() page, _ = Request.queryPage(content=True) + kb.responseTime = time.time() - start conf.seqMatcher.set_seq1(page) except sqlmapConnectionException, errMsg: errMsg = getUnicode(errMsg) diff --git a/lib/controller/controller.py b/lib/controller/controller.py index 8312c678f..378eee9cb 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -265,7 +265,7 @@ def start(): setupTargetEnv() - if not checkConnection(conf.forms) or not checkString() or not checkRegexp(): + if not checkConnection(suppressOutput=conf.forms) or not checkString() or not checkRegexp(): continue if conf.nullConnection: diff --git a/lib/core/common.py b/lib/core/common.py index 20a809ea2..be341ce93 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1290,12 +1290,12 @@ def readXmlFile(xmlFile): xfile.close() return retVal -def calculateDeltaSeconds(start, epsilon=0.05): +def calculateDeltaSeconds(start, epsilon=0.1): """ Returns elapsed time from start till now (including expected error set by epsilon parameter) """ - return int(time.time() - start + epsilon) + return int(time.time() - start - kb.responseTime + epsilon) def initCommonOutputs(): kb.commonOutputs = {} diff --git a/lib/core/option.py b/lib/core/option.py index 6c443995a..5cd6aaf1d 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1170,6 +1170,7 @@ def __setKnowledgeBaseAttributes(): kb.partRun = None kb.proxyAuthHeader = None kb.queryCounter = 0 + kb.responseTime = 0 kb.resumedQueries = {} kb.retriesCount = 0 kb.tamperFunctions = []