From a3dadfc42b4a8da51bd966300254411a667b1af2 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sat, 25 Jan 2020 06:37:08 -0500 Subject: [PATCH] avoid error when host_header is None --- automation/roles/mitmproxy/files/dns_spoofing.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/automation/roles/mitmproxy/files/dns_spoofing.py b/automation/roles/mitmproxy/files/dns_spoofing.py index 6b883732..6c2330ec 100644 --- a/automation/roles/mitmproxy/files/dns_spoofing.py +++ b/automation/roles/mitmproxy/files/dns_spoofing.py @@ -62,11 +62,12 @@ class Rerouter: host_header = flow.request.host_header bubble_log("dns_spoofing.request: host_header is "+repr(host_header)) - m = parse_host_header.match(host_header) - if m: - host_header = m.group("host").strip("[]") - if m.group("port"): - port = int(m.group("port")) + if host_header: + m = parse_host_header.match(host_header) + if m: + host_header = m.group("host").strip("[]") + if m.group("port"): + port = int(m.group("port")) # Determine if this request should be filtered if sni or host_header: