mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-06 22:59:02 +00:00
Some more updates regarding #3140
This commit is contained in:
@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||
from lib.core.enums import OS
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.2.11.8"
|
||||
VERSION = "1.2.11.9"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
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)
|
||||
|
||||
@@ -437,25 +437,30 @@ def option_list(taskid):
|
||||
@post("/option/<taskid>/get")
|
||||
def option_get(taskid):
|
||||
"""
|
||||
Get the value of an option (command line switch) for a certain task ID
|
||||
Get value of option(s) for a certain task ID
|
||||
"""
|
||||
if taskid not in DataStore.tasks:
|
||||
logger.warning("[%s] Invalid task ID provided to option_get()" % taskid)
|
||||
return jsonize({"success": False, "message": "Invalid task ID"})
|
||||
|
||||
option = request.json.get("option", "")
|
||||
options = request.json or []
|
||||
results = {}
|
||||
|
||||
if option in DataStore.tasks[taskid].options:
|
||||
logger.debug("[%s] Retrieved value for option %s" % (taskid, option))
|
||||
return jsonize({"success": True, option: DataStore.tasks[taskid].get_option(option)})
|
||||
else:
|
||||
logger.debug("[%s] Requested value for unknown option %s" % (taskid, option))
|
||||
return jsonize({"success": False, "message": "Unknown option", option: "not set"})
|
||||
for option in options:
|
||||
if option in DataStore.tasks[taskid].options:
|
||||
results[option] = DataStore.tasks[taskid].options[option]
|
||||
else:
|
||||
logger.debug("[%s] Requested value for unknown option '%s'" % (taskid, option))
|
||||
return jsonize({"success": False, "message": "Unknown option '%s'" % option})
|
||||
|
||||
logger.debug("[%s] Retrieved values for option(s) '%s'" % (taskid, ",".join(options)))
|
||||
|
||||
return jsonize({"success": True, "options": results})
|
||||
|
||||
@post("/option/<taskid>/set")
|
||||
def option_set(taskid):
|
||||
"""
|
||||
Set an option (command line switch) for a certain task ID
|
||||
Set value of option(s) for a certain task ID
|
||||
"""
|
||||
|
||||
if taskid not in DataStore.tasks:
|
||||
@@ -775,11 +780,11 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
|
||||
logger.error("No task ID in use")
|
||||
continue
|
||||
try:
|
||||
command, option = command.split(" ")
|
||||
command, option = command.split(" ", 1)
|
||||
except ValueError:
|
||||
raw = _client("%s/option/%s/list" % (addr, taskid))
|
||||
else:
|
||||
options = {"option": option}
|
||||
options = re.split(r"\s*,\s*", option.strip())
|
||||
raw = _client("%s/option/%s/get" % (addr, taskid), options)
|
||||
res = dejsonize(raw)
|
||||
if not res["success"]:
|
||||
|
||||
Reference in New Issue
Block a user