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
25 lines
615 B
Python
25 lines
615 B
Python
import pluggy
|
|
from argparse import ArgumentParser
|
|
|
|
hookspec = pluggy.HookspecMarker("kube-hunter")
|
|
|
|
|
|
@hookspec
|
|
def parser_add_arguments(parser: ArgumentParser):
|
|
"""Add arguments to the ArgumentParser.
|
|
|
|
If a plugin requires an aditional argument, it should implement this hook
|
|
and add the argument to the Argument Parser
|
|
|
|
@param parser: an ArgumentParser, calls parser.add_argument on it
|
|
"""
|
|
|
|
|
|
@hookspec
|
|
def load_plugin(args):
|
|
"""Plugins that wish to execute code after the argument parsing
|
|
should implement this hook.
|
|
|
|
@param args: all parsed arguments passed to kube-hunter
|
|
"""
|