Commit a335bb9b by devttys0

Minor changes to new_file plugin callback

parent 556feb56
...@@ -51,7 +51,7 @@ class Plugin(object): ...@@ -51,7 +51,7 @@ class Plugin(object):
''' '''
pass pass
def scan(self, result): def scan(self, module):
''' '''
Child class should override this if needed. Child class should override this if needed.
''' '''
...@@ -98,14 +98,14 @@ class Plugins(object): ...@@ -98,14 +98,14 @@ class Plugins(object):
def __exit__(self, t, v, traceback): def __exit__(self, t, v, traceback):
pass pass
def _call_plugins(self, callback_list, arg): def _call_plugins(self, callback_list, obj=None):
for callback in callback_list: for callback in callback_list:
try: try:
try: try:
callback() callback()
except TypeError: except TypeError:
if arg is not None: if obj is not None:
callback(arg) callback(obj)
except KeyboardInterrupt as e: except KeyboardInterrupt as e:
raise e raise e
except Exception as e: except Exception as e:
...@@ -241,13 +241,13 @@ class Plugins(object): ...@@ -241,13 +241,13 @@ class Plugins(object):
binwalk.core.common.warning("Failed to load plugin module '%s': %s" % (module, str(e))) binwalk.core.common.warning("Failed to load plugin module '%s': %s" % (module, str(e)))
def pre_scan_callbacks(self, obj): def pre_scan_callbacks(self, obj):
return self._call_plugins(self.pre_scan, None) return self._call_plugins(self.pre_scan)
def new_file_callbacks(self, fp): def new_file_callbacks(self, fp):
return self._call_plugins(self.new_file, fp) return self._call_plugins(self.new_file, fp)
def post_scan_callbacks(self, obj): def post_scan_callbacks(self, obj):
return self._call_plugins(self.post_scan, None) return self._call_plugins(self.post_scan)
def scan_callbacks(self, obj): def scan_callbacks(self, obj):
return self._call_plugins(self.scan, obj) return self._call_plugins(self.scan, obj)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment