Skip to content

Commit 1ce9c8a

Browse files
committed
Implementing #5506
1 parent bfe03ef commit 1ce9c8a

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.8.1.3"
23+
VERSION = "1.8.1.4"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/utils/api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ def version(token=None):
680680
logger.debug("Fetched version (%s)" % ("admin" if is_admin(token) else request.remote_addr))
681681
return jsonize({"success": True, "version": VERSION_STRING.split('/')[-1]})
682682

683-
def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=RESTAPI_DEFAULT_ADAPTER, username=None, password=None):
683+
def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=RESTAPI_DEFAULT_ADAPTER, username=None, password=None, database=None):
684684
"""
685685
REST-JSON API server
686686
"""
@@ -689,8 +689,11 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST
689689
DataStore.username = username
690690
DataStore.password = password
691691

692-
_, Database.filepath = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.IPC, text=False)
693-
os.close(_)
692+
if not database:
693+
_, Database.filepath = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.IPC, text=False)
694+
os.close(_)
695+
else:
696+
Database.filepath = database
694697

695698
if port == 0: # random
696699
with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:

sqlmapapi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ def main():
5858
apiparser.add_option("-H", "--host", help="Host of the REST-JSON API server (default \"%s\")" % RESTAPI_DEFAULT_ADDRESS, default=RESTAPI_DEFAULT_ADDRESS, action="store")
5959
apiparser.add_option("-p", "--port", help="Port of the the REST-JSON API server (default %d)" % RESTAPI_DEFAULT_PORT, default=RESTAPI_DEFAULT_PORT, type="int", action="store")
6060
apiparser.add_option("--adapter", help="Server (bottle) adapter to use (default \"%s\")" % RESTAPI_DEFAULT_ADAPTER, default=RESTAPI_DEFAULT_ADAPTER, action="store")
61+
apiparser.add_option("--database", help="Set IPC database filepath (optional)")
6162
apiparser.add_option("--username", help="Basic authentication username (optional)", action="store")
6263
apiparser.add_option("--password", help="Basic authentication password (optional)", action="store")
6364
(args, _) = apiparser.parse_args()
6465

6566
# Start the client or the server
6667
if args.server:
67-
server(args.host, args.port, adapter=args.adapter, username=args.username, password=args.password)
68+
server(args.host, args.port, adapter=args.adapter, username=args.username, password=args.password, database=args.database)
6869
elif args.client:
6970
client(args.host, args.port, username=args.username, password=args.password)
7071
else:

0 commit comments

Comments
 (0)