|
|
@ -13,6 +13,8 @@ log = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UnsupportedPluginType(Exception): |
|
|
|
class UnsupportedPluginType(Exception): |
|
|
|
|
|
|
|
"""Raised when a plugin with an unsupported type is loaded""" |
|
|
|
|
|
|
|
|
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +30,13 @@ class MythrilPluginLoader(object, metaclass=Singleton): |
|
|
|
self._load_default_enabled() |
|
|
|
self._load_default_enabled() |
|
|
|
|
|
|
|
|
|
|
|
def load(self, plugin: MythrilPlugin): |
|
|
|
def load(self, plugin: MythrilPlugin): |
|
|
|
"""Loads the passed plugin""" |
|
|
|
"""Loads the passed plugin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This function handles input validation and dispatches loading to type specific loaders. |
|
|
|
|
|
|
|
Supported plugin types: |
|
|
|
|
|
|
|
- laser plugins |
|
|
|
|
|
|
|
- detection modules |
|
|
|
|
|
|
|
""" |
|
|
|
if not isinstance(plugin, MythrilPlugin): |
|
|
|
if not isinstance(plugin, MythrilPlugin): |
|
|
|
raise ValueError("Passed plugin is not of type MythrilPlugin") |
|
|
|
raise ValueError("Passed plugin is not of type MythrilPlugin") |
|
|
|
logging.info(f"Loading plugin: {plugin.name}") |
|
|
|
logging.info(f"Loading plugin: {plugin.name}") |
|
|
@ -51,10 +59,12 @@ class MythrilPluginLoader(object, metaclass=Singleton): |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def _load_laser_plugin(plugin: MythrilLaserPlugin): |
|
|
|
def _load_laser_plugin(plugin: MythrilLaserPlugin): |
|
|
|
|
|
|
|
"""Loads the laser plugin""" |
|
|
|
log.info(f"Loading laser plugin: {plugin.name}") |
|
|
|
log.info(f"Loading laser plugin: {plugin.name}") |
|
|
|
LaserPluginLoader().load(plugin.builder) |
|
|
|
LaserPluginLoader().load(plugin) |
|
|
|
|
|
|
|
|
|
|
|
def _load_default_enabled(self): |
|
|
|
def _load_default_enabled(self): |
|
|
|
|
|
|
|
"""Loads the plugins that have the default enabled flag""" |
|
|
|
log.info("Loading installed analysis modules that are enabled by default") |
|
|
|
log.info("Loading installed analysis modules that are enabled by default") |
|
|
|
for plugin_name in PluginDiscovery().get_plugins(default_enabled=True): |
|
|
|
for plugin_name in PluginDiscovery().get_plugins(default_enabled=True): |
|
|
|
plugin = PluginDiscovery().build_plugin(plugin_name) |
|
|
|
plugin = PluginDiscovery().build_plugin(plugin_name) |
|
|
|