mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-08-20 12:46:25 +00:00
* added plugins submodule, created two hookspecs, one for adding arguments, one for running code after the argument parsing * implemented plugins application on main file, changed mechanism for argument parsing * changed previous parsing function to not create the ArgumentParser, and implemented it as a hook for the parsing mechanism * added pluggy to required deps * removed unecessary add_config import * fixed formatting using black * restored main link file from master * moved import of parser to right before the register call, to avoid circular imports * added tests for the plugins hooks * removed blank line space * black reformat
24 lines
551 B
Python
24 lines
551 B
Python
import pluggy
|
|
|
|
from kube_hunter.plugins import hookspecs
|
|
|
|
hookimpl = pluggy.HookimplMarker("kube-hunter")
|
|
|
|
|
|
def initialize_plugin_manager():
|
|
"""
|
|
Initializes and loads all default and setup implementations for registered plugins
|
|
|
|
@return: initialized plugin manager
|
|
"""
|
|
pm = pluggy.PluginManager("kube-hunter")
|
|
pm.add_hookspecs(hookspecs)
|
|
pm.load_setuptools_entrypoints("kube_hunter")
|
|
|
|
# default registration of builtin implemented plugins
|
|
from kube_hunter.conf import parser
|
|
|
|
pm.register(parser)
|
|
|
|
return pm
|