added some more info to unhandled exception message(s)

This commit is contained in:
Miroslav Stampar 2011-01-28 16:15:45 +00:00
parent a184a4c772
commit ddd296030d
4 changed files with 22 additions and 24 deletions

View File

@ -62,13 +62,16 @@ from lib.core.settings import INFERENCE_UNKNOWN_CHAR
from lib.core.settings import DESCRIPTION from lib.core.settings import DESCRIPTION
from lib.core.settings import IS_WIN from lib.core.settings import IS_WIN
from lib.core.settings import PLATFORM 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 SITE
from lib.core.settings import ERROR_PARSING_REGEXES from lib.core.settings import ERROR_PARSING_REGEXES
from lib.core.settings import NON_CONTROL_CHAR_REGEX from lib.core.settings import NON_CONTROL_CHAR_REGEX
from lib.core.settings import SQL_STATEMENTS from lib.core.settings import SQL_STATEMENTS
from lib.core.settings import SUPPORTED_DBMS from lib.core.settings import SUPPORTED_DBMS
from lib.core.settings import UNKNOWN_DBMS_VERSION 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_NEWLINE_MARKER
from lib.core.settings import DUMP_CR_MARKER from lib.core.settings import DUMP_CR_MARKER
from lib.core.settings import DUMP_DEL_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) return struct.pack('B' if value<256 else '>H', value).decode(kb.pageEncoding)
except: except:
return INFERENCE_UNKNOWN_CHAR 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

View File

@ -7,13 +7,6 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
See the file 'doc/COPYING' for copying permission 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): class sqlmapConnectionException(Exception):
pass pass
@ -68,19 +61,6 @@ class sqlmapUnsupportedFeatureException(Exception):
class sqlmapValueException(Exception): class sqlmapValueException(Exception):
pass 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 = ( exceptionsTuple = (
sqlmapConnectionException, sqlmapConnectionException,
sqlmapDataException, sqlmapDataException,

View File

@ -25,6 +25,7 @@ from lib.core.common import pushValue
from lib.core.common import readInput from lib.core.common import readInput
from lib.core.common import replaceNewlineTabs from lib.core.common import replaceNewlineTabs
from lib.core.common import safeStringFormat from lib.core.common import safeStringFormat
from lib.core.common import unhandledExceptionMessage
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import logger 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 sqlmapConnectionException
from lib.core.exception import sqlmapValueException from lib.core.exception import sqlmapValueException
from lib.core.exception import sqlmapThreadException from lib.core.exception import sqlmapThreadException
from lib.core.exception import unhandledException
from lib.core.progress import ProgressBar from lib.core.progress import ProgressBar
from lib.core.settings import CHAR_INFERENCE_MARK from lib.core.settings import CHAR_INFERENCE_MARK
from lib.core.settings import INFERENCE_BLANK_BREAK from lib.core.settings import INFERENCE_BLANK_BREAK

View File

@ -34,10 +34,10 @@ from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
from lib.core.data import paths from lib.core.data import paths
from lib.core.common import unhandledExceptionMessage
from lib.core.exception import exceptionsTuple from lib.core.exception import exceptionsTuple
from lib.core.exception import sqlmapSilentQuitException from lib.core.exception import sqlmapSilentQuitException
from lib.core.exception import sqlmapUserQuitException from lib.core.exception import sqlmapUserQuitException
from lib.core.exception import unhandledException
from lib.core.option import init from lib.core.option import init
from lib.core.profiling import profile from lib.core.profiling import profile
from lib.core.testing import smokeTest from lib.core.testing import smokeTest
@ -109,7 +109,7 @@ def main():
except: except:
print print
errMsg = unhandledException() errMsg = unhandledExceptionMessage()
logger.critical(errMsg) logger.critical(errMsg)
traceback.print_exc() traceback.print_exc()
closeDumper(False, errMsg) closeDumper(False, errMsg)