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

Skip to content

Commit 725c3a6

Browse files
committed
Minor update
1 parent 3b3b8d4 commit 725c3a6

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

lib/core/common.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,16 +2855,15 @@ def createGithubIssue(errMsg, excMsg):
28552855
msg = "\ndo you want to automatically create a new (anonymized) issue "
28562856
msg += "with the unhandled exception information at "
28572857
msg += "the official Github repository? [y/N] "
2858-
test = readInput(msg, default="N")
2859-
if test[0] in ("y", "Y"):
2858+
try:
2859+
test = readInput(msg, default="N")
2860+
except:
2861+
test = None
2862+
2863+
if test and test[0] in ("y", "Y"):
28602864
ex = None
28612865
errMsg = errMsg[errMsg.find("\n"):]
28622866

2863-
for match in re.finditer(r'File "(.+?)", line', excMsg):
2864-
file = match.group(1).replace('\\', "/")
2865-
file = file[file.find("sqlmap"):].replace("sqlmap/", "", 1)
2866-
excMsg = excMsg.replace(match.group(1), file)
2867-
28682867
data = {"title": "Unhandled exception (#%s)" % hashlib.md5(excMsg).hexdigest()[:8], "body": "```%s\n```\n```\n%s```" % (errMsg, excMsg)}
28692868
req = urllib2.Request(url="https://api.github.com/repos/sqlmapproject/sqlmap/issues", data=json.dumps(data), headers={"Authorization": "token %s" % GITHUB_REPORT_OAUTH_TOKEN})
28702869

sqlmap.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import inspect
1010
import logging
1111
import os
12+
import re
1213
import sys
1314
import time
1415
import traceback
@@ -129,6 +130,12 @@ def main():
129130
print
130131
errMsg = unhandledExceptionMessage()
131132
excMsg = traceback.format_exc()
133+
134+
for match in re.finditer(r'File "(.+?)", line', excMsg):
135+
file = match.group(1).replace('\\', "/")
136+
file = file[file.find("sqlmap"):].replace("sqlmap/", "", 1)
137+
excMsg = excMsg.replace(match.group(1), file)
138+
132139
logger.critical(errMsg)
133140
kb.stickyLevel = logging.CRITICAL
134141
dataToStdout(excMsg)

0 commit comments

Comments
 (0)