|
|
|
@ -13,6 +13,8 @@ log = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UnsupportedPluginType(Exception): |
|
|
|
|
"""Raised when a plugin with an unsupported type is loaded""" |
|
|
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +30,13 @@ class MythrilPluginLoader(object, metaclass=Singleton): |
|
|
|
|
self._load_default_enabled() |
|
|
|
|
|
|
|
|
|
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): |
|
|
|
|
raise ValueError("Passed plugin is not of type MythrilPlugin") |
|
|
|
|
logging.info(f"Loading plugin: {plugin.name}") |
|
|
|
@ -51,10 +59,12 @@ class MythrilPluginLoader(object, metaclass=Singleton): |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def _load_laser_plugin(plugin: MythrilLaserPlugin): |
|
|
|
|
"""Loads the laser plugin""" |
|
|
|
|
log.info(f"Loading laser plugin: {plugin.name}") |
|
|
|
|
LaserPluginLoader().load(plugin.builder) |
|
|
|
|
LaserPluginLoader().load(plugin) |
|
|
|
|
|
|
|
|
|
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") |
|
|
|
|
for plugin_name in PluginDiscovery().get_plugins(default_enabled=True): |
|
|
|
|
plugin = PluginDiscovery().build_plugin(plugin_name) |
|
|
|
|