Code cleanup

This commit is contained in:
Bernardo Damele 2011-01-18 23:05:32 +00:00
parent eda0b41859
commit 33485198e1

View File

@ -1583,9 +1583,9 @@ def wasLastRequestDelayed():
Returns True if the last web request resulted in a time-delay
"""
# 99.9999999997440% of all non time-based sql injection
# affected response times should be inside +-7*stdev([normal response times])
# (Math reference: http://www.answers.com/topic/standard-deviation)
# 99.9999999997440% of all non time-based sql injection affected
# response times should be inside +-7*stdev([normal response times])
# Math reference: http://www.answers.com/topic/standard-deviation
deviation = stdev(kb.responseTimes)
threadData = getCurrentThreadData()
@ -1607,17 +1607,20 @@ def wasLastRequestDelayed():
def adjustTimeDelay(lastQueryDuration, lowerStdLimit):
"""
Adjusts time delay in time based data retrieval
Adjusts time delay in time-based data retrieval
"""
candidate = 1 + int(round((1 - (lastQueryDuration - lowerStdLimit) / lastQueryDuration) * conf.timeSec))
if candidate:
kb.delayCandidates = [candidate] + kb.delayCandidates[:-1]
if all([x == candidate for x in kb.delayCandidates]) and candidate < conf.timeSec:
print
warnMsg = "adjusting time delay to %d second%s" % (candidate, 's' if candidate > 1 else '')
logger.warn(warnMsg)
conf.timeSec = candidate
def extractErrorMessage(page):
@ -1709,8 +1712,11 @@ def logHTTPTraffic(requestLogMsg, responseLogMsg):
kb.locks.logLock.release()
# cross-linked method
def getPageTemplate(payload, place):
"""
Cross-linked method
"""
pass
def getPublicTypeMembers(type_, onlyValues=False):
@ -2123,7 +2129,7 @@ def openFile(filename, mode='r'):
return codecs.open(filename, mode, conf.dataEncoding)
except IOError:
errMsg = "there has been a file opening error for filename '%s'. " % filename
errMsg += "Please check %s permissions on a file " % ("write" if mode and\
('w' in mode or 'a' in mode or '+' in mode) else "read")
errMsg += "Please check %s permissions on a file " % ("write" if \
mode and ('w' in mode or 'a' in mode or '+' in mode) else "read")
errMsg += "and that it's not locked by another process."
raise sqlmapFilePathException, errMsg