From f542e828d2c2e96e294fd14a85e33f8c300e1f54 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 20 Jan 2017 13:11:12 +0100 Subject: [PATCH] Fixes #2364 --- lib/core/settings.py | 2 +- lib/utils/api.py | 6 ++++++ txt/checksum.md5 | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 4d1c8c0c2..c28b9ec0a 100755 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.1.1.13" +VERSION = "1.1.1.14" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/lib/utils/api.py b/lib/utils/api.py index 5e2de8d68..02ac75d32 100644 --- a/lib/utils/api.py +++ b/lib/utils/api.py @@ -6,6 +6,7 @@ Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ +import contextlib import logging import os import re @@ -648,6 +649,11 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST DataStore.admin_id = hexencode(os.urandom(16)) Database.filepath = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.IPC, text=False)[1] + if port == 0: # random + with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: + s.bind((host, 0)) + port = s.getsockname()[1] + logger.info("Running REST-JSON API server at '%s:%d'.." % (host, port)) logger.info("Admin ID: %s" % DataStore.admin_id) logger.debug("IPC database: %s" % Database.filepath) diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 75bf65b7d..5dfea895d 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -45,7 +45,7 @@ e544108e2238d756c94a240e8a1ce061 lib/core/optiondict.py d8e9250f3775119df07e9070eddccd16 lib/core/replication.py 785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py 40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py -172de5efdd8ec5d63e409af708f06b22 lib/core/settings.py +2ce52e30cd8111887675e4b847b0a076 lib/core/settings.py d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py 2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py afd0636d2e93c23f4f0a5c9b6023ea17 lib/core/target.py @@ -99,7 +99,7 @@ d3da4c7ceaf57c4687a052d58722f6bb lib/techniques/dns/use.py 310efc965c862cfbd7b0da5150a5ad36 lib/techniques/union/__init__.py 4bed3ed51faad9b910899cacf56e8eac lib/techniques/union/test.py 8cd5655c60a638caa30ca1220896aeda lib/techniques/union/use.py -9cf3d94f692ce036459b9aa13968cf65 lib/utils/api.py +2503710e4b6316e40ddde872d5bbd04a lib/utils/api.py 6842092e1d27b71d28acd0e421f90693 lib/utils/crawler.py ba12c69a90061aa14d848b8396e79191 lib/utils/deps.py 3b9fd519164e0bf275d5fd361c3f11ff lib/utils/getch.py