diff --git a/kube-hunter.py b/kube-hunter.py index 1814c68..70709d9 100644 --- a/kube-hunter.py +++ b/kube-hunter.py @@ -6,13 +6,15 @@ import sys import time parser = argparse.ArgumentParser(description='Kube-Hunter - hunts for security weaknesses in Kubernetes clusters') -parser.add_argument('--internal', action="store_true", help="set hunting of all internal network interfaces") +parser.add_argument('--internal', action="store_true", help="set hunting of allinternal network interfaces") parser.add_argument('--pod', action="store_true", help="set hunter as an insider pod") parser.add_argument('--cidr', type=str, help="set manual cidr to scan, example: 192.168.0.0/16") parser.add_argument('--mapping', action="store_true", help="outputs only a mapping of the cluster's nodes") parser.add_argument('--remote', nargs='+', metavar="HOST", default=list(), help="one or more remote ip/dns to hunt") parser.add_argument('--active', action="store_true", help="enables active hunting") parser.add_argument('--log', type=str, metavar="LOGLEVEL", default='INFO', help="set log level, options are: debug, info, warn, none") +import plugins + config = parser.parse_args() try: @@ -22,12 +24,11 @@ except: if config.log.lower() != "none": logging.basicConfig(level=loglevel, format='%(message)s', datefmt='%H:%M:%S') -import report - from src.core.events import handler from src.core.events.types import HuntFinished, HuntStarted from src.modules.discovery import HostDiscovery from src.modules.discovery.hosts import HostScanEvent +import src def interactive_set_config(): diff --git a/plugins/README.md b/plugins/README.md new file mode 100644 index 0000000..bca83d8 --- /dev/null +++ b/plugins/README.md @@ -0,0 +1,3 @@ +# Plugins + +This folder contains modules that will load before any parsing of arguments by kubehunter's main module \ No newline at end of file diff --git a/report/__init__.py b/plugins/__init__.py similarity index 100% rename from report/__init__.py rename to plugins/__init__.py diff --git a/src/modules/__init__.py b/src/modules/__init__.py index 647c3e4..a35d22b 100644 --- a/src/modules/__init__.py +++ b/src/modules/__init__.py @@ -1,2 +1,3 @@ +import report import discovery import hunting \ No newline at end of file diff --git a/src/modules/report/__init__.py b/src/modules/report/__init__.py new file mode 100644 index 0000000..e1e1462 --- /dev/null +++ b/src/modules/report/__init__.py @@ -0,0 +1,7 @@ +from os.path import dirname, basename, isfile +import glob + +# dynamically importing all modules in folder +files = glob.glob(dirname(__file__)+"/*.py") +for module_name in (basename(f)[:-3] for f in files if isfile(f) and not f.endswith('__init__.py')): + exec('from {} import *'.format(module_name)) \ No newline at end of file diff --git a/report/default.py b/src/modules/report/default.py similarity index 100% rename from report/default.py rename to src/modules/report/default.py