Behaves faulty, the function def get_kubectl_binary_version(self): seems to fail?
We tried the function offline on the target and noticed that it fails, even if the command "kubectl version --client" gives the expected output.
def get_kubectl_binary_version(self):
version = None
try:
kubectl version --client does not make any connection to the cluster/internet whatsoever.
version_info = subprocess.check_output("kubectl version --client", stderr=subprocess.STDOUT)
if b"GitVersion" in version_info:
# extracting version from kubectl output
version_info = version_info.decode()
start = version_info.find("GitVersion")
version = version_info[start + len("GitVersion':\"") : version_info.find('",', start)]
except Exception:
logger.debug("Could not find kubectl client")
return version
We end up in the exception, even if the expected output of the subprocess command is valid on the system?.
We think that a quick fix might be to add shell=True?
https://github.com/aquasecurity/kube-hunter/blob/a5787264956581d47e5bafae7dc6b475dc8e7e0f/kube_hunter/modules/discovery/kubectl.py
Behaves faulty, the function
def get_kubectl_binary_version(self):
seems to fail? We tried the function offline on the target and noticed that it fails, even if the command "kubectl version --client" gives the expected output.def get_kubectl_binary_version(self): version = None try:
kubectl version --client does not make any connection to the cluster/internet whatsoever.
We end up in the exception, even if the expected output of the subprocess command is valid on the system?. We think that a quick fix might be to add
shell=True
?Thanks!