aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/proxy/protocol/base.py
diff options
context:
space:
mode:
authorDoug Freed <dwfreed@mtu.edu>2016-11-16 13:50:36 +0000
committerDoug Freed <dwfreed@mtu.edu>2016-11-18 14:46:32 +0000
commit0ff19672266c954bc5e558412398f4dadb156dc8 (patch)
treeedf79f96ae8cbc6848cd41bb2e38c1010408497e /mitmproxy/proxy/protocol/base.py
parentd6cfd93357f6806aa70123c5974459534d992e2b (diff)
downloadmitmproxy-0ff19672266c954bc5e558412398f4dadb156dc8.tar.gz
mitmproxy-0ff19672266c954bc5e558412398f4dadb156dc8.tar.bz2
mitmproxy-0ff19672266c954bc5e558412398f4dadb156dc8.zip
proxy/protocol/base: Allow spoofing fixed source
Allow combining --spoof-source-address and --upstream-bind-address to spoof a fixed source address. Also update the help text for --spoof-source-address to indicate this new possibility.
Diffstat (limited to 'mitmproxy/proxy/protocol/base.py')
-rw-r--r--mitmproxy/proxy/protocol/base.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mitmproxy/proxy/protocol/base.py b/mitmproxy/proxy/protocol/base.py
index 783d1cc8..c535a1a3 100644
--- a/mitmproxy/proxy/protocol/base.py
+++ b/mitmproxy/proxy/protocol/base.py
@@ -109,12 +109,14 @@ class ServerConnectionMixin:
super().__init__()
self.server_conn = None
- if self.config.options.spoof_source_address:
+ if self.config.options.spoof_source_address and self.config.options.upstream_bind_address == '':
self.server_conn = connections.ServerConnection(
server_address, (self.ctx.client_conn.address.host, 0), True)
else:
self.server_conn = connections.ServerConnection(
- server_address, (self.config.options.upstream_bind_address, 0))
+ server_address, (self.config.options.upstream_bind_address, 0),
+ self.config.options.spoof_source_address
+ )
self.__check_self_connect()