Skip to content

Commit

Permalink
If deserialization fails, just ignore the serialized data...
Browse files Browse the repository at this point in the history
  • Loading branch information
floyd committed Aug 29, 2018
1 parent 8b52fec commit 6cc670a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 37 deletions.
84 changes: 47 additions & 37 deletions UploadScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ def registerExtenderCallbacks(self, callbacks):
print "Deserializing settings..."
self.deserialize_settings()


# It is important these registrations are done at the end, so the global_lock is freed.
# Otherwise when still deserializing and using the context menu at the same time there
# has been a global Burp thread-lock where I had to force quit Burp :(
Expand Down Expand Up @@ -587,43 +588,53 @@ def serialize_settings(self):
print "Deleted all settings..."

def deserialize_settings(self):
k = self.load_project_setting("UploadScanner_dl_matchers")
if k:
dm = pickle.loads(k.decode("base64"))
if dm:
self.dl_matchers.deserialize(dm)
try:
k = self.load_project_setting("UploadScanner_dl_matchers")
if k:
dm = pickle.loads(k.decode("base64"))
if dm:
self.dl_matchers.deserialize(dm)

# TODO Burp API limitation: IBurpCollaboratorClientContext persistence
#k = self.load_project_setting("UploadScanner_collab_monitor")
#if k:
# cm = pickle.loads(k.decode("base64"))
# self.collab_monitor.deserialize(cm)

k = self.load_project_setting("UploadScanner_tabs")
if k:
tabs = pickle.loads(k.decode("base64"))
if tabs:
for option_panel in tabs:
# right part, create with dummy request first first
sc = ScanController(CustomRequestResponse('', '', CustomHttpService('https://example.org'), '', ''), self._callbacks)
# left part, options
# add a reference to the ScanController to the options
options = OptionsPanel(self, self._callbacks, self._helpers, scan_controler=sc)
# Take all settings from the serialized object (also recursively changes ScanController)
options.deserialize(option_panel)
self.create_tab(options, sc)

k = self._callbacks.loadExtensionSetting("UploadScanner_global_opts")
if k:
cm = pickle.loads(k.decode("base64"))
if cm:
self._global_opts.deserialize(cm)

print "Restored settings..."
self.save_project_setting("UploadScanner_dl_matchers", "")
# TODO Burp API limitation: IBurpCollaboratorClientContext persistence
#self.save_project_setting("UploadScanner_collab_monitor", None)
self.save_project_setting("UploadScanner_tabs", "")
# TODO Burp API limitation: IBurpCollaboratorClientContext persistence
#k = self.load_project_setting("UploadScanner_collab_monitor")
#if k:
# cm = pickle.loads(k.decode("base64"))
# self.collab_monitor.deserialize(cm)

k = self.load_project_setting("UploadScanner_tabs")
if k:
tabs = pickle.loads(k.decode("base64"))
if tabs:
for option_panel in tabs:
# right part, create with dummy request first first
sc = ScanController(CustomRequestResponse('', '', CustomHttpService('https://example.org'), '', ''), self._callbacks)
# left part, options
# add a reference to the ScanController to the options
options = OptionsPanel(self, self._callbacks, self._helpers, scan_controler=sc)
# Take all settings from the serialized object (also recursively changes ScanController)
options.deserialize(option_panel)
self.create_tab(options, sc)

k = self._callbacks.loadExtensionSetting("UploadScanner_global_opts")
if k:
cm = pickle.loads(k.decode("base64"))
if cm:
self._global_opts.deserialize(cm)
print "Restored settings..."
except:
e = traceback.format_exc()
print "An error occured when deserializing settings. We just ignore the serialized data therefore."
print e

try:
self.save_project_setting("UploadScanner_dl_matchers", "")
# TODO Burp API limitation: IBurpCollaboratorClientContext persistence
#self.save_project_setting("UploadScanner_collab_monitor", None)
self.save_project_setting("UploadScanner_tabs", "")
except:
e = traceback.format_exc()
print "An error occured when storing empty serialize data We just ignore it for now."
print e

def save_project_setting(self, name, value):
request = """GET /"""+name+""" HTTP/1.0
Expand Down Expand Up @@ -724,7 +735,6 @@ def show_error_popup(self, error_details):
f = file("BappManifest.bmf", "rb").readlines()
for line in f:
if line.startswith("ScreenVersion: "):
print line
error_details += "\n" + line.replace("ScreenVersion", "Upload Scanner Version")
break
except:
Expand Down
Empty file modified bin/exiftool.pl
100644 → 100755
Empty file.

0 comments on commit 6cc670a

Please sign in to comment.