mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-09 02:36:46 +00:00
2. started working on results table. 3. *added convention* from now on, every vulnerability/service event, should have a __doc__ that describes them. notice the new get_name(), component, and explain() attributes that needs to be implemented as well.
28 lines
710 B
Python
28 lines
710 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):
|
|
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())
|