From d4a061d0c3eabb37481fca088a2a55dfc1239748 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Sat, 15 Dec 2012 00:29:35 +0000 Subject: [PATCH] code cleanup - #297 --- lib/utils/restapi.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/utils/restapi.py b/lib/utils/restapi.py index b1e6d52a5..bf4b807bb 100644 --- a/lib/utils/restapi.py +++ b/lib/utils/restapi.py @@ -224,7 +224,7 @@ def option_set(taskid): # Function to handle scans @post("/scan//start") -def scan(taskid): +def scan_start(taskid): """ Launch a scan """ @@ -337,6 +337,9 @@ def restAPIRun(host="0.0.0.0", port=RESTAPI_SERVER_PORT): run(host=host, port=port, quiet=False, debug=False) def client(host, port): + """ + REST-JSON API client + """ addr = "http://%s:%d" % (host, port) print "[*] starting debug REST-JSON client to '%s'..." % addr @@ -344,13 +347,13 @@ def client(host, port): print "[!] not yet implemented, use curl from command line instead for now, for example:" print "\n\t$ curl --proxy http://127.0.0.1:8080 http://127.0.0.1:%s/task/new" % port print "\t$ curl --proxy http://127.0.0.1:8080 -H \"Content-Type: application/json\" -X POST -d '{\"url\": \"http://testphp.vulnweb.com/artists.php?artist=1\"}' http://127.0.0.1:%d/scan//start" % port - print "\t$ curl --proxy http://127.0.0.1:8080 http://127.0.0.1:8775/scan//output\n" + print "\t$ curl --proxy http://127.0.0.1:8080 http://127.0.0.1:8775/scan//output" + print "\t$ curl --proxy http://127.0.0.1:8080 http://127.0.0.1:8775/scan//log\n" if __name__ == "__main__": """ - Standalone REST-JSON API wrapper function + REST-JSON API wrapper function """ - parser = optparse.OptionParser() parser.add_option("-s", "--server", help="Act as a REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store_true") parser.add_option("-c", "--client", help="Act as a REST-JSON API client", default=RESTAPI_SERVER_PORT, action="store_true")