From b341124c20633208a6358bb94ed87780e15c514b Mon Sep 17 00:00:00 2001 From: danielsagi Date: Thu, 3 Sep 2020 17:06:51 +0300 Subject: [PATCH] Fixed bug in certificate hunting (#365) * striping was incorrect due to multiple newlines in certificate returned from ssl.get_server_certificate * changed ' to " for linting Co-authored-by: Daniel Sagi --- kube_hunter/modules/hunting/certificates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kube_hunter/modules/hunting/certificates.py b/kube_hunter/modules/hunting/certificates.py index 8857ccd..d6329b8 100644 --- a/kube_hunter/modules/hunting/certificates.py +++ b/kube_hunter/modules/hunting/certificates.py @@ -42,7 +42,7 @@ class CertificateDiscovery(Hunter): self.examine_certificate(cert) def examine_certificate(self, cert): - c = cert.strip(ssl.PEM_HEADER).strip(ssl.PEM_FOOTER) + c = cert.strip(ssl.PEM_HEADER).strip("\n").strip(ssl.PEM_FOOTER).strip("\n") certdata = base64.b64decode(c) emails = re.findall(email_pattern, certdata) for email in emails: