Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ddd2960

Browse files
committed
added some more info to unhandled exception message(s)
1 parent a184a4c commit ddd2960

4 files changed

Lines changed: 22 additions & 24 deletions

File tree

lib/core/common.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,16 @@
6262
from lib.core.settings import DESCRIPTION
6363
from lib.core.settings import IS_WIN
6464
from lib.core.settings import PLATFORM
65+
from lib.core.settings import PYVERSION
66+
from lib.core.settings import VERSION
67+
from lib.core.settings import REVISION
68+
from lib.core.settings import VERSION_STRING
6569
from lib.core.settings import SITE
6670
from lib.core.settings import ERROR_PARSING_REGEXES
6771
from lib.core.settings import NON_CONTROL_CHAR_REGEX
6872
from lib.core.settings import SQL_STATEMENTS
6973
from lib.core.settings import SUPPORTED_DBMS
7074
from lib.core.settings import UNKNOWN_DBMS_VERSION
71-
from lib.core.settings import VERSION_STRING
7275
from lib.core.settings import DUMP_NEWLINE_MARKER
7376
from lib.core.settings import DUMP_CR_MARKER
7477
from lib.core.settings import DUMP_DEL_MARKER
@@ -2273,3 +2276,18 @@ def decodeIntToUnicode(value):
22732276
return struct.pack('B' if value<256 else '>H', value).decode(kb.pageEncoding)
22742277
except:
22752278
return INFERENCE_UNKNOWN_CHAR
2279+
2280+
def unhandledExceptionMessage():
2281+
errMsg = "unhandled exception in %s, retry your " % VERSION_STRING
2282+
errMsg += "run with the latest development version from the Subversion "
2283+
errMsg += "repository. If the exception persists, please send by e-mail "
2284+
errMsg += "to [email protected] the command line, the "
2285+
errMsg += "following text and any information needed to reproduce the "
2286+
errMsg += "bug. The developers will try to reproduce the bug, fix it "
2287+
errMsg += "accordingly and get back to you.\n"
2288+
errMsg += "sqlmap version: %s%s\n" % (VERSION, " (r%d)" % REVISION if REVISION else "")
2289+
errMsg += "Python version: %s\n" % PYVERSION
2290+
errMsg += "Operating system: %s\n" % PLATFORM
2291+
errMsg += "Technique: %s\n" % (enumValueToNameLookup(PAYLOAD.TECHNIQUE, kb.technique) if kb.technique else None)
2292+
errMsg += "Back-end DBMS: %s" % kb.dbms
2293+
return errMsg

lib/core/exception.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
See the file 'doc/COPYING' for copying permission
88
"""
99

10-
from lib.core.settings import PLATFORM
11-
from lib.core.settings import PYVERSION
12-
from lib.core.settings import VERSION
13-
from lib.core.settings import REVISION
14-
from lib.core.settings import VERSION_STRING
15-
16-
1710
class sqlmapConnectionException(Exception):
1811
pass
1912

@@ -68,19 +61,6 @@ class sqlmapUnsupportedFeatureException(Exception):
6861
class sqlmapValueException(Exception):
6962
pass
7063

71-
def unhandledException():
72-
errMsg = "unhandled exception in %s, retry your " % VERSION_STRING
73-
errMsg += "run with the latest development version from the Subversion "
74-
errMsg += "repository. If the exception persists, please send by e-mail "
75-
errMsg += "to [email protected] the command line, the "
76-
errMsg += "following text and any information needed to reproduce the "
77-
errMsg += "bug. The developers will try to reproduce the bug, fix it "
78-
errMsg += "accordingly and get back to you.\n"
79-
errMsg += "sqlmap version: %s%s\n" % (VERSION, " (r%d)" % REVISION if REVISION else "")
80-
errMsg += "Python version: %s\n" % PYVERSION
81-
errMsg += "Operating system: %s" % PLATFORM
82-
return errMsg
83-
8464
exceptionsTuple = (
8565
sqlmapConnectionException,
8666
sqlmapDataException,

lib/techniques/blind/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from lib.core.common import readInput
2626
from lib.core.common import replaceNewlineTabs
2727
from lib.core.common import safeStringFormat
28+
from lib.core.common import unhandledExceptionMessage
2829
from lib.core.data import conf
2930
from lib.core.data import kb
3031
from lib.core.data import logger
@@ -34,7 +35,6 @@
3435
from lib.core.exception import sqlmapConnectionException
3536
from lib.core.exception import sqlmapValueException
3637
from lib.core.exception import sqlmapThreadException
37-
from lib.core.exception import unhandledException
3838
from lib.core.progress import ProgressBar
3939
from lib.core.settings import CHAR_INFERENCE_MARK
4040
from lib.core.settings import INFERENCE_BLANK_BREAK

sqlmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
from lib.core.data import kb
3535
from lib.core.data import logger
3636
from lib.core.data import paths
37+
from lib.core.common import unhandledExceptionMessage
3738
from lib.core.exception import exceptionsTuple
3839
from lib.core.exception import sqlmapSilentQuitException
3940
from lib.core.exception import sqlmapUserQuitException
40-
from lib.core.exception import unhandledException
4141
from lib.core.option import init
4242
from lib.core.profiling import profile
4343
from lib.core.testing import smokeTest
@@ -109,7 +109,7 @@ def main():
109109

110110
except:
111111
print
112-
errMsg = unhandledException()
112+
errMsg = unhandledExceptionMessage()
113113
logger.critical(errMsg)
114114
traceback.print_exc()
115115
closeDumper(False, errMsg)

0 commit comments

Comments
 (0)