mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-06 01:08:11 +00:00
Trigger HostScanEvent to scan remote or CIDR addresses
This commit is contained in:
@@ -74,18 +74,20 @@ class FromPodHostDiscovery(Hunter):
|
||||
self.event = event
|
||||
|
||||
def execute(self):
|
||||
# Discover master API server from in-pod environment variable.
|
||||
|
||||
# Discover cluster subnets, we'll scan all these hosts
|
||||
if self.is_azure_pod():
|
||||
subnets, cloud =self.azure_metadata_discovery()
|
||||
subnets, cloud = self.azure_metadata_discovery()
|
||||
else:
|
||||
subnets, cloud = self.traceroute_discovery()
|
||||
|
||||
|
||||
for subnet in subnets:
|
||||
logging.debug("From pod scanning subnet {0}/{1}".format(subnet[0], subnet[1]))
|
||||
for ip in HostDiscoveryHelpers.generate_subnet(ip=subnet[0], sn=subnet[1]):
|
||||
self.publish_event(NewHostEvent(host=ip, cloud=cloud))
|
||||
|
||||
# There may be other hosts to scan as well
|
||||
if config.remote or config.cidr:
|
||||
self.publish_event(HostScanEvent())
|
||||
|
||||
def is_azure_pod(self):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user