Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit 365de3a

Browse files
author
floyd
committed
1. Bug: Check if iRequestInfo.getUrl() is None. 2. Feature: Ask user if he wants to send request that triggers a bug along in a bug report
1 parent 6c8d1d1 commit 365de3a

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

UploadScanner.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -737,13 +737,14 @@ def getTabCaption(self):
737737
def getUiComponent(self):
738738
return self._main_jtabedpane
739739

740-
def show_error_popup(self, error_details):
740+
def show_error_popup(self, error_details, location, brr):
741741
try:
742742
f = file("BappManifest.bmf", "rb").readlines()
743743
for line in f:
744744
if line.startswith("ScreenVersion: "):
745745
error_details += "\n" + line.replace("ScreenVersion", "Upload Scanner Version")
746746
break
747+
error_details += "\nExtension code location: " + location
747748
except:
748749
print "Could not find plugin version..."
749750
try:
@@ -767,13 +768,28 @@ def show_error_popup(self, error_details):
767768
'Do you want to open a github issue with the details below now? \n' \
768769
'Details: \n{}\n'.format(FloydsHelpers.u2s(error_details))
769770
response = JOptionPane.showConfirmDialog(self._global_opts, full_msg, full_msg,
770-
JOptionPane.YES_NO_OPTION) # 'The Burp extension "Upload Scanner" just crashed'
771+
JOptionPane.YES_NO_OPTION)
771772
if response == JOptionPane.YES_OPTION:
773+
# Ask if it would also be OK to send the request
774+
request_msg = "Is it OK to send along the following request? If you click 'No' this request will not \n" \
775+
"be sent, but please consider submitting an anonymized/redacted version of the request \n" \
776+
"along with the bug report. \n"
777+
request_content = repr(FloydsHelpers.jb2ps(brr.getRequest()))
778+
if len(request_content) > 1500:
779+
request_content = request_content[:1500] + "..."
780+
request_msg += request_content
781+
response = JOptionPane.showConfirmDialog(self._global_opts, request_msg, request_msg,
782+
JOptionPane.YES_NO_OPTION)
783+
if response == JOptionPane.YES_OPTION:
784+
error_details += "\nRequest: " + request_content
785+
else:
786+
error_details += "\nRequest: None"
787+
772788
if Desktop.isDesktopSupported():
773789
desktop = Desktop.getDesktop()
774790
if desktop.isSupported(Desktop.Action.BROWSE):
775791
github = "https://github.com/modzero/mod0BurpUploadScanner/issues/new?title=UploadScanner%20bug" \
776-
"&body=" + urllib.quote("```\n"+error_details+"\n```")
792+
"&body=" + urllib.quote("```\n" + error_details + "\n```")
777793
desktop.browse(URI(github))
778794
#if desktop.isSupported(Desktop.Action.MAIL):
779795
# mailto = "mailto:burpplugins" + 'QGZsb3lkLmNo'.decode("base64") + "?subject=UploadScanner%20bug"
@@ -927,7 +943,7 @@ def doActiveScan(self, base_request_response, insertionPoint, options=None):
927943
else:
928944
print "This is not a type file but something else in a multipart message:", insertionPoint.getInsertionPointName()
929945
except:
930-
self.show_error_popup(traceback.format_exc())
946+
self.show_error_popup(traceback.format_exc(), "doActiveScan", base_request_response)
931947
if options and options.redl_enabled:
932948
options.scan_was_stopped()
933949
raise sys.exc_info()[1], None, sys.exc_info()[2]
@@ -966,7 +982,7 @@ def run_flexiinjector(self, base_request_response, options=None):
966982
print "You did not specify the file you are going to upload, no FlexiInjector checks will be done"
967983
self._warned_flexiinjector = True
968984
except:
969-
self.show_error_popup(traceback.format_exc())
985+
self.show_error_popup(traceback.format_exc(), "run_flexiinjector", base_request_response)
970986
if fi and fi.opts.redl_enabled:
971987
fi.opts.scan_was_stopped()
972988
raise sys.exc_info()[1], None, sys.exc_info()[2]
@@ -4928,7 +4944,7 @@ def getInsertionPoints(self, base_request_response):
49284944
function = bf.get_exiftool_images
49294945
insertion_points.append(InsertionPointForActiveScan(injector, upload_type, function, args, kwargs))
49304946
except:
4931-
self.burp_extender.show_error_popup(traceback.format_exc())
4947+
self.burp_extender.show_error_popup(traceback.format_exc(), "getInsertionPoints", base_request_response)
49324948
raise sys.exc_info()[1], None, sys.exc_info()[2]
49334949
return insertion_points
49344950

@@ -6862,10 +6878,11 @@ def __init__(self, helpers):
68626878
def add(self, dl_matcher):
68636879
brr = dl_matcher.issue.get_base_request_response()
68646880
iRequestInfo = self._helpers.analyzeRequest(brr)
6865-
url = FloydsHelpers.u2s(iRequestInfo.getUrl().toString())
6866-
host = self.add_collection(url)
6867-
with self._thread_lock:
6868-
self._collection[host].add(dl_matcher)
6881+
if iRequestInfo.getUrl():
6882+
url = FloydsHelpers.u2s(iRequestInfo.getUrl().toString())
6883+
host = self.add_collection(url)
6884+
with self._thread_lock:
6885+
self._collection[host].add(dl_matcher)
68696886

68706887
def add_collection(self, url):
68716888
host = self._get_host(url)

0 commit comments

Comments
 (0)