mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-25 10:32:48 +00:00
29 lines
777 B
Python
29 lines
777 B
Python
import json
|
|
import logging
|
|
|
|
import requests
|
|
|
|
from ...core.events import handler
|
|
from ...core.events.types import Event, OpenPortEvent, Service
|
|
from ...core.types import Hunter
|
|
|
|
# Service:
|
|
|
|
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(Hunter):
|
|
"""Etcd Remote Access
|
|
Checks for remote availability of etcd, version, read access, write access
|
|
"""
|
|
def __init__(self, event):
|
|
self.event = event
|
|
|
|
def execute(self):
|
|
self.publish_event(EtcdAccessEvent())
|