mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-13 20:57:06 +00:00
2. Added a --remote flag to specify remote clusters/machines for hunting. 3. Improved a bit of the architecture, (Services) Note: The reporter module, will gather vulnerabilities before their active hunting will start. This is not an issue, as we can access all of the attributes of the event directly from the active hunter (event.previous), which we will proccess on the end in the report
29 lines
781 B
Python
29 lines
781 B
Python
import logging
|
|
from collections import defaultdict
|
|
from ..types import Hunter
|
|
|
|
from requests import get
|
|
|
|
from ..events import handler
|
|
from ..events.types import Service, Event, OpenPortEvent
|
|
|
|
class KubeProxyEvent(Event, Service):
|
|
"""proxies from a localhost address to the Kubernetes apiserver"""
|
|
def __init__(self):
|
|
Service.__init__(self, name="Kubernetes Proxy")
|
|
|
|
@handler.subscribe(OpenPortEvent, predicate=lambda x: x.port == 8001)
|
|
class KubeProxy(Hunter):
|
|
def __init__(self, event):
|
|
self.event = event
|
|
self.host = event.host
|
|
self.port = event.port or 8001
|
|
|
|
@property
|
|
def accesible(self):
|
|
return True
|
|
|
|
def execute(self):
|
|
if self.accesible:
|
|
self.publish_event(KubeProxyEvent())
|