Compare commits

...

3 Commits

Author SHA1 Message Date
Daniel Sagi
7bed4ab811 added '/' suffix to path on kubelet debug handlers tests 2020-06-26 14:32:49 +03:00
Daniel Sagi
de764e192f fixed wrong iteration on list when getting random pod 2020-06-26 14:29:20 +03:00
Daniel Sagi
77ccd4a20b fixed f string 2020-06-26 13:57:15 +03:00

View File

@@ -244,7 +244,7 @@ class SecureKubeletPortHunter(Hunter):
""" all methods will return the handler name if successful """
def __init__(self, path, pod, session=None):
self.path = path
self.path = path + '/' if not path.endswith('/') else ''
self.session = session if session else requests.Session()
self.pod = pod
@@ -349,7 +349,7 @@ class SecureKubeletPortHunter(Hunter):
# self.session.cert = self.event.client_cert
# copy session to event
self.event.session = self.session
self.path = "https://{self.event.host}:10250"
self.path = f"https://{self.event.host}:10250"
self.kubehunter_pod = {
"name": "kube-hunter",
"namespace": "default",
@@ -425,7 +425,7 @@ class SecureKubeletPortHunter(Hunter):
pod_data = next(filter(is_kubesystem_pod, pods_data), None)
if pod_data:
container_data = next(pod_data["spec"]["containers"], None)
container_data = pod_data["spec"]["containers"][0]
if container_data:
return {
"name": pod_data["metadata"]["name"],