mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-08-21 13:16:28 +00:00
Fix linting issues with flake8 and black. Add pre-commit congifuration, update documnetation for it. Apply linting check in Travis CI.
25 lines
717 B
Python
25 lines
717 B
Python
from kube_hunter.core.events import handler
|
|
from kube_hunter.core.events.types import Event, OpenPortEvent, Service
|
|
from kube_hunter.core.types import Discovery
|
|
|
|
|
|
class EtcdAccessEvent(Service, Event):
|
|
"""Etcd is a DB that stores cluster's data, it contains configuration and current
|
|
state information, and might contain secrets"""
|
|
|
|
def __init__(self):
|
|
Service.__init__(self, name="Etcd")
|
|
|
|
|
|
@handler.subscribe(OpenPortEvent, predicate=lambda p: p.port == 2379)
|
|
class EtcdRemoteAccess(Discovery):
|
|
"""Etcd service
|
|
check for the existence of etcd service
|
|
"""
|
|
|
|
def __init__(self, event):
|
|
self.event = event
|
|
|
|
def execute(self):
|
|
self.publish_event(EtcdAccessEvent())
|