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

View File

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

View File

@ -2077,8 +2077,8 @@ def getErrorParsedDBMSes():
def getIdentifiedDBMS(): def getIdentifiedDBMS():
dbms = None dbms = None
if kb.misc.fpDbms is not None: if kb.misc.forcedDbms is not None:
dbms = kb.misc.fpDbms dbms = kb.misc.forcedDbms
elif kb.dbms is not None: elif kb.dbms is not None:
dbms = kb.dbms dbms = kb.dbms
elif conf.dbms is not None: 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.start = ":%s:" % randomStr(length=3, lowercase=True)
kb.misc.stop = ":%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.space = ":%s:" % randomStr(length=1, lowercase=True)
kb.misc.fpDbms = None kb.misc.forcedDbms = None
if flushAll: if flushAll:
kb.keywords = set(getFileItems(paths.SQL_KEYWORDS)) kb.keywords = set(getFileItems(paths.SQL_KEYWORDS))

View File

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