From 9ac251142cce92334796634391f50aa74851a750 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 1 Oct 2021 09:11:57 +0200 Subject: [PATCH] Minor refactoring --- lib/core/settings.py | 2 +- lib/core/testing.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 4d887ebde..87556d20c 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from thirdparty import six from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.5.10.1" +VERSION = "1.5.10.2" 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/core/testing.py b/lib/core/testing.py index 573263254..f950820e6 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -31,7 +31,6 @@ from lib.core.data import logger from lib.core.data import paths from lib.core.data import queries from lib.core.patch import unisonRandom -from lib.core.settings import MAX_CONSECUTIVE_CONNECTION_ERRORS from lib.core.settings import IS_WIN def vulnTest(): @@ -97,28 +96,27 @@ def vulnTest(): vulnserver.init(quiet=True) vulnserver.run(address=address, port=port) + vulnserver._alive = True + thread = threading.Thread(target=_thread) thread.daemon = True thread.start() - success = False - for i in xrange(MAX_CONSECUTIVE_CONNECTION_ERRORS): + while vulnserver._alive: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((address, port)) s.send(b"GET / HTTP/1.0\r\n\r\n") if b"vulnserver" in s.recv(4096): - success = True break except: pass finally: s.close() - if not success: - time.sleep(1) + time.sleep(1) - if not success: - logger.error("problem occurred in vulnserver instantiation (address: 'http://%s:%s', alive: %s)" % (address, port, vulnserver._alive)) + if not vulnserver._alive: + logger.error("problem occurred in vulnserver instantiation (address: 'http://%s:%s')" % (address, port)) return False else: logger.info("vulnserver running at 'http://%s:%s'..." % (address, port))