Minor code refactoring

This commit is contained in:
Bernardo Damele 2011-01-17 21:13:59 +00:00
parent 041abb56e2
commit 47565f9459
5 changed files with 8 additions and 9 deletions

View File

@ -381,7 +381,7 @@ def checkSqlInjection(place, parameter, value):
# Set fingerprinted DBMS according to the
# current test settings for proper unescaping
kb.misc.fpDbms = dbms
kb.misc.forcedDbms = dbms
if not getIdentifiedDBMS():
warnMsg = "using unescaped version of the test "
@ -402,7 +402,7 @@ def checkSqlInjection(place, parameter, value):
# by unionTest() directly
where = vector[6]
kb.misc.fpDbms = None
kb.misc.forcedDbms = None
# If the injection test was successful feed the injection
# object with the test's details

View File

@ -101,6 +101,5 @@ def setHandler():
else:
conf.dbmsConnector = None
# At this point proper back-end DBMS will be identified (kb.dbms)
# so we have to force DBMS
kb.misc.fpDbms = None
# At this point proper back-end DBMS is fingerprinted (kb.dbms)
kb.misc.forcedDbms = None

View File

@ -2077,8 +2077,8 @@ def getErrorParsedDBMSes():
def getIdentifiedDBMS():
dbms = None
if kb.misc.fpDbms is not None:
dbms = kb.misc.fpDbms
if kb.misc.forcedDbms is not None:
dbms = kb.misc.forcedDbms
elif kb.dbms is not None:
dbms = kb.dbms
elif conf.dbms is not None:

View File

@ -1171,7 +1171,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
kb.misc.start = ":%s:" % randomStr(length=3, lowercase=True)
kb.misc.stop = ":%s:" % randomStr(length=3, lowercase=True)
kb.misc.space = ":%s:" % randomStr(length=1, lowercase=True)
kb.misc.fpDbms = None
kb.misc.forcedDbms = None
if flushAll:
kb.keywords = set(getFileItems(paths.SQL_KEYWORDS))

View File

@ -18,7 +18,7 @@ class Fingerprint:
"""
def __init__(self, dbms):
kb.misc.fpDbms = dbms
kb.misc.forcedDbms = dbms
def getFingerprint(self):
errMsg = "'getFingerprint' method must be defined "