def test_dispatchers(): test_cases = [("stdout", STDOUTDispatcher), ("http", HTTPDispatcher), ("notexists", STDOUTDispatcher)] for dispatcher_type, expected in test_cases: actual = get_dispatcher(dispatcher_type) assert type(actual) is expected
remote=args.remote, statistics=args.statistics, ) setup_logger(args.log, args.log_file) set_config(config) # Running all other registered plugins before execution pm.hook.load_plugin(args=args) from kube_hunter.core.events import handler from kube_hunter.core.events.types import HuntFinished, HuntStarted from kube_hunter.modules.discovery.hosts import RunningAsPodEvent, HostScanEvent from kube_hunter.modules.report import get_reporter, get_dispatcher logger = logging.getLogger(__name__) config.dispatcher = get_dispatcher(args.dispatch) config.reporter = get_reporter(args.report) def interactive_set_config(): """Sets config manually, returns True for success""" options = [ ("Remote scanning", "scans one or more specific IPs or DNS names"), ("Interface scanning", "scans subnets on all local network interfaces"), ("IP range scanning", "scans a given IP range"), ] print("Choose one of the options below:") for i, (option, explanation) in enumerate(options): print("{}. {} ({})".format(i + 1, option.ljust(20), explanation))
#!/usr/bin/env python3 import logging import threading from kube_hunter.conf import config from kube_hunter.core.events import handler from kube_hunter.core.events.types import HuntFinished, HuntStarted from kube_hunter.modules.discovery.hosts import RunningAsPodEvent, HostScanEvent from kube_hunter.modules.report import get_reporter, get_dispatcher config.reporter = get_reporter(config.report) config.dispatcher = get_dispatcher(config.dispatch) logger = logging.getLogger(__name__) import kube_hunter def interactive_set_config(): """Sets config manually, returns True for success""" options = [("Remote scanning", "scans one or more specific IPs or DNS names"), ("Interface scanning", "scans subnets on all local network interfaces"), ("IP range scanning", "scans a given IP range")] print("Choose one of the options below:") for i, (option, explanation) in enumerate(options): print("{}. {} ({})".format(i + 1, option.ljust(20), explanation)) choice = input("Your choice: ") if choice == '1':