Minor refactoring

This commit is contained in:
Miroslav Stampar 2019-08-13 14:59:10 +02:00
parent bfe8785ed5
commit 0e14647573
3 changed files with 4 additions and 7 deletions

View File

@ -1929,7 +1929,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.lastParserStatus = None kb.lastParserStatus = None
kb.locks = AttribDict() 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.locks[_] = threading.Lock()
kb.matchRatio = None kb.matchRatio = None

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.8.10" VERSION = "1.3.8.11"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -8,7 +8,6 @@ See the file 'LICENSE' for copying permission
from __future__ import division from __future__ import division
import re import re
import threading
import time import time
from extra.safe2bin.safe2bin import safecharencode from extra.safe2bin.safe2bin import safecharencode
@ -190,10 +189,8 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
else: else:
dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X")) dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X"))
hintlock = threading.Lock()
def tryHint(idx): def tryHint(idx):
with hintlock: with kb.locks.hint:
hintValue = kb.hintValue hintValue = kb.hintValue
if payload is not None and len(hintValue or "") > 0 and len(hintValue) >= idx: 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: if result:
return hintValue[idx - 1] return hintValue[idx - 1]
with hintlock: with kb.locks.hint:
kb.hintValue = "" kb.hintValue = ""
return None return None