diff --git a/lib/core/settings.py b/lib/core/settings.py index 773dbb362..c051186da 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from thirdparty import six from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.5.9.27" +VERSION = "1.5.9.28" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/lib/core/target.py b/lib/core/target.py index b92dc815b..2c4cc0719 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -433,7 +433,7 @@ def _setHashDB(): if os.path.exists(conf.hashDBFile): if conf.flushSession: if conf.hashDB: - conf.hashDB.close() + conf.hashDB.closeAll() try: os.remove(conf.hashDBFile) diff --git a/lib/core/testing.py b/lib/core/testing.py index 05bf8d3e2..7fb4039f0 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -157,7 +157,7 @@ def vulnTest(): for tag, value in (("", url), ("", base), ("", direct), ("", tmpdir), ("", request), ("", log), ("", multiple), ("", config), ("", url.replace("id=1", "id=MZ=%3d"))): options = options.replace(tag, value) - cmd = "%s \"%s\" %s --batch --non-interactive --debug" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options) + cmd = "%s \"%s\" %s --batch --non-interactive --debug" % (sys.executable if ' ' not in sys.executable else '"%s"' % sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options) if "" in cmd: handle, tmp = tempfile.mkstemp() diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index 5fa0b26b5..7efb68571 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -33,6 +33,7 @@ class HashDB(object): self.filepath = filepath self._write_cache = {} self._cache_lock = threading.Lock() + self._connections = [] def _get_cursor(self): threadData = getCurrentThreadData() @@ -40,6 +41,7 @@ class HashDB(object): if threadData.hashDBCursor is None: try: connection = sqlite3.connect(self.filepath, timeout=3, isolation_level=None) + self._connections.append(connection) threadData.hashDBCursor = connection.cursor() threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)") connection.commit() @@ -66,6 +68,14 @@ class HashDB(object): except: pass + def closeAll(self): + for connection in self._connections: + try: + connection.commit() + connection.close() + except: + pass + @staticmethod def hashKey(key): key = getBytes(key if isinstance(key, six.text_type) else repr(key), errors="xmlcharrefreplace")