def main(): global hunt_started scan_options = [config.pod, config.cidr, config.remote, config.internal] try: if config.list: list_hunters() return if not any(scan_options): if not interactive_set_config(): return hunt_started = True handler.publish_event(HuntStarted()) handler.publish_event(HostScanEvent()) # Blocking to see discovery output handler.join() except KeyboardInterrupt: logging.debug("Kube-Hunter stopped by user") # happens when running a container without interactive option except EOFError: logging.error("\033[0;31mPlease run again with -it\033[0m") finally: if hunt_started: handler.publish_event(HuntFinished()) handler.join() handler.free() logging.debug("Cleaned Queue")
def main(): global hunt_started scan_options = [config.pod, config.cidr, config.remote, config.internal] try: if config.list: list_hunters() return if not any(scan_options): if not interactive_set_config(): return hunt_started = True handler.publish_event(HuntStarted()) handler.publish_event(HostScanEvent()) # Blocking to see discovery output handler.join() except KeyboardInterrupt: logging.debug("Kube-Hunter stopped by user") finally: if hunt_started: handler.publish_event(HuntFinished()) handler.join() handler.free() logging.debug("Cleaned Queue") if config.pod: while True: time.sleep(5)