From 0e1464757356fb71d5a1e801b70da67de2174b82 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 13 Aug 2019 14:59:10 +0200 Subject: [PATCH] Minor refactoring --- lib/core/option.py | 2 +- lib/core/settings.py | 2 +- lib/techniques/blind/inference.py | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 982653a1b..59e143c8f 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1929,7 +1929,7 @@ def _setKnowledgeBaseAttributes(flushAll=True): kb.lastParserStatus = None kb.locks = AttribDict() - for _ in ("cache", "connError", "count", "handlers", "index", "io", "limit", "log", "socket", "redirect", "request", "value"): + for _ in ("cache", "connError", "count", "handlers", "hint", "index", "io", "limit", "log", "socket", "redirect", "request", "value"): kb.locks[_] = threading.Lock() kb.matchRatio = None diff --git a/lib/core/settings.py b/lib/core/settings.py index 83c16d0c2..6bf7a0c84 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.3.8.10" +VERSION = "1.3.8.11" 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/techniques/blind/inference.py b/lib/techniques/blind/inference.py index 2f2ebf455..85dc3629a 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -8,7 +8,6 @@ See the file 'LICENSE' for copying permission from __future__ import division import re -import threading import time from extra.safe2bin.safe2bin import safecharencode @@ -190,10 +189,8 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None else: dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X")) - hintlock = threading.Lock() - def tryHint(idx): - with hintlock: + with kb.locks.hint: hintValue = kb.hintValue if payload is not None and len(hintValue or "") > 0 and len(hintValue) >= idx: @@ -212,7 +209,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None if result: return hintValue[idx - 1] - with hintlock: + with kb.locks.hint: kb.hintValue = "" return None