aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmproxy/platform/__init__.py4
-rw-r--r--libmproxy/platform/windows.py6
-rw-r--r--libmproxy/proxy/config.py2
-rw-r--r--test/test_proxy.py3
4 files changed, 6 insertions, 9 deletions
diff --git a/libmproxy/platform/__init__.py b/libmproxy/platform/__init__.py
index b16904a7..1b2cf909 100644
--- a/libmproxy/platform/__init__.py
+++ b/libmproxy/platform/__init__.py
@@ -1,7 +1,6 @@
import sys
resolver = None
-setup = None
if sys.platform == "linux2":
from . import linux
@@ -14,5 +13,4 @@ elif sys.platform == "freebsd10":
resolver = osx.Resolver
elif sys.platform == "win32":
from . import windows
- resolver = windows.Resolver
- setup = windows.TransparentProxy.setup \ No newline at end of file
+ resolver = windows.Resolver \ No newline at end of file
diff --git a/libmproxy/platform/windows.py b/libmproxy/platform/windows.py
index 2734bffb..8c10421b 100644
--- a/libmproxy/platform/windows.py
+++ b/libmproxy/platform/windows.py
@@ -18,6 +18,8 @@ PROXY_API_PORT = 8085
class Resolver(object):
def __init__(self):
+ TransparentProxy.setup()
+
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.connect(("127.0.0.1", PROXY_API_PORT))
@@ -140,13 +142,13 @@ class TransparentProxy(object):
self.handle_icmp = self.driver.open_handle(filter="icmp", layer=Layer.NETWORK, flags=Flag.DROP)
@classmethod
- def setup(cls, options):
+ def setup(cls):
# TODO: Make sure that server can be killed cleanly. That's a bit difficult as we don't have access to
# controller.should_exit when this is called.
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_unavailable = s.connect_ex(("127.0.0.1", PROXY_API_PORT))
if server_unavailable:
- proxifier = TransparentProxy(proxy_addr=options.addr, proxy_port=options.port)
+ proxifier = TransparentProxy()
proxifier.start()
def start(self):
diff --git a/libmproxy/proxy/config.py b/libmproxy/proxy/config.py
index fac7c02a..94a12bf4 100644
--- a/libmproxy/proxy/config.py
+++ b/libmproxy/proxy/config.py
@@ -41,8 +41,6 @@ def process_proxy_options(parser, options):
c += 1
if not platform.resolver:
return parser.error("Transparent mode not supported on this platform.")
- if platform.setup:
- platform.setup(options)
get_upstream_server = TransparentUpstreamServerResolver(platform.resolver(), TRANSPARENT_SSL_PORTS)
http_form_in, http_form_out = "relative", "relative"
if options.reverse_proxy:
diff --git a/test/test_proxy.py b/test/test_proxy.py
index 96279b9f..31a6aa19 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -70,8 +70,7 @@ class TestProcessProxyOptions:
self.assert_err("transparent mode not supported", "-T")
@mock.patch("libmproxy.platform.resolver")
- @mock.patch("libmproxy.platform.setup")
- def test_transparent_reverse(self, _, __):
+ def test_transparent_reverse(self, _):
self.assert_err("mutually exclusive", "-R", "http://localhost", "-T")
self.assert_noerr("-T")
self.assert_err("Invalid server specification", "-R", "reverse")