You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
Thanks!
The text was updated successfully, but these errors were encountered:
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.
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
?Thanks!
The text was updated successfully, but these errors were encountered: