This commit is contained in:
Miroslav Stampar 2022-12-17 14:46:00 +01:00
parent a11f79e16f
commit b7411211af
2 changed files with 16 additions and 11 deletions

View File

@ -20,7 +20,7 @@ from thirdparty import six
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.6.12.5" VERSION = "1.6.12.6"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -17,6 +17,7 @@ import socket
import sqlite3 import sqlite3
import sys import sys
import tempfile import tempfile
import threading
import time import time
from lib.core.common import dataToStdout from lib.core.common import dataToStdout
@ -88,6 +89,7 @@ class Database(object):
def connect(self, who="server"): def connect(self, who="server"):
self.connection = sqlite3.connect(self.database, timeout=3, isolation_level=None, check_same_thread=False) self.connection = sqlite3.connect(self.database, timeout=3, isolation_level=None, check_same_thread=False)
self.cursor = self.connection.cursor() self.cursor = self.connection.cursor()
self.lock = threading.Lock()
logger.debug("REST-JSON API %s connected to IPC database" % who) logger.debug("REST-JSON API %s connected to IPC database" % who)
def disconnect(self): def disconnect(self):
@ -101,17 +103,20 @@ class Database(object):
self.connection.commit() self.connection.commit()
def execute(self, statement, arguments=None): def execute(self, statement, arguments=None):
while True: with self.lock:
try: while True:
if arguments: try:
self.cursor.execute(statement, arguments) if arguments:
self.cursor.execute(statement, arguments)
else:
self.cursor.execute(statement)
except sqlite3.OperationalError as ex:
if "locked" not in getSafeExString(ex):
raise
else:
time.sleep(1)
else: else:
self.cursor.execute(statement) break
except sqlite3.OperationalError as ex:
if "locked" not in getSafeExString(ex):
raise
else:
break
if statement.lstrip().upper().startswith("SELECT"): if statement.lstrip().upper().startswith("SELECT"):
return self.cursor.fetchall() return self.cursor.fetchall()