This commit is contained in:
Miroslav Stampar 2021-01-12 15:58:40 +01:00
parent a697e6c307
commit c8dc375fb5
2 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
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.5.1.22" VERSION = "1.5.1.23"
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

@ -49,6 +49,7 @@ from lib.core.settings import IS_WIN
from lib.core.settings import RESTAPI_DEFAULT_ADAPTER from lib.core.settings import RESTAPI_DEFAULT_ADAPTER
from lib.core.settings import RESTAPI_DEFAULT_ADDRESS from lib.core.settings import RESTAPI_DEFAULT_ADDRESS
from lib.core.settings import RESTAPI_DEFAULT_PORT from lib.core.settings import RESTAPI_DEFAULT_PORT
from lib.core.settings import RESTAPI_UNSUPPORTED_OPTIONS
from lib.core.settings import VERSION_STRING from lib.core.settings import VERSION_STRING
from lib.core.shell import autoCompletion from lib.core.shell import autoCompletion
from lib.core.subprocessng import Popen from lib.core.subprocessng import Popen
@ -502,6 +503,11 @@ def scan_start(taskid):
logger.warning("[%s] Invalid JSON options provided to scan_start()" % taskid) logger.warning("[%s] Invalid JSON options provided to scan_start()" % taskid)
return jsonize({"success": False, "message": "Invalid JSON options"}) return jsonize({"success": False, "message": "Invalid JSON options"})
for key in request.json:
if key in RESTAPI_UNSUPPORTED_OPTIONS:
logger.warning("[%s] Unsupported option '%s' provided to scan_start()" % (taskid, key))
return jsonize({"success": False, "message": "Unsupported option '%s'" % key})
# Initialize sqlmap engine's options with user's provided options, if any # Initialize sqlmap engine's options with user's provided options, if any
for option, value in request.json.items(): for option, value in request.json.items():
DataStore.tasks[taskid].set_option(option, value) DataStore.tasks[taskid].set_option(option, value)
@ -836,7 +842,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
raw = _client("%s/task/new" % addr) raw = _client("%s/task/new" % addr)
res = dejsonize(raw) res = dejsonize(raw)
if not res["success"]: if not res["success"]:
logger.error("Failed to create new task") logger.error("Failed to create new task ('%s')" % res.get("message", ""))
continue continue
taskid = res["taskid"] taskid = res["taskid"]
logger.info("New task ID is '%s'" % taskid) logger.info("New task ID is '%s'" % taskid)
@ -844,7 +850,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
raw = _client("%s/scan/%s/start" % (addr, taskid), cmdLineOptions) raw = _client("%s/scan/%s/start" % (addr, taskid), cmdLineOptions)
res = dejsonize(raw) res = dejsonize(raw)
if not res["success"]: if not res["success"]:
logger.error("Failed to start scan") logger.error("Failed to start scan ('%s')" % res.get("message", ""))
continue continue
logger.info("Scanning started") logger.info("Scanning started")