From c8c8cd9ebdcafe100901f7990ecc7d35054f24eb Mon Sep 17 00:00:00 2001 From: daniel_sagi Date: Mon, 23 Apr 2018 20:06:10 +0300 Subject: [PATCH] Fixed failed tries to scan unimplemented services Added an empty url to dashboard hunter Added chrome binary to automatically be install --- hunters/dashboard.py | 6 ++++-- kube-hunter.py | 11 +++++++---- requests.txt | 3 --- requirements.txt | 4 ++++ 4 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 requests.txt create mode 100644 requirements.txt diff --git a/hunters/dashboard.py b/hunters/dashboard.py index aae9143..ec4f509 100644 --- a/hunters/dashboard.py +++ b/hunters/dashboard.py @@ -1,5 +1,5 @@ from io import BytesIO -from logging import debug, warning +from logging import info, warning, debug from PIL import Image from requests import get @@ -9,7 +9,10 @@ from selenium.webdriver.support.ui import WebDriverWait from hunters.hunter import Hunter + + DASHBOARD_PATHS = [ + "", "/ui", "/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy" ] @@ -89,7 +92,6 @@ class Dashboard(Hunter): debug("Hunting dashboard at {}".format(self.host)) debug("Checking authentication...") - if self.is_auth_required: warning("Authentication is required") return diff --git a/kube-hunter.py b/kube-hunter.py index 3ccf180..f1d9897 100755 --- a/kube-hunter.py +++ b/kube-hunter.py @@ -9,6 +9,7 @@ from discovery import DEFAULT_PORTS, HostScanner from hunters import Dashboard, Kubelet, Proxy from services import * from validation import ip, subnet +import chromedriver_binary HUNT_MODE = "hunt" SCAN_MODE = "scan" @@ -29,8 +30,10 @@ def hunt_callback(host): if service_type not in hunters: warning("Unsupported service type: {}".format(describe_service_type(service_type))) else: - hunters[service_type]().hunt(host) - + try: + hunters[service_type](host).hunt() + except NotImplementedError: + pass def scan_callback(host): print("{} - {}".format(host, describe_service_type(identify_service(host)))) @@ -39,8 +42,8 @@ def scan_callback(host): def hunt(*args, **kwargs): target = args[0] info("Hunting target {}".format(target)) - # scanner = HostScanner(threads=1) - # scanner.scan(target, DEFAULT_PORTS, hunt_callback) + scanner = HostScanner(threads=1) + scanner.scan(target, DEFAULT_PORTS, hunt_callback) def scan(*args, **kwargs): diff --git a/requests.txt b/requests.txt deleted file mode 100644 index 4552730..0000000 --- a/requests.txt +++ /dev/null @@ -1,3 +0,0 @@ -selenium -pillow -netaddr \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9f2bd78 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +selenium +pillow +netaddr +chromedriver_binary \ No newline at end of file