From 1021aca65d14f3ce3d63f9df20341441f361b384 Mon Sep 17 00:00:00 2001 From: Liz Rice Date: Wed, 20 Feb 2019 17:16:32 +0000 Subject: [PATCH] Trigger HostScanEvent to scan remote or CIDR addresses --- src/modules/discovery/hosts.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/discovery/hosts.py b/src/modules/discovery/hosts.py index 4bef152..3f3988e 100644 --- a/src/modules/discovery/hosts.py +++ b/src/modules/discovery/hosts.py @@ -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: