Right now in HostDiscovery.execute() we try to map out a cidr and assign a cloud to it, in the code only the first IP of a cidr is sent to the get_cloud() func(for example out of 192.168.0.1/24, only 192.168.0.1 is sent)
while we ignore a few facts:
The first IP might not exist in the cloud, but another might exist.
The first IP might exist in Azure, but another may belongs to other cloud vendor (if subnet is big enough).
So if we scan all IP's that should solve the problem, but then we have a performance issue, because we will scan each and every IP without even knowing if theres a VM behind it.
Why is this needed
It's a feature in kube-hunter that currently isn't working right, and it's causing some hunters to not deliver what they should do (aks.py AzureSpnHunter for example)
What can it look like
We can use cached-property pip package, so that when we acually access the event.cloud property it will call up the get_cloud function.
So the event.cloud property will act as a lazy load - only when we access it, it will try to obtain it.
What would you like to be added
Right now in HostDiscovery.execute() we try to map out a cidr and assign a cloud to it, in the code only the first IP of a cidr is sent to the get_cloud() func(for example out of 192.168.0.1/24, only 192.168.0.1 is sent) while we ignore a few facts:
So if we scan all IP's that should solve the problem, but then we have a performance issue, because we will scan each and every IP without even knowing if theres a VM behind it.
Why is this needed
It's a feature in kube-hunter that currently isn't working right, and it's causing some hunters to not deliver what they should do (aks.py AzureSpnHunter for example)
What can it look like
We can use cached-property pip package, so that when we acually access the event.cloud property it will call up the get_cloud function. So the event.cloud property will act as a lazy load - only when we access it, it will try to obtain it.