Skip to content

Commit 12eadcf

Browse files
committed
now api can only be run with sqlmapapi.py
1 parent e9ab33e commit 12eadcf

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

sqlmapapi.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
import argparse
9+
import logging
10+
11+
from _sqlmap import modulePath
12+
from lib.core.common import setPaths
13+
from lib.core.data import paths
14+
from lib.core.data import logger
15+
from lib.utils.api import client
16+
from lib.utils.api import server
17+
18+
RESTAPI_SERVER_HOST = "127.0.0.1"
19+
RESTAPI_SERVER_PORT = 8775
20+
21+
if __name__ == "__main__":
22+
"""
23+
REST-JSON API main function
24+
"""
25+
# Set default logging level to debug
26+
logger.setLevel(logging.DEBUG)
27+
28+
paths.SQLMAP_ROOT_PATH = modulePath()
29+
setPaths()
30+
31+
parser = argparse.ArgumentParser()
32+
parser.add_argument("-s", "--server", help="Act as a REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store_true")
33+
parser.add_argument("-c", "--client", help="Act as a REST-JSON API client", default=RESTAPI_SERVER_PORT, action="store_true")
34+
parser.add_argument("-H", "--host", help="Host of the REST-JSON API server", default=RESTAPI_SERVER_HOST, action="store")
35+
parser.add_argument("-p", "--port", help="Port of the the REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store")
36+
args = parser.parse_args()
37+
38+
if args.server is True:
39+
server(args.host, args.port)
40+
elif args.client is True:
41+
client(args.host, args.port)

0 commit comments

Comments
 (0)