automatic increasing of time delay on lagging connections

This commit is contained in:
Miroslav Stampar 2011-04-19 14:28:51 +00:00
parent 13f8c001a7
commit 96b5fede5a

View File

@ -46,8 +46,9 @@ from lib.core.exception import sqlmapSyntaxException
from lib.core.settings import HTTP_SILENT_TIMEOUT from lib.core.settings import HTTP_SILENT_TIMEOUT
from lib.core.settings import META_REFRESH_REGEX from lib.core.settings import META_REFRESH_REGEX
from lib.core.settings import MIN_TIME_RESPONSES from lib.core.settings import MIN_TIME_RESPONSES
from lib.core.settings import WARN_TIME_STDEV from lib.core.settings import TIME_DEFAULT_DELAY
from lib.core.settings import URI_HTTP_HEADER from lib.core.settings import URI_HTTP_HEADER
from lib.core.settings import WARN_TIME_STDEV
from lib.core.threads import getCurrentThreadData from lib.core.threads import getCurrentThreadData
from lib.request.basic import decodePage from lib.request.basic import decodePage
from lib.request.basic import forgeHeaders from lib.request.basic import forgeHeaders
@ -502,11 +503,22 @@ class Connect:
while len(kb.responseTimes) < MIN_TIME_RESPONSES: while len(kb.responseTimes) < MIN_TIME_RESPONSES:
Connect.queryPage(content=True) Connect.queryPage(content=True)
if stdev(kb.responseTimes) > WARN_TIME_STDEV: #if stdev(kb.responseTimes) > WARN_TIME_STDEV:
warnMsg = "there are considerable lags in connection " if True:
warnMsg += "response(s). please use as high value for " warnMsg = "there is considerable lagging in connection "
warnMsg += "--time-sec option as possible (e.g. 10)" warnMsg += "response(s). "
kb.adjustTimeDelay = False
if conf.timeSec != TIME_DEFAULT_DELAY:
warnMsg += "please use as high value for --time-sec "
warnMsg += "option as possible (e.g. 10)"
logger.critical(warnMsg) logger.critical(warnMsg)
else:
conf.timeSec = 2 * TIME_DEFAULT_DELAY
warnMsg += "increasing default value for "
warnMsg += "--time-sec to %d" % conf.timeSec
logger.warn(warnMsg)
if conf.safUrl and conf.saFreq > 0: if conf.safUrl and conf.saFreq > 0:
kb.queryCounter += 1 kb.queryCounter += 1