mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 19:13:48 +03:00
Added flush command
This commit is contained in:
parent
ff7be9d0eb
commit
c2fb2161d3
|
@ -698,12 +698,12 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
command = raw_input("api%s> " % (" (%s)" % taskid if taskid else "")).strip()
|
command = raw_input("api%s> " % (" (%s)" % taskid if taskid else "")).strip().lower()
|
||||||
except (EOFError, KeyboardInterrupt):
|
except (EOFError, KeyboardInterrupt):
|
||||||
print
|
print
|
||||||
break
|
break
|
||||||
|
|
||||||
if command.lower() in ("data", "log", "status", "stop", "kill"):
|
if command in ("data", "log", "status", "stop", "kill"):
|
||||||
if not taskid:
|
if not taskid:
|
||||||
logger.error("No task ID in use")
|
logger.error("No task ID in use")
|
||||||
continue
|
continue
|
||||||
|
@ -713,7 +713,7 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
|
||||||
logger.error("Failed to execute command " + command)
|
logger.error("Failed to execute command " + command)
|
||||||
dataToStdout("%s\n" % raw)
|
dataToStdout("%s\n" % raw)
|
||||||
|
|
||||||
elif command.lower().startswith("new"):
|
elif command.startswith("new"):
|
||||||
if ' ' not in command:
|
if ' ' not in command:
|
||||||
logger.error("Program arguments are missing")
|
logger.error("Program arguments are missing")
|
||||||
continue
|
continue
|
||||||
|
@ -745,7 +745,7 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
|
||||||
continue
|
continue
|
||||||
logger.info("Scanning started")
|
logger.info("Scanning started")
|
||||||
|
|
||||||
elif command.lower().startswith("use"):
|
elif command.startswith("use"):
|
||||||
taskid = (command.split()[1] if ' ' in command else "").strip("'\"")
|
taskid = (command.split()[1] if ' ' in command else "").strip("'\"")
|
||||||
if not taskid:
|
if not taskid:
|
||||||
logger.error("Task ID is missing")
|
logger.error("Task ID is missing")
|
||||||
|
@ -757,17 +757,17 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
|
||||||
continue
|
continue
|
||||||
logger.info("Switching to task ID '%s' " % taskid)
|
logger.info("Switching to task ID '%s' " % taskid)
|
||||||
|
|
||||||
elif command.lower() == "list":
|
elif command in ("list", "flush"):
|
||||||
raw = _client(addr + "/admin/0/list")
|
raw = _client(addr + "/admin/0/" + command)
|
||||||
res = dejsonize(raw)
|
res = dejsonize(raw)
|
||||||
if not res["success"]:
|
if not res["success"]:
|
||||||
logger.error("Failed to execute command " + command)
|
logger.error("Failed to execute command " + command)
|
||||||
dataToStdout("%s\n" % raw)
|
dataToStdout("%s\n" % raw)
|
||||||
|
|
||||||
elif command.lower() in ("exit", "bye", "quit", 'q'):
|
elif command in ("exit", "bye", "quit", 'q'):
|
||||||
return
|
return
|
||||||
|
|
||||||
elif command.lower() in ("help", "?"):
|
elif command in ("help", "?"):
|
||||||
msg = "help Show this help message\n"
|
msg = "help Show this help message\n"
|
||||||
msg += "new ARGS Start a new scan task with provided arguments (e.g. 'new -u \"http://testphp.vulnweb.com/artists.php?artist=1\"')\n"
|
msg += "new ARGS Start a new scan task with provided arguments (e.g. 'new -u \"http://testphp.vulnweb.com/artists.php?artist=1\"')\n"
|
||||||
msg += "use TASKID Switch current context to different task (e.g. 'use c04d8c5c7582efb4')\n"
|
msg += "use TASKID Switch current context to different task (e.g. 'use c04d8c5c7582efb4')\n"
|
||||||
|
@ -777,6 +777,7 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
|
||||||
msg += "stop Stop current task\n"
|
msg += "stop Stop current task\n"
|
||||||
msg += "kill Kill current task\n"
|
msg += "kill Kill current task\n"
|
||||||
msg += "list Display all tasks\n"
|
msg += "list Display all tasks\n"
|
||||||
|
msg += "flush Flush tasks (delete all tasks)\n"
|
||||||
msg += "exit Exit this client\n"
|
msg += "exit Exit this client\n"
|
||||||
|
|
||||||
dataToStdout(msg)
|
dataToStdout(msg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user