mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 19:13:48 +03:00
code refactoring (added UNKNOWN_DBMS_VERSION instead of "Unknown")
This commit is contained in:
parent
b4450c6ddd
commit
a19cb2c13a
|
@ -60,6 +60,7 @@ from lib.core.settings import PLATFORM
|
||||||
from lib.core.settings import SITE
|
from lib.core.settings import SITE
|
||||||
from lib.core.settings import SQL_STATEMENTS
|
from lib.core.settings import SQL_STATEMENTS
|
||||||
from lib.core.settings import SUPPORTED_DBMS
|
from lib.core.settings import SUPPORTED_DBMS
|
||||||
|
from lib.core.settings import UNKNOWN_DBMS_VERSION
|
||||||
from lib.core.settings import VERSION_STRING
|
from lib.core.settings import VERSION_STRING
|
||||||
from lib.core.settings import DUMP_NEWLINE_MARKER
|
from lib.core.settings import DUMP_NEWLINE_MARKER
|
||||||
from lib.core.settings import DUMP_CR_MARKER
|
from lib.core.settings import DUMP_CR_MARKER
|
||||||
|
@ -203,7 +204,7 @@ def formatDBMSfp(versions=None):
|
||||||
while versions and None in versions:
|
while versions and None in versions:
|
||||||
versions.remove(None)
|
versions.remove(None)
|
||||||
|
|
||||||
if not versions and kb.dbmsVersion and kb.dbmsVersion[0] != "Unknown" and kb.dbmsVersion[0] != None:
|
if not versions and kb.dbmsVersion and kb.dbmsVersion[0] != UNKNOWN_DBMS_VERSION and kb.dbmsVersion[0] != None:
|
||||||
versions = kb.dbmsVersion
|
versions = kb.dbmsVersion
|
||||||
|
|
||||||
if isinstance(versions, basestring):
|
if isinstance(versions, basestring):
|
||||||
|
@ -1719,7 +1720,7 @@ def removeDynamicContent(page):
|
||||||
def isDBMSVersionAtLeast(version):
|
def isDBMSVersionAtLeast(version):
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
if kb.dbmsVersion and kb.dbmsVersion[0] != "Unknown" and kb.dbmsVersion[0] != None:
|
if kb.dbmsVersion and kb.dbmsVersion[0] != UNKNOWN_DBMS_VERSION and kb.dbmsVersion[0] != None:
|
||||||
value = kb.dbmsVersion[0].replace(" ", "")
|
value = kb.dbmsVersion[0].replace(" ", "")
|
||||||
|
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, basestring):
|
||||||
|
|
|
@ -73,6 +73,7 @@ from lib.core.settings import ACCESS_ALIASES
|
||||||
from lib.core.settings import FIREBIRD_ALIASES
|
from lib.core.settings import FIREBIRD_ALIASES
|
||||||
from lib.core.settings import MAXDB_ALIASES
|
from lib.core.settings import MAXDB_ALIASES
|
||||||
from lib.core.settings import SYBASE_ALIASES
|
from lib.core.settings import SYBASE_ALIASES
|
||||||
|
from lib.core.settings import UNKNOWN_DBMS_VERSION
|
||||||
from lib.core.update import update
|
from lib.core.update import update
|
||||||
from lib.parse.configfile import configFileParser
|
from lib.parse.configfile import configFileParser
|
||||||
from lib.parse.payloads import loadPayloads
|
from lib.parse.payloads import loadPayloads
|
||||||
|
@ -1144,7 +1145,7 @@ def __setKnowledgeBaseAttributes():
|
||||||
kb.dbmsDetected = False
|
kb.dbmsDetected = False
|
||||||
|
|
||||||
# Active (extensive) back-end DBMS fingerprint
|
# Active (extensive) back-end DBMS fingerprint
|
||||||
kb.dbmsVersion = [ "Unknown" ]
|
kb.dbmsVersion = [ UNKNOWN_DBMS_VERSION ]
|
||||||
|
|
||||||
kb.dep = None
|
kb.dep = None
|
||||||
kb.docRoot = None
|
kb.docRoot = None
|
||||||
|
|
|
@ -25,6 +25,7 @@ from lib.core.settings import MSSQL_ALIASES
|
||||||
from lib.core.settings import MYSQL_ALIASES
|
from lib.core.settings import MYSQL_ALIASES
|
||||||
from lib.core.settings import PGSQL_ALIASES
|
from lib.core.settings import PGSQL_ALIASES
|
||||||
from lib.core.settings import ORACLE_ALIASES
|
from lib.core.settings import ORACLE_ALIASES
|
||||||
|
from lib.core.settings import UNKNOWN_DBMS_VERSION
|
||||||
|
|
||||||
def safeFormatString(value):
|
def safeFormatString(value):
|
||||||
retVal = value
|
retVal = value
|
||||||
|
@ -361,7 +362,7 @@ def resumeConfKb(expression, url, value):
|
||||||
elif expression == "DBMS" and url == conf.url:
|
elif expression == "DBMS" and url == conf.url:
|
||||||
dbms = unSafeFormatString(value[:-1])
|
dbms = unSafeFormatString(value[:-1])
|
||||||
dbms = dbms.lower()
|
dbms = dbms.lower()
|
||||||
dbmsVersion = ["Unknown"]
|
dbmsVersion = [UNKNOWN_DBMS_VERSION]
|
||||||
|
|
||||||
logMsg = "resuming back-end DBMS '%s' " % dbms
|
logMsg = "resuming back-end DBMS '%s' " % dbms
|
||||||
logMsg += "from session file"
|
logMsg += "from session file"
|
||||||
|
|
|
@ -49,6 +49,8 @@ DUMP_STOP_MARKER = "__STOP__"
|
||||||
PAYLOAD_DELIMITER = "\x00"
|
PAYLOAD_DELIMITER = "\x00"
|
||||||
CHAR_INFERENCE_MARK = "%c"
|
CHAR_INFERENCE_MARK = "%c"
|
||||||
|
|
||||||
|
UNKNOWN_DBMS_VERSION = "Unknown"
|
||||||
|
|
||||||
# suffix used for naming meta databases in DBMS(es) without explicit database name
|
# suffix used for naming meta databases in DBMS(es) without explicit database name
|
||||||
METADB_SUFFIX = "_masterdb"
|
METADB_SUFFIX = "_masterdb"
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ from lib.core.data import logger
|
||||||
from lib.core.enums import DBMS
|
from lib.core.enums import DBMS
|
||||||
from lib.core.session import setDbms
|
from lib.core.session import setDbms
|
||||||
from lib.core.settings import MSSQL_ALIASES
|
from lib.core.settings import MSSQL_ALIASES
|
||||||
|
from lib.core.settings import UNKNOWN_DBMS_VERSION
|
||||||
from lib.request import inject
|
from lib.request import inject
|
||||||
from lib.request.connect import Connect as Request
|
from lib.request.connect import Connect as Request
|
||||||
|
|
||||||
|
@ -132,7 +133,7 @@ class Fingerprint(GenericFingerprint):
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
if not kb.dbmsVersion or kb.dbmsVersion == ["Unknown"]:
|
if not kb.dbmsVersion or kb.dbmsVersion == [UNKNOWN_DBMS_VERSION]:
|
||||||
for version, check in [\
|
for version, check in [\
|
||||||
("2000", "HOST_NAME()=HOST_NAME()"),\
|
("2000", "HOST_NAME()=HOST_NAME()"),\
|
||||||
("2005", "XACT_STATE()=XACT_STATE()"),\
|
("2005", "XACT_STATE()=XACT_STATE()"),\
|
||||||
|
|
|
@ -22,6 +22,7 @@ from lib.core.enums import DBMS
|
||||||
from lib.core.enums import PLACE
|
from lib.core.enums import PLACE
|
||||||
from lib.core.session import setDbms
|
from lib.core.session import setDbms
|
||||||
from lib.core.settings import MYSQL_ALIASES
|
from lib.core.settings import MYSQL_ALIASES
|
||||||
|
from lib.core.settings import UNKNOWN_DBMS_VERSION
|
||||||
from lib.request import inject
|
from lib.request import inject
|
||||||
from lib.request.connect import Connect as Request
|
from lib.request.connect import Connect as Request
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ class Fingerprint(GenericFingerprint):
|
||||||
|
|
||||||
if ((kb.dbms is not None and kb.dbms.lower() in MYSQL_ALIASES) \
|
if ((kb.dbms is not None and kb.dbms.lower() in MYSQL_ALIASES) \
|
||||||
or conf.dbms in MYSQL_ALIASES) and kb.dbmsVersion and \
|
or conf.dbms in MYSQL_ALIASES) and kb.dbmsVersion and \
|
||||||
kb.dbmsVersion[0] != "Unknown":
|
kb.dbmsVersion[0] != UNKNOWN_DBMS_VERSION:
|
||||||
kb.dbmsVersion[0] = kb.dbmsVersion[0].replace(">", "")
|
kb.dbmsVersion[0] = kb.dbmsVersion[0].replace(">", "")
|
||||||
kb.dbmsVersion[0] = kb.dbmsVersion[0].replace("=", "")
|
kb.dbmsVersion[0] = kb.dbmsVersion[0].replace("=", "")
|
||||||
kb.dbmsVersion[0] = kb.dbmsVersion[0].replace(" ", "")
|
kb.dbmsVersion[0] = kb.dbmsVersion[0].replace(" ", "")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user