mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-09 18:57:02 +00:00
2. Changed method of hidden stacking of event, to send self as an argument, by inheriting from "Hunter" class. where the publish acts as a proxy to the handler. 3. Added new way of categorizing events, while added an option to subscribe to a father event. if en event gets publish, if its father event is hooked, the hook will be triggered 4. Added a reporter in log/ which listens to parent events, meanwhile Vulnerability and OpenService were added. all logging will be made from reporter from now on
25 lines
584 B
Python
25 lines
584 B
Python
import logging
|
|
from collections import defaultdict
|
|
from ..types import Hunter
|
|
|
|
from requests import get
|
|
|
|
from ..events import handler
|
|
from ..events.types import KubeProxyEvent, OpenPortEvent
|
|
|
|
|
|
@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())
|