Launch a scan
(taskid)
| 497 | # Handle scans |
| 498 | @post("/scan/<taskid>/start") |
| 499 | def scan_start(taskid): |
| 500 | """ |
| 501 | Launch a scan |
| 502 | """ |
| 503 | |
| 504 | if taskid not in DataStore.tasks: |
| 505 | logger.warning("[%s] Invalid task ID provided to scan_start()" % taskid) |
| 506 | return jsonize({"success": False, "message": "Invalid task ID"}) |
| 507 | |
| 508 | if request.json is None: |
| 509 | logger.warning("[%s] Invalid JSON options provided to scan_start()" % taskid) |
| 510 | return jsonize({"success": False, "message": "Invalid JSON options"}) |
| 511 | |
| 512 | for key in request.json: |
| 513 | if key in RESTAPI_UNSUPPORTED_OPTIONS: |
| 514 | logger.warning("[%s] Unsupported option '%s' provided to scan_start()" % (taskid, key)) |
| 515 | return jsonize({"success": False, "message": "Unsupported option '%s'" % key}) |
| 516 | |
| 517 | # Initialize sqlmap engine's options with user's provided options, if any |
| 518 | for option, value in request.json.items(): |
| 519 | DataStore.tasks[taskid].set_option(option, value) |
| 520 | |
| 521 | # Launch sqlmap engine in a separate process |
| 522 | DataStore.tasks[taskid].engine_start() |
| 523 | |
| 524 | logger.debug("(%s) Started scan" % taskid) |
| 525 | return jsonize({"success": True, "engineid": DataStore.tasks[taskid].engine_get_id()}) |
| 526 | |
| 527 | @get("/scan/<taskid>/stop") |
| 528 | def scan_stop(taskid): |
nothing calls this directly
no test coverage detected
searching dependent graphs…