diff --git a/lib/controller/handler.py b/lib/controller/handler.py index a65f2eec2..4028b241a 100644 --- a/lib/controller/handler.py +++ b/lib/controller/handler.py @@ -7,6 +7,7 @@ See the file 'doc/COPYING' for copying permission from lib.core.common import Backend from lib.core.data import conf +from lib.core.data import kb from lib.core.data import logger from lib.core.dicts import DBMS_DICT from lib.core.enums import DBMS @@ -101,7 +102,10 @@ def setHandler(): conf.dbmsConnector.connect() if handler.checkDbms(): - conf.dbmsHandler = handler + if kb.resolutionDbms: + conf.dbmsHandler = max(_ for _ in items if _[0] == kb.resolutionDbms)[2]() + else: + conf.dbmsHandler = handler break else: conf.dbmsConnector = None diff --git a/lib/core/common.py b/lib/core/common.py index c195d2680..7adbffed0 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -319,6 +319,8 @@ class Backend: _ = readInput(msg, default=kb.dbms) if aliasToDbmsEnum(_) == kb.dbms: + kb.dbmsVersion = [] + kb.resolutionDbms = kb.dbms break elif aliasToDbmsEnum(_) == dbms: kb.dbms = aliasToDbmsEnum(_) @@ -1968,8 +1970,8 @@ def readCachedFileContent(filename, mode='rb'): if filename not in kb.cache.content: checkFile(filename) try: - with openFile(filename, mode) as f: - kb.cache.content[filename] = f.read() + with openFile(filename, mode) as f: + kb.cache.content[filename] = f.read() except (IOError, OSError, MemoryError), ex: errMsg = "something went wrong while trying " errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex)) diff --git a/lib/core/option.py b/lib/core/option.py index c164a2bd8..cb7a9b863 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1913,6 +1913,7 @@ def _setKnowledgeBaseAttributes(flushAll=True): kb.reflectiveCounters = {REFLECTIVE_COUNTER.MISS: 0, REFLECTIVE_COUNTER.HIT: 0} kb.requestCounter = 0 kb.resendPostOnRedirect = None + kb.resolutionDbms = None kb.responseTimes = {} kb.responseTimeMode = None kb.responseTimePayload = None diff --git a/lib/core/session.py b/lib/core/session.py index a5f9b976f..363d28f38 100644 --- a/lib/core/session.py +++ b/lib/core/session.py @@ -7,6 +7,7 @@ See the file 'doc/COPYING' for copying permission import re +from lib.core.common import aliasToDbmsEnum from lib.core.common import Backend from lib.core.common import Format from lib.core.common import hashDBWrite @@ -32,6 +33,9 @@ def setDbms(dbms): dbms = _.group(1) Backend.setDbms(dbms) + if kb.resolutionDbms: + hashDBWrite(HASHDB_KEYS.DBMS, kb.resolutionDbms) + logger.info("the back-end DBMS is %s" % Backend.getDbms()) def setOs(): diff --git a/lib/core/settings.py b/lib/core/settings.py index 09f5ff454..41bfba9d5 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from lib.core.revision import getRevisionNumber # sqlmap version (...) -VERSION = "1.0.5.97" +VERSION = "1.0.5.99" REVISION = getRevisionNumber() STABLE = VERSION.count('.') <= 2 VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")