MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / scan_log_limited

Function scan_log_limited

lib/utils/api.py:605–628  ·  view source on GitHub ↗

Retrieve a subset of log messages

(taskid, start, end)

Source from the content-addressed store, hash-verified

603# Functions to handle scans' logs
604@get("/scan/<taskid>/log/<start>/<end>")
605def scan_log_limited(taskid, start, end):
606 """
607 Retrieve a subset of log messages
608 """
609
610 json_log_messages = list()
611
612 if taskid not in DataStore.tasks:
613 logger.warning("[%s] Invalid task ID provided to scan_log_limited()" % taskid)
614 return jsonize({"success": False, "message": "Invalid task ID"})
615
616 if not start.isdigit() or not end.isdigit() or int(end) < int(start):
617 logger.warning("[%s] Invalid start or end value provided to scan_log_limited()" % taskid)
618 return jsonize({"success": False, "message": "Invalid start or end value, must be digits"})
619
620 start = max(1, int(start))
621 end = max(1, int(end))
622
623 # Read a subset of log messages from the IPC database
624 for time_, level, message in DataStore.current_db.execute("SELECT time, level, message FROM logs WHERE taskid = ? AND id >= ? AND id <= ? ORDER BY id ASC", (taskid, start, end)):
625 json_log_messages.append({"time": time_, "level": level, "message": message})
626
627 logger.debug("(%s) Retrieved scan log messages subset" % taskid)
628 return jsonize({"success": True, "log": json_log_messages})
629
630@get("/scan/<taskid>/log")
631def scan_log(taskid):

Callers

nothing calls this directly

Calls 4

jsonizeFunction · 0.90
debugMethod · 0.80
executeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…