Minor update

This commit is contained in:
Miroslav Štampar 2026-07-02 10:18:58 +02:00
parent d2ead9dcda
commit 47b8b6ed07
4 changed files with 48 additions and 4 deletions

View file

@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.7.13"
VERSION = "1.10.7.14"
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)

View file

@ -253,6 +253,12 @@ def setupReportCollector():
collector = Database(":memory:")
collector.connect("report")
collector.init()
# record error/critical log messages into the collector so that a CLI --report-json report carries
# the same 'error' content the REST API exposes via /scan/<id>/data - letting consumers tell a
# failed/unreachable run apart from a clean "nothing found" one (both otherwise have empty 'data')
logger.addHandler(ReportErrorRecorder(collector))
return collector
def writeReportJson(collector, filepath):
@ -449,6 +455,22 @@ class LogRecorder(logging.StreamHandler):
"""
conf.databaseCursor.execute("INSERT INTO logs VALUES(NULL, ?, ?, ?, ?)", (conf.taskid, time.strftime("%X"), record.levelname, str(record.msg % record.args if record.args else record.msg)))
class ReportErrorRecorder(logging.Handler):
def __init__(self, collector):
"""
Records error/critical log messages into a report collector's 'errors' table (the counterpart
of StdDbOut's stderr branch for CLI --report-json runs)
"""
logging.Handler.__init__(self)
self.setLevel(logging.ERROR)
self.collector = collector
def emit(self, record):
try:
self.collector.execute("INSERT INTO errors VALUES(NULL, ?, ?)", (REPORT_TASKID, str(record.msg % record.args if record.args else record.msg)))
except Exception:
pass
def setRestAPILog():
if conf.api:
try: