aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2016-11-19 23:00:36 +0100
committerGitHub <noreply@github.com>2016-11-19 23:00:36 +0100
commitb6e419d6403cbd15eb4a95d4082f234dbf6acbf0 (patch)
tree46472595c93bf710a04af127a16c10137217e8bf
parent3ea38e6aa47c6d8283d48db270b1dc19022cace3 (diff)
parent0ff19672266c954bc5e558412398f4dadb156dc8 (diff)
downloadmitmproxy-b6e419d6403cbd15eb4a95d4082f234dbf6acbf0.tar.gz
mitmproxy-b6e419d6403cbd15eb4a95d4082f234dbf6acbf0.tar.bz2
mitmproxy-b6e419d6403cbd15eb4a95d4082f234dbf6acbf0.zip
Merge pull request #1751 from dwfreed/patch-1
proxy/protocol/base: Allow spoofing fixed source
-rw-r--r--mitmproxy/proxy/protocol/base.py6
-rw-r--r--mitmproxy/tools/cmdline.py3
2 files changed, 6 insertions, 3 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()
diff --git a/mitmproxy/tools/cmdline.py b/mitmproxy/tools/cmdline.py
index 4be107a8..34f1c08f 100644
--- a/mitmproxy/tools/cmdline.py
+++ b/mitmproxy/tools/cmdline.py
@@ -485,7 +485,8 @@ def proxy_options(parser):
group.add_argument(
"--spoof-source-address",
action="store_true", dest="spoof_source_address",
- help="Use the client's IP for server-side connections"
+ help="Use the client's IP for server-side connections. "
+ "Combine with --upstream-bind-address to spoof a fixed source address."
)
group.add_argument(
"--upstream-bind-address",