Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b06a34a

Browse files
committed
Another update for #1402
1 parent 2453b02 commit b06a34a

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

lib/utils/api.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -647,16 +647,17 @@ def server(host="0.0.0.0", port=RESTAPI_SERVER_PORT):
647647
run(host=host, port=port, quiet=True, debug=False)
648648

649649

650-
def _client(url, data=None):
650+
def _client(url, options=None):
651651
logger.debug("Calling " + url)
652652
try:
653-
if data is not None:
654-
data = jsonize(data)
653+
data = None
654+
if options is not None:
655+
data = jsonize(options)
655656
req = urllib2.Request(url, data, {'Content-Type': 'application/json'})
656657
response = urllib2.urlopen(req)
657658
text = response.read()
658659
except:
659-
if data:
660+
if options:
660661
logger.error("Failed to load and parse " + url)
661662
raise
662663
return text
@@ -707,12 +708,12 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
707708
argv = ["sqlmap.py"] + shlex.split(command)[1:]
708709

709710
try:
710-
d = cmdLineParser(argv).__dict__
711+
cmdLineOptions = cmdLineParser(argv).__dict__
711712
except:
712713
taskid = None
713714
continue
714715

715-
d = { k: v for k, v in d.iteritems() if v is not None }
716+
cmdLineOptions = { k: v for k, v in cmdLineOptions.iteritems() if v is not None }
716717

717718
raw = _client(addr + "/task/new")
718719
res = dejsonize(raw)
@@ -722,7 +723,7 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
722723
taskid = res["taskid"]
723724
logger.info("New task ID is '%s'" % taskid)
724725

725-
raw = _client(addr + "/scan/" + taskid + "/start", d)
726+
raw = _client(addr + "/scan/" + taskid + "/start", cmdLineOptions)
726727
res = dejsonize(raw)
727728
if not res["success"]:
728729
logger.error("Failed to start scan")

0 commit comments

Comments
 (0)