Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81c1692

Browse files
committed
code refactoring some more
1 parent 40fadf2 commit 81c1692

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def heuristicCheckSqlInjection(place, parameter, value):
452452
logger.info(infoMsg)
453453
else:
454454
infoMsg += "not be injectable"
455-
logger.warning(infoMsg)
455+
logger.warn(infoMsg)
456456

457457
def checkDynParam(place, parameter, value):
458458
"""

lib/core/common.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
from lib.core.settings import DUMP_TAB_MARKER
6868
from lib.core.settings import DUMP_START_MARKER
6969
from lib.core.settings import DUMP_STOP_MARKER
70+
from lib.core.settings import MIN_TIME_RESPONSES
7071

7172
class UnicodeRawConfigParser(RawConfigParser):
7273
"""
@@ -1542,7 +1543,15 @@ def wasLastRequestDelayed():
15421543
# 99.9999999997440% of all non time-based sql injection
15431544
# affected response times should be inside +-7*stdev([normal response times])
15441545
# (Math reference: http://www.answers.com/topic/standard-deviation)
1545-
return (kb.lastQueryDuration >= average(kb.responseTimes) + 7 * stdev(kb.responseTimes))
1546+
deviation = stdev(kb.responseTimes)
1547+
if deviation:
1548+
if len(kb.responseTimes) < MIN_TIME_RESPONSES:
1549+
warnMsg = "time based standard deviation method used "
1550+
warnMsg += "on a model with less than %d response times" % MIN_TIME_RESPONSES
1551+
logger.warn(warnMsg)
1552+
return (kb.lastQueryDuration >= average(kb.responseTimes) + 7 * deviation)
1553+
else:
1554+
return kb.lastQueryDuration - conf.timeSec
15461555

15471556
def extractErrorMessage(page):
15481557
"""

plugins/dbms/sqlite/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def connect(self):
4949

5050
except (self.__sqlite.DatabaseError, self.__sqlite.OperationalError), msg:
5151
warnMsg = "unable to connect using SQLite 3 library, trying with SQLite 2"
52-
logger.warning(warnMsg)
52+
logger.warn(warnMsg)
5353

5454
try:
5555
try:

0 commit comments

Comments
 (0)