mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-15 12:19:03 +00:00
Fixing unhandled exception message and removing sticky level logic
This commit is contained in:
@@ -872,9 +872,9 @@ def boldifyMessage(message):
|
||||
|
||||
return retVal
|
||||
|
||||
def setColor(message, color=None, bold=False):
|
||||
def setColor(message, color=None, bold=False, level=None):
|
||||
retVal = message
|
||||
level = extractRegexResult(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message) or kb.get("stickyLevel")
|
||||
level = level or extractRegexResult(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message)
|
||||
|
||||
if isinstance(level, unicode):
|
||||
level = unicodeencode(level)
|
||||
@@ -884,11 +884,7 @@ def setColor(message, color=None, bold=False):
|
||||
retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None)
|
||||
elif level:
|
||||
level = getattr(logging, level, None) if isinstance(level, basestring) else level
|
||||
if message != '.':
|
||||
retVal = LOGGER_HANDLER.colorize(message, level)
|
||||
kb.stickyLevel = level if message and message[-1] != "\n" else None
|
||||
else:
|
||||
kb.stickyLevel = None
|
||||
retVal = LOGGER_HANDLER.colorize(message, level)
|
||||
|
||||
return retVal
|
||||
|
||||
@@ -999,7 +995,6 @@ def readInput(message, default=None, checkBatch=True, boolean=False):
|
||||
"""
|
||||
|
||||
retVal = None
|
||||
kb.stickyLevel = None
|
||||
|
||||
message = getUnicode(message)
|
||||
|
||||
@@ -2039,7 +2034,6 @@ def clearConsoleLine(forceOutput=False):
|
||||
dataToStdout("\r%s\r" % (" " * (getConsoleWidth() - 1)), forceOutput)
|
||||
|
||||
kb.prependFlag = False
|
||||
kb.stickyLevel = None
|
||||
|
||||
def parseXmlFile(xmlFile, handler):
|
||||
"""
|
||||
@@ -3358,8 +3352,7 @@ def unhandledExceptionMessage():
|
||||
errMsg += "repository at '%s'. If the exception persists, please open a new issue " % GIT_PAGE
|
||||
errMsg += "at '%s' " % ISSUES_PAGE
|
||||
errMsg += "with the following text and any other information required to "
|
||||
errMsg += "reproduce the bug. The "
|
||||
errMsg += "developers will try to reproduce the bug, fix it accordingly "
|
||||
errMsg += "reproduce the bug. Developers will try to reproduce the bug, fix it accordingly "
|
||||
errMsg += "and get back to you\n"
|
||||
errMsg += "Running version: %s\n" % VERSION_STRING[VERSION_STRING.find('/') + 1:]
|
||||
errMsg += "Python version: %s\n" % PYVERSION
|
||||
@@ -3495,7 +3488,7 @@ def maskSensitiveData(msg):
|
||||
retVal = retVal.replace(match.group(3), '*' * len(match.group(3)))
|
||||
|
||||
# Fail-safe substitution
|
||||
retVal = re.sub(r"(?i)\bhttps?://[^ ]+", lambda match: '*' * len(match.group(0)), retVal)
|
||||
retVal = re.sub(r"(?i)(Command line:.+)\b(https?://[^ ]+)", lambda match: "%s%s" % (match.group(1), '*' * len(match.group(2))), retVal)
|
||||
|
||||
if getpass.getuser():
|
||||
retVal = re.sub(r"(?i)\b%s\b" % re.escape(getpass.getuser()), '*' * len(getpass.getuser()), retVal)
|
||||
|
||||
@@ -112,8 +112,6 @@ class Dump(object):
|
||||
self._write(data, content_type=content_type)
|
||||
|
||||
def string(self, header, data, content_type=None, sort=True):
|
||||
kb.stickyLevel = None
|
||||
|
||||
if conf.api:
|
||||
self._write(data, content_type=content_type)
|
||||
return
|
||||
|
||||
@@ -1881,7 +1881,6 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.reduceTests = None
|
||||
kb.tlsSNI = {}
|
||||
kb.stickyDBMS = False
|
||||
kb.stickyLevel = None
|
||||
kb.storeCrawlingChoice = None
|
||||
kb.storeHashesChoice = None
|
||||
kb.suppressResumeInfo = False
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||
from lib.core.enums import OS
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.3.1.81"
|
||||
VERSION = "1.3.1.82"
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user