Skip to content

Commit aeaa776

Browse files
committed
PyPy patch for testing module
1 parent 08eeb0f commit aeaa776

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.5.9.27"
23+
VERSION = "1.5.9.28"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/core/target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _setHashDB():
433433
if os.path.exists(conf.hashDBFile):
434434
if conf.flushSession:
435435
if conf.hashDB:
436-
conf.hashDB.close()
436+
conf.hashDB.closeAll()
437437

438438
try:
439439
os.remove(conf.hashDBFile)

lib/core/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _thread():
157157
for tag, value in (("<url>", url), ("<base>", base), ("<direct>", direct), ("<tmpdir>", tmpdir), ("<request>", request), ("<log>", log), ("<multiple>", multiple), ("<config>", config), ("<base64>", url.replace("id=1", "id=MZ=%3d"))):
158158
options = options.replace(tag, value)
159159

160-
cmd = "%s \"%s\" %s --batch --non-interactive --debug" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options)
160+
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)
161161

162162
if "<tmpfile>" in cmd:
163163
handle, tmp = tempfile.mkstemp()

lib/utils/hashdb.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ def __init__(self, filepath):
3333
self.filepath = filepath
3434
self._write_cache = {}
3535
self._cache_lock = threading.Lock()
36+
self._connections = []
3637

3738
def _get_cursor(self):
3839
threadData = getCurrentThreadData()
3940

4041
if threadData.hashDBCursor is None:
4142
try:
4243
connection = sqlite3.connect(self.filepath, timeout=3, isolation_level=None)
44+
self._connections.append(connection)
4345
threadData.hashDBCursor = connection.cursor()
4446
threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)")
4547
connection.commit()
@@ -66,6 +68,14 @@ def close(self):
6668
except:
6769
pass
6870

71+
def closeAll(self):
72+
for connection in self._connections:
73+
try:
74+
connection.commit()
75+
connection.close()
76+
except:
77+
pass
78+
6979
@staticmethod
7080
def hashKey(key):
7181
key = getBytes(key if isinstance(key, six.text_type) else repr(key), errors="xmlcharrefreplace")

0 commit comments

Comments
 (0)