mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
Minor stability patch for multi-threading console output (#3284)
This commit is contained in:
@@ -913,7 +913,8 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
|
||||
|
||||
if not kb.get("threadException"):
|
||||
if forceOutput or not (getCurrentThreadData().disableStdOut or kb.get("wizardMode")):
|
||||
if kb.get("multiThreadMode"):
|
||||
multiThreadMode = isMultiThreadMode()
|
||||
if multiThreadMode:
|
||||
logging._acquireLock()
|
||||
|
||||
if isinstance(data, unicode):
|
||||
@@ -931,7 +932,7 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
if kb.get("multiThreadMode"):
|
||||
if multiThreadMode:
|
||||
logging._releaseLock()
|
||||
|
||||
kb.prependFlag = isinstance(data, basestring) and (len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n')
|
||||
@@ -1982,6 +1983,13 @@ def isHexEncodedString(subject):
|
||||
|
||||
return re.match(r"\A[0-9a-fA-Fx]+\Z", subject) is not None
|
||||
|
||||
def isMultiThreadMode():
|
||||
"""
|
||||
Checks if running in multi-thread(ing) mode
|
||||
"""
|
||||
|
||||
return threading.activeCount() > 1
|
||||
|
||||
@cachedmethod
|
||||
def getConsoleWidth(default=80):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user