|
49 | 49 | from lib.core.settings import RESTAPI_DEFAULT_ADAPTER |
50 | 50 | from lib.core.settings import RESTAPI_DEFAULT_ADDRESS |
51 | 51 | from lib.core.settings import RESTAPI_DEFAULT_PORT |
| 52 | +from lib.core.settings import RESTAPI_UNSUPPORTED_OPTIONS |
52 | 53 | from lib.core.settings import VERSION_STRING |
53 | 54 | from lib.core.shell import autoCompletion |
54 | 55 | from lib.core.subprocessng import Popen |
@@ -502,6 +503,11 @@ def scan_start(taskid): |
502 | 503 | logger.warning("[%s] Invalid JSON options provided to scan_start()" % taskid) |
503 | 504 | return jsonize({"success": False, "message": "Invalid JSON options"}) |
504 | 505 |
|
| 506 | + for key in request.json: |
| 507 | + if key in RESTAPI_UNSUPPORTED_OPTIONS: |
| 508 | + logger.warning("[%s] Unsupported option '%s' provided to scan_start()" % (taskid, key)) |
| 509 | + return jsonize({"success": False, "message": "Unsupported option '%s'" % key}) |
| 510 | + |
505 | 511 | # Initialize sqlmap engine's options with user's provided options, if any |
506 | 512 | for option, value in request.json.items(): |
507 | 513 | DataStore.tasks[taskid].set_option(option, value) |
@@ -836,15 +842,15 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non |
836 | 842 | raw = _client("%s/task/new" % addr) |
837 | 843 | res = dejsonize(raw) |
838 | 844 | if not res["success"]: |
839 | | - logger.error("Failed to create new task") |
| 845 | + logger.error("Failed to create new task ('%s')" % res.get("message", "")) |
840 | 846 | continue |
841 | 847 | taskid = res["taskid"] |
842 | 848 | logger.info("New task ID is '%s'" % taskid) |
843 | 849 |
|
844 | 850 | raw = _client("%s/scan/%s/start" % (addr, taskid), cmdLineOptions) |
845 | 851 | res = dejsonize(raw) |
846 | 852 | if not res["success"]: |
847 | | - logger.error("Failed to start scan") |
| 853 | + logger.error("Failed to start scan ('%s')" % res.get("message", "")) |
848 | 854 | continue |
849 | 855 | logger.info("Scanning started") |
850 | 856 |
|
|
0 commit comments