mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-03 05:09:15 +00:00
Better exception messages (including types)
This commit is contained in:
@@ -84,6 +84,7 @@ from lib.core.enums import PLACE
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.enums import REFLECTIVE_COUNTER
|
||||
from lib.core.enums import SORT_ORDER
|
||||
from lib.core.exception import SqlmapBaseException
|
||||
from lib.core.exception import SqlmapDataException
|
||||
from lib.core.exception import SqlmapGenericException
|
||||
from lib.core.exception import SqlmapNoneDataException
|
||||
@@ -4784,6 +4785,8 @@ def getSafeExString(ex, encoding=None):
|
||||
u'foobar'
|
||||
"""
|
||||
|
||||
retVal = None
|
||||
|
||||
if getattr(ex, "message", None):
|
||||
retVal = ex.message
|
||||
elif getattr(ex, "msg", None):
|
||||
@@ -4792,8 +4795,11 @@ def getSafeExString(ex, encoding=None):
|
||||
retVal = ex[1]
|
||||
elif isinstance(ex, (list, tuple)) and len(ex) > 0 and isinstance(ex[0], basestring):
|
||||
retVal = ex[0]
|
||||
else:
|
||||
|
||||
if retVal is None:
|
||||
retVal = str(ex)
|
||||
elif not isinstance(ex, SqlmapBaseException):
|
||||
retVal = "%s: %s" % (type(ex).__name__, retVal)
|
||||
|
||||
return getUnicode(retVal or "", encoding=encoding).strip()
|
||||
|
||||
|
||||
@@ -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.2.18"
|
||||
VERSION = "1.3.2.19"
|
||||
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)
|
||||
|
||||
@@ -18,6 +18,7 @@ from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.datatype import AttribDict
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import SqlmapBaseException
|
||||
from lib.core.exception import SqlmapConnectionException
|
||||
from lib.core.exception import SqlmapThreadException
|
||||
from lib.core.exception import SqlmapUserQuitException
|
||||
@@ -95,7 +96,8 @@ def exceptionHandledFunction(threadFunction, silent=False):
|
||||
raise
|
||||
except Exception as ex:
|
||||
if not silent and kb.get("threadContinue"):
|
||||
logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message))
|
||||
errMsg = ex.message if isinstance(ex, SqlmapBaseException) else "%s: %s" % (type(ex).__name__, ex.message)
|
||||
logger.error("thread %s: '%s'" % (threading.currentThread().getName(), errMsg))
|
||||
|
||||
if conf.get("verbose") > 1:
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in New Issue
Block a user