aboutsummaryrefslogtreecommitdiffstats
path: root/examples/complex/tls_passthrough.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-04-26 11:45:15 +1200
committerAldo Cortesi <aldo@nullcube.com>2017-04-26 19:56:33 +1200
commit5327756377d239f059e84de4063cfcaa592fdb3d (patch)
tree9c8de935d8e627621c98d4daf39ac25e895905e0 /examples/complex/tls_passthrough.py
parente32efcae49ba5857feae85b9b4651a45d9e5fcc3 (diff)
downloadmitmproxy-5327756377d239f059e84de4063cfcaa592fdb3d.tar.gz
mitmproxy-5327756377d239f059e84de4063cfcaa592fdb3d.tar.bz2
mitmproxy-5327756377d239f059e84de4063cfcaa592fdb3d.zip
Addons and addon testing
- Fix some loading sequence bugs affecting command-line script invocation - Allow addons to over-ride existing options (with a warning). We need this for reloading. - Convert har_dump to new-style arguments, fix and re-instate its test suite. - Covnert miscelaneous other exmples to new-style args.
Diffstat (limited to 'examples/complex/tls_passthrough.py')
-rw-r--r--examples/complex/tls_passthrough.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/complex/tls_passthrough.py b/examples/complex/tls_passthrough.py
index 72c0244b..9bb27d25 100644
--- a/examples/complex/tls_passthrough.py
+++ b/examples/complex/tls_passthrough.py
@@ -23,10 +23,10 @@ Authors: Maximilian Hils, Matthew Tuusberg
import collections
import random
-import sys
from enum import Enum
import mitmproxy
+from mitmproxy import ctx
from mitmproxy.exceptions import TlsProtocolException
from mitmproxy.proxy.protocol import TlsLayer, RawTCPLayer
@@ -113,9 +113,15 @@ tls_strategy = None
def load(l):
+ l.add_option(
+ "tlsstrat", int, 0, "TLS passthrough strategy (0-100)",
+ )
+
+
+def configure(updated):
global tls_strategy
- if len(sys.argv) == 2:
- tls_strategy = ProbabilisticStrategy(float(sys.argv[1]))
+ if ctx.options.tlsstrat > 0:
+ tls_strategy = ProbabilisticStrategy(float(ctx.options.tlsstrat) / 100.0)
else:
tls_strategy = ConservativeStrategy()