aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy
diff options
context:
space:
mode:
authorSandor Nemes <sandor.nemes@gmail.com>2016-01-08 15:46:59 +0100
committerSandor Nemes <sandor.nemes@gmail.com>2016-01-08 18:55:13 +0100
commitfe77dd35c67a0dfbd3004fefe97c689f8cfd3291 (patch)
treebec6c002a4db4ac019d9dfe5cf735db3375378c4 /libmproxy/proxy
parent11215e46ecc5c3a4272893d4b06f71920ff126f5 (diff)
downloadmitmproxy-fe77dd35c67a0dfbd3004fefe97c689f8cfd3291.tar.gz
mitmproxy-fe77dd35c67a0dfbd3004fefe97c689f8cfd3291.tar.bz2
mitmproxy-fe77dd35c67a0dfbd3004fefe97c689f8cfd3291.zip
Fixed a problem with the bind address not being used as the source address on outgoing TCP packets
Diffstat (limited to 'libmproxy/proxy')
-rw-r--r--libmproxy/proxy/modes/http_proxy.py1
-rw-r--r--libmproxy/proxy/modes/reverse_proxy.py1
-rw-r--r--libmproxy/proxy/modes/socks_proxy.py4
-rw-r--r--libmproxy/proxy/modes/transparent_proxy.py1
4 files changed, 7 insertions, 0 deletions
diff --git a/libmproxy/proxy/modes/http_proxy.py b/libmproxy/proxy/modes/http_proxy.py
index c7502c24..27da57dd 100644
--- a/libmproxy/proxy/modes/http_proxy.py
+++ b/libmproxy/proxy/modes/http_proxy.py
@@ -16,6 +16,7 @@ class HttpProxy(Layer, ServerConnectionMixin):
class HttpUpstreamProxy(Layer, ServerConnectionMixin):
def __init__(self, ctx, server_address):
super(HttpUpstreamProxy, self).__init__(ctx, server_address=server_address)
+ self.server_conn.source_address = (ctx.config.host, 0)
def __call__(self):
layer = self.ctx.next_layer(self)
diff --git a/libmproxy/proxy/modes/reverse_proxy.py b/libmproxy/proxy/modes/reverse_proxy.py
index 28f4e6f8..3ff22b6c 100644
--- a/libmproxy/proxy/modes/reverse_proxy.py
+++ b/libmproxy/proxy/modes/reverse_proxy.py
@@ -6,6 +6,7 @@ from ...protocol import Layer, ServerConnectionMixin
class ReverseProxy(Layer, ServerConnectionMixin):
def __init__(self, ctx, server_address, server_tls):
super(ReverseProxy, self).__init__(ctx, server_address=server_address)
+ self.server_conn.source_address = (ctx.config.host, 0)
self.server_tls = server_tls
def __call__(self):
diff --git a/libmproxy/proxy/modes/socks_proxy.py b/libmproxy/proxy/modes/socks_proxy.py
index 264c734a..6e0b927b 100644
--- a/libmproxy/proxy/modes/socks_proxy.py
+++ b/libmproxy/proxy/modes/socks_proxy.py
@@ -8,6 +8,10 @@ from ...protocol import Layer, ServerConnectionMixin
class Socks5Proxy(Layer, ServerConnectionMixin):
+ def __init__(self, ctx):
+ super(Socks5Proxy, self).__init__(ctx)
+ self.server_conn.source_address = (ctx.config.host, 0)
+
def __call__(self):
try:
# Parse Client Greeting
diff --git a/libmproxy/proxy/modes/transparent_proxy.py b/libmproxy/proxy/modes/transparent_proxy.py
index da1d4632..995e4bd9 100644
--- a/libmproxy/proxy/modes/transparent_proxy.py
+++ b/libmproxy/proxy/modes/transparent_proxy.py
@@ -8,6 +8,7 @@ from ...protocol import Layer, ServerConnectionMixin
class TransparentProxy(Layer, ServerConnectionMixin):
def __init__(self, ctx):
super(TransparentProxy, self).__init__(ctx)
+ self.server_conn.source_address = (ctx.config.host, 0)
self.resolver = platform.resolver()
def __call__(self):