Minor update

This commit is contained in:
Miroslav Stampar 2014-10-28 14:08:06 +01:00
parent 3b3b8d4ef2
commit 725c3a6a95
2 changed files with 13 additions and 7 deletions

View File

@ -2855,16 +2855,15 @@ def createGithubIssue(errMsg, excMsg):
msg = "\ndo you want to automatically create a new (anonymized) issue " msg = "\ndo you want to automatically create a new (anonymized) issue "
msg += "with the unhandled exception information at " msg += "with the unhandled exception information at "
msg += "the official Github repository? [y/N] " msg += "the official Github repository? [y/N] "
try:
test = readInput(msg, default="N") test = readInput(msg, default="N")
if test[0] in ("y", "Y"): except:
test = None
if test and test[0] in ("y", "Y"):
ex = None ex = None
errMsg = errMsg[errMsg.find("\n"):] errMsg = errMsg[errMsg.find("\n"):]
for match in re.finditer(r'File "(.+?)", line', excMsg):
file = match.group(1).replace('\\', "/")
file = file[file.find("sqlmap"):].replace("sqlmap/", "", 1)
excMsg = excMsg.replace(match.group(1), file)
data = {"title": "Unhandled exception (#%s)" % hashlib.md5(excMsg).hexdigest()[:8], "body": "```%s\n```\n```\n%s```" % (errMsg, excMsg)} data = {"title": "Unhandled exception (#%s)" % hashlib.md5(excMsg).hexdigest()[:8], "body": "```%s\n```\n```\n%s```" % (errMsg, excMsg)}
req = urllib2.Request(url="https://api.github.com/repos/sqlmapproject/sqlmap/issues", data=json.dumps(data), headers={"Authorization": "token %s" % GITHUB_REPORT_OAUTH_TOKEN}) req = urllib2.Request(url="https://api.github.com/repos/sqlmapproject/sqlmap/issues", data=json.dumps(data), headers={"Authorization": "token %s" % GITHUB_REPORT_OAUTH_TOKEN})

View File

@ -9,6 +9,7 @@ import bdb
import inspect import inspect
import logging import logging
import os import os
import re
import sys import sys
import time import time
import traceback import traceback
@ -129,6 +130,12 @@ def main():
print print
errMsg = unhandledExceptionMessage() errMsg = unhandledExceptionMessage()
excMsg = traceback.format_exc() excMsg = traceback.format_exc()
for match in re.finditer(r'File "(.+?)", line', excMsg):
file = match.group(1).replace('\\', "/")
file = file[file.find("sqlmap"):].replace("sqlmap/", "", 1)
excMsg = excMsg.replace(match.group(1), file)
logger.critical(errMsg) logger.critical(errMsg)
kb.stickyLevel = logging.CRITICAL kb.stickyLevel = logging.CRITICAL
dataToStdout(excMsg) dataToStdout(excMsg)