diff options
author | @Ga_ryo_ <avatarou9@gmail.com> | 2017-11-29 17:16:39 +0900 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-12-12 14:00:09 +0100 |
commit | d181b4643fbf1dcafecbf7bd06e8cbe2e8d5e09d (patch) | |
tree | f0fd2faf954f4f1c2e01cfe8365be14bec439065 | |
parent | 5067438ec178643ac6ffe9ce518f502bc680dc99 (diff) | |
download | mitmproxy-d181b4643fbf1dcafecbf7bd06e8cbe2e8d5e09d.tar.gz mitmproxy-d181b4643fbf1dcafecbf7bd06e8cbe2e8d5e09d.tar.bz2 mitmproxy-d181b4643fbf1dcafecbf7bd06e8cbe2e8d5e09d.zip |
Fix #2594
-rw-r--r-- | mitmproxy/platform/osx.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mitmproxy/platform/osx.py b/mitmproxy/platform/osx.py index f9de1fbf..40a742e9 100644 --- a/mitmproxy/platform/osx.py +++ b/mitmproxy/platform/osx.py @@ -1,6 +1,7 @@ import subprocess from . import pf +import re """ Doing this the "right" way by using DIOCNATLOOK on the pf device turns out @@ -15,6 +16,7 @@ from . import pf """ STATECMD = ("sudo", "-n", "/sbin/pfctl", "-s", "state") +ipv4_mapped = re.compile("^::ffff:\d+.\d+.\d+.\d+$") def original_addr(csock): @@ -33,4 +35,6 @@ def original_addr(csock): raise RuntimeError( "Insufficient privileges to access pfctl. " "See http://docs.mitmproxy.org/en/latest/transparent/osx.html for details.") + if ipv4_mapped.match(peer[0]): + return pf.lookup(peer[0].replace("::ffff:", ""), peer[1], stxt) return pf.lookup(peer[0], peer[1], stxt) |