diff --git a/lib/core/common.py b/lib/core/common.py index 95cd9240d..27987118b 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -62,13 +62,16 @@ from lib.core.settings import INFERENCE_UNKNOWN_CHAR from lib.core.settings import DESCRIPTION from lib.core.settings import IS_WIN from lib.core.settings import PLATFORM +from lib.core.settings import PYVERSION +from lib.core.settings import VERSION +from lib.core.settings import REVISION +from lib.core.settings import VERSION_STRING from lib.core.settings import SITE from lib.core.settings import ERROR_PARSING_REGEXES from lib.core.settings import NON_CONTROL_CHAR_REGEX from lib.core.settings import SQL_STATEMENTS from lib.core.settings import SUPPORTED_DBMS from lib.core.settings import UNKNOWN_DBMS_VERSION -from lib.core.settings import VERSION_STRING from lib.core.settings import DUMP_NEWLINE_MARKER from lib.core.settings import DUMP_CR_MARKER from lib.core.settings import DUMP_DEL_MARKER @@ -2273,3 +2276,18 @@ def decodeIntToUnicode(value): return struct.pack('B' if value<256 else '>H', value).decode(kb.pageEncoding) except: return INFERENCE_UNKNOWN_CHAR + +def unhandledExceptionMessage(): + errMsg = "unhandled exception in %s, retry your " % VERSION_STRING + errMsg += "run with the latest development version from the Subversion " + errMsg += "repository. If the exception persists, please send by e-mail " + errMsg += "to sqlmap-users@lists.sourceforge.net the command line, the " + errMsg += "following text and any information needed to reproduce the " + errMsg += "bug. The developers will try to reproduce the bug, fix it " + errMsg += "accordingly and get back to you.\n" + errMsg += "sqlmap version: %s%s\n" % (VERSION, " (r%d)" % REVISION if REVISION else "") + errMsg += "Python version: %s\n" % PYVERSION + errMsg += "Operating system: %s\n" % PLATFORM + errMsg += "Technique: %s\n" % (enumValueToNameLookup(PAYLOAD.TECHNIQUE, kb.technique) if kb.technique else None) + errMsg += "Back-end DBMS: %s" % kb.dbms + return errMsg diff --git a/lib/core/exception.py b/lib/core/exception.py index 83eaa8b31..93818377b 100644 --- a/lib/core/exception.py +++ b/lib/core/exception.py @@ -7,13 +7,6 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/) See the file 'doc/COPYING' for copying permission """ -from lib.core.settings import PLATFORM -from lib.core.settings import PYVERSION -from lib.core.settings import VERSION -from lib.core.settings import REVISION -from lib.core.settings import VERSION_STRING - - class sqlmapConnectionException(Exception): pass @@ -68,19 +61,6 @@ class sqlmapUnsupportedFeatureException(Exception): class sqlmapValueException(Exception): pass -def unhandledException(): - errMsg = "unhandled exception in %s, retry your " % VERSION_STRING - errMsg += "run with the latest development version from the Subversion " - errMsg += "repository. If the exception persists, please send by e-mail " - errMsg += "to sqlmap-users@lists.sourceforge.net the command line, the " - errMsg += "following text and any information needed to reproduce the " - errMsg += "bug. The developers will try to reproduce the bug, fix it " - errMsg += "accordingly and get back to you.\n" - errMsg += "sqlmap version: %s%s\n" % (VERSION, " (r%d)" % REVISION if REVISION else "") - errMsg += "Python version: %s\n" % PYVERSION - errMsg += "Operating system: %s" % PLATFORM - return errMsg - exceptionsTuple = ( sqlmapConnectionException, sqlmapDataException, diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index a448b123f..50e177039 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -25,6 +25,7 @@ from lib.core.common import pushValue from lib.core.common import readInput from lib.core.common import replaceNewlineTabs from lib.core.common import safeStringFormat +from lib.core.common import unhandledExceptionMessage from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -34,7 +35,6 @@ from lib.core.enums import PAYLOAD from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapValueException from lib.core.exception import sqlmapThreadException -from lib.core.exception import unhandledException from lib.core.progress import ProgressBar from lib.core.settings import CHAR_INFERENCE_MARK from lib.core.settings import INFERENCE_BLANK_BREAK diff --git a/sqlmap.py b/sqlmap.py index 90d297a9c..748e8f8ef 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -34,10 +34,10 @@ from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.data import paths +from lib.core.common import unhandledExceptionMessage from lib.core.exception import exceptionsTuple from lib.core.exception import sqlmapSilentQuitException from lib.core.exception import sqlmapUserQuitException -from lib.core.exception import unhandledException from lib.core.option import init from lib.core.profiling import profile from lib.core.testing import smokeTest @@ -109,7 +109,7 @@ def main(): except: print - errMsg = unhandledException() + errMsg = unhandledExceptionMessage() logger.critical(errMsg) traceback.print_exc() closeDumper(False, errMsg)