forked from sqlmapproject/sqlmap
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlmapapi.py
More file actions
Latest commit
executable file
·46 lines (38 loc) · 1.5 KB
/
Copy pathsqlmapapi.py
File metadata and controls
executable file
·46 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
importlogging
importoptparse
fromsqlmapimportmodulePath
fromlib.core.commonimportsetPaths
fromlib.core.dataimportpaths
fromlib.core.dataimportlogger
fromlib.utils.apiimportclient
fromlib.utils.apiimportserver
RESTAPI_SERVER_HOST="127.0.0.1"
RESTAPI_SERVER_PORT=8775
if__name__=="__main__":
"""
REST-JSON API main function
"""
# Set default logging level to debug
logger.setLevel(logging.DEBUG)
# Initialize path variable
paths.SQLMAP_ROOT_PATH=modulePath()
setPaths()
# Parse command line options
apiparser=optparse.OptionParser()
apiparser.add_option("-s", "--server", help="Act as a REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store_true")
apiparser.add_option("-c", "--client", help="Act as a REST-JSON API client", default=RESTAPI_SERVER_PORT, action="store_true")
apiparser.add_option("-H", "--host", help="Host of the REST-JSON API server", default=RESTAPI_SERVER_HOST, action="store")
apiparser.add_option("-p", "--port", help="Port of the the REST-JSON API server", default=RESTAPI_SERVER_PORT, type="int", action="store")
(args, _) =apiparser.parse_args()
# Start the client or the server
ifargs.serverisTrue:
server(args.host, args.port)
elifargs.clientisTrue:
client(args.host, args.port)
else:
apiparser.print_help()