aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/complex/dns_spoofing.py2
-rw-r--r--examples/complex/har_dump.py2
-rw-r--r--examples/complex/remote_debug.py2
-rw-r--r--examples/complex/tls_passthrough.py2
-rw-r--r--examples/simple/add_header_class.py2
-rw-r--r--examples/simple/custom_contentview.py2
-rw-r--r--examples/simple/custom_option.py2
-rw-r--r--examples/simple/filter_flows.py2
-rw-r--r--examples/simple/io_write_dumpfile.py2
-rw-r--r--examples/simple/log_events.py2
-rw-r--r--examples/simple/modify_body_inject_iframe.py2
-rw-r--r--examples/simple/script_arguments.py2
-rw-r--r--examples/simple/wsgi_flask_app.py2
-rw-r--r--mitmproxy/addonmanager.py2
-rw-r--r--mitmproxy/addons/script.py10
-rw-r--r--mitmproxy/addons/serverplayback.py4
-rw-r--r--mitmproxy/eventsequence.py2
-rw-r--r--mitmproxy/script/concurrent.py2
-rw-r--r--test/mitmproxy/addons/test_script.py20
-rw-r--r--test/mitmproxy/addons/test_serverplayback.py12
-rw-r--r--test/mitmproxy/data/addonscripts/addon.py8
-rw-r--r--test/mitmproxy/data/addonscripts/concurrent_decorator_class.py2
-rw-r--r--test/mitmproxy/data/addonscripts/print.py2
-rw-r--r--test/mitmproxy/data/addonscripts/recorder.py2
-rw-r--r--test/mitmproxy/script/test_concurrent.py6
25 files changed, 49 insertions, 49 deletions
diff --git a/examples/complex/dns_spoofing.py b/examples/complex/dns_spoofing.py
index ca2bcd35..9f6af522 100644
--- a/examples/complex/dns_spoofing.py
+++ b/examples/complex/dns_spoofing.py
@@ -54,5 +54,5 @@ class Rerouter:
flow.request.port = port
-def start(opts):
+def load(opts):
return Rerouter()
diff --git a/examples/complex/har_dump.py b/examples/complex/har_dump.py
index 9a86e45e..f9f8cd95 100644
--- a/examples/complex/har_dump.py
+++ b/examples/complex/har_dump.py
@@ -25,7 +25,7 @@ HAR = {}
SERVERS_SEEN = set()
-def start(opts):
+def load(opts):
"""
Called once on script startup before any other events.
"""
diff --git a/examples/complex/remote_debug.py b/examples/complex/remote_debug.py
index ae0dffc1..0b7049d2 100644
--- a/examples/complex/remote_debug.py
+++ b/examples/complex/remote_debug.py
@@ -14,6 +14,6 @@ Usage:
"""
-def start(opts):
+def load(opts):
import pydevd
pydevd.settrace("localhost", port=5678, stdoutToServer=True, stderrToServer=True)
diff --git a/examples/complex/tls_passthrough.py b/examples/complex/tls_passthrough.py
index 6dba7ca1..3b3c8936 100644
--- a/examples/complex/tls_passthrough.py
+++ b/examples/complex/tls_passthrough.py
@@ -112,7 +112,7 @@ class TlsFeedback(TlsLayer):
tls_strategy = None
-def start(opts):
+def load(opts):
global tls_strategy
if len(sys.argv) == 2:
tls_strategy = ProbabilisticStrategy(float(sys.argv[1]))
diff --git a/examples/simple/add_header_class.py b/examples/simple/add_header_class.py
index 9270be09..7a0dbafa 100644
--- a/examples/simple/add_header_class.py
+++ b/examples/simple/add_header_class.py
@@ -3,5 +3,5 @@ class AddHeader:
flow.response.headers["newheader"] = "foo"
-def start(opts):
+def load(opts):
return AddHeader()
diff --git a/examples/simple/custom_contentview.py b/examples/simple/custom_contentview.py
index 4bc17af0..b159154f 100644
--- a/examples/simple/custom_contentview.py
+++ b/examples/simple/custom_contentview.py
@@ -20,7 +20,7 @@ class ViewSwapCase(contentviews.View):
view = ViewSwapCase()
-def start(opts):
+def load(opts):
contentviews.add(view)
diff --git a/examples/simple/custom_option.py b/examples/simple/custom_option.py
index 324d27e7..3190b840 100644
--- a/examples/simple/custom_option.py
+++ b/examples/simple/custom_option.py
@@ -1,7 +1,7 @@
from mitmproxy import ctx
-def start(options):
+def load(options):
ctx.log.info("Registering option 'custom'")
options.add_option("custom", bool, False, "A custom option")
diff --git a/examples/simple/filter_flows.py b/examples/simple/filter_flows.py
index 24e8b6c1..4d3e264e 100644
--- a/examples/simple/filter_flows.py
+++ b/examples/simple/filter_flows.py
@@ -17,7 +17,7 @@ class Filter:
print(flow)
-def start(opts):
+def load(opts):
if len(sys.argv) != 2:
raise ValueError("Usage: -s 'filt.py FILTER'")
return Filter(sys.argv[1])
diff --git a/examples/simple/io_write_dumpfile.py b/examples/simple/io_write_dumpfile.py
index 311950af..3204e566 100644
--- a/examples/simple/io_write_dumpfile.py
+++ b/examples/simple/io_write_dumpfile.py
@@ -23,7 +23,7 @@ class Writer:
self.w.add(flow)
-def start(opts):
+def load(opts):
if len(sys.argv) != 2:
raise ValueError('Usage: -s "flowriter.py filename"')
return Writer(sys.argv[1])
diff --git a/examples/simple/log_events.py b/examples/simple/log_events.py
index a81892aa..518a202f 100644
--- a/examples/simple/log_events.py
+++ b/examples/simple/log_events.py
@@ -7,6 +7,6 @@ If you want to help us out: https://github.com/mitmproxy/mitmproxy/issues/1530 :
from mitmproxy import ctx
-def start(opts):
+def load(opts):
ctx.log.info("This is some informative text.")
ctx.log.error("This is an error.")
diff --git a/examples/simple/modify_body_inject_iframe.py b/examples/simple/modify_body_inject_iframe.py
index ab5abf27..f92aac04 100644
--- a/examples/simple/modify_body_inject_iframe.py
+++ b/examples/simple/modify_body_inject_iframe.py
@@ -23,7 +23,7 @@ class Injector:
flow.response.content = str(html).encode("utf8")
-def start(opts):
+def load(opts):
if len(sys.argv) != 2:
raise ValueError('Usage: -s "iframe_injector.py url"')
return Injector(sys.argv[1])
diff --git a/examples/simple/script_arguments.py b/examples/simple/script_arguments.py
index b46a1960..e16f6a22 100644
--- a/examples/simple/script_arguments.py
+++ b/examples/simple/script_arguments.py
@@ -9,7 +9,7 @@ class Replacer:
flow.response.replace(self.src, self.dst)
-def start(opts):
+def load(opts):
parser = argparse.ArgumentParser()
parser.add_argument("src", type=str)
parser.add_argument("dst", type=str)
diff --git a/examples/simple/wsgi_flask_app.py b/examples/simple/wsgi_flask_app.py
index db3b1adf..5def17b4 100644
--- a/examples/simple/wsgi_flask_app.py
+++ b/examples/simple/wsgi_flask_app.py
@@ -14,7 +14,7 @@ def hello_world():
return 'Hello World!'
-def start(opts):
+def load(opts):
# Host app at the magic domain "proxapp" on port 80. Requests to this
# domain and port combination will now be routed to the WSGI app instance.
return wsgiapp.WSGIApp(app, "proxapp", 80)
diff --git a/mitmproxy/addonmanager.py b/mitmproxy/addonmanager.py
index 670c4f24..b3a71f1b 100644
--- a/mitmproxy/addonmanager.py
+++ b/mitmproxy/addonmanager.py
@@ -42,7 +42,7 @@ class AddonManager:
self.chain.extend(addons)
with self.master.handlecontext():
for i in addons:
- self.invoke_addon(i, "start", self.master.options)
+ self.invoke_addon(i, "load", self.master.options)
def remove(self, addon):
"""
diff --git a/mitmproxy/addons/script.py b/mitmproxy/addons/script.py
index 3b7a4f79..cb98704a 100644
--- a/mitmproxy/addons/script.py
+++ b/mitmproxy/addons/script.py
@@ -184,22 +184,22 @@ class Script:
def load_script(self):
self.ns = load_script(self.path, self.args)
- ret = self.run("start", self.last_options)
+ ret = self.run("load", self.last_options)
if ret:
self.ns = ret
- self.run("start", self.last_options)
+ self.run("load", self.last_options)
def tick(self):
if self.should_reload.is_set():
self.should_reload.clear()
ctx.log.info("Reloading script: %s" % self.name)
self.ns = load_script(self.path, self.args)
- self.start(self.last_options)
+ self.load(self.last_options)
self.configure(self.last_options, self.last_options.keys())
else:
self.run("tick")
- def start(self, opts):
+ def load(self, opts):
self.last_options = opts
self.load_script()
@@ -287,7 +287,7 @@ class ScriptLoader:
ctx.master.addons.chain = ochain[:pos + 1] + ordered + ochain[pos + 1:]
for s in newscripts:
- ctx.master.addons.invoke_addon(s, "start", options)
+ ctx.master.addons.invoke_addon(s, "load", options)
if self.is_running:
# If we're already running, we configure and tell the addon
# we're up and running.
diff --git a/mitmproxy/addons/serverplayback.py b/mitmproxy/addons/serverplayback.py
index be2d6f2b..7bb0c716 100644
--- a/mitmproxy/addons/serverplayback.py
+++ b/mitmproxy/addons/serverplayback.py
@@ -16,7 +16,7 @@ class ServerPlayback:
self.stop = False
self.final_flow = None
- def load(self, flows):
+ def load_flows(self, flows):
for i in flows:
if i.response:
l = self.flowmap.setdefault(self._hash(i), [])
@@ -100,7 +100,7 @@ class ServerPlayback:
flows = io.read_flows_from_paths(options.server_replay)
except exceptions.FlowReadException as e:
raise exceptions.OptionsError(str(e))
- self.load(flows)
+ self.load_flows(flows)
def tick(self):
if self.stop and not self.final_flow.live:
diff --git a/mitmproxy/eventsequence.py b/mitmproxy/eventsequence.py
index bc6660e0..30c037f1 100644
--- a/mitmproxy/eventsequence.py
+++ b/mitmproxy/eventsequence.py
@@ -32,7 +32,7 @@ Events = frozenset([
"configure",
"done",
"log",
- "start",
+ "load",
"running",
"tick",
])
diff --git a/mitmproxy/script/concurrent.py b/mitmproxy/script/concurrent.py
index 7573f2a5..cbb3beb0 100644
--- a/mitmproxy/script/concurrent.py
+++ b/mitmproxy/script/concurrent.py
@@ -12,7 +12,7 @@ class ScriptThread(basethread.BaseThread):
def concurrent(fn):
- if fn.__name__ not in eventsequence.Events - {"start", "configure", "tick"}:
+ if fn.__name__ not in eventsequence.Events - {"load", "configure", "tick"}:
raise NotImplementedError(
"Concurrent decorator not supported for '%s' method." % fn.__name__
)
diff --git a/test/mitmproxy/addons/test_script.py b/test/mitmproxy/addons/test_script.py
index 84d36e2a..79416161 100644
--- a/test/mitmproxy/addons/test_script.py
+++ b/test/mitmproxy/addons/test_script.py
@@ -104,7 +104,7 @@ def test_load_script():
"mitmproxy/data/addonscripts/recorder.py"
), []
)
- assert ns.start
+ assert ns.load
def test_script_print_stdout():
@@ -129,7 +129,7 @@ class TestScript:
)
)
sc.load_script()
- assert sc.ns.call_log[0][0:2] == ("solo", "start")
+ assert sc.ns.call_log[0][0:2] == ("solo", "load")
sc.ns.call_log = []
f = tflow.tflow(resp=True)
@@ -157,7 +157,7 @@ class TestScript:
sc = script.Script(
tutils.test_data.path("mitmproxy/data/addonscripts/error.py")
)
- sc.start(tctx.options)
+ sc.load(tctx.options)
f = tflow.tflow(resp=True)
sc.request(f)
assert tctx.master.logs[0].level == "error"
@@ -173,10 +173,10 @@ class TestScript:
"mitmproxy/data/addonscripts/addon.py"
)
)
- sc.start(tctx.options)
+ sc.load(tctx.options)
tctx.configure(sc)
assert sc.ns.event_log == [
- 'scriptstart', 'addonstart', 'addonconfigure'
+ 'scriptload', 'addonload', 'addonconfigure'
]
@@ -213,7 +213,7 @@ class TestScriptLoader:
), [f]
)
evts = [i[1] for i in sc.ns.call_log]
- assert evts == ['start', 'requestheaders', 'request', 'responseheaders', 'response', 'done']
+ assert evts == ['load', 'requestheaders', 'request', 'responseheaders', 'response', 'done']
f = tflow.tflow(resp=True)
with m.handlecontext():
@@ -271,15 +271,15 @@ class TestScriptLoader:
)
debug = [i.msg for i in tctx.master.logs if i.level == "debug"]
assert debug == [
- 'a start',
+ 'a load',
'a configure',
'a running',
- 'b start',
+ 'b load',
'b configure',
'b running',
- 'c start',
+ 'c load',
'c configure',
'c running',
]
@@ -307,7 +307,7 @@ class TestScriptLoader:
assert debug == [
'c done',
'b done',
- 'x start',
+ 'x load',
'x configure',
'x running',
]
diff --git a/test/mitmproxy/addons/test_serverplayback.py b/test/mitmproxy/addons/test_serverplayback.py
index 02642c35..7078b66e 100644
--- a/test/mitmproxy/addons/test_serverplayback.py
+++ b/test/mitmproxy/addons/test_serverplayback.py
@@ -44,12 +44,12 @@ def test_server_playback():
assert not sp.flowmap
- sp.load([f])
+ sp.load_flows([f])
assert sp.flowmap
assert sp.next_flow(f)
assert not sp.flowmap
- sp.load([f])
+ sp.load_flows([f])
assert sp.flowmap
sp.clear()
assert not sp.flowmap
@@ -192,7 +192,7 @@ def test_load():
r2 = tflow.tflow(resp=True)
r2.request.headers["key"] = "two"
- s.load([r, r2])
+ s.load_flows([r, r2])
assert s.count() == 2
@@ -218,7 +218,7 @@ def test_load_with_server_replay_nopop():
r2 = tflow.tflow(resp=True)
r2.request.headers["key"] = "two"
- s.load([r, r2])
+ s.load_flows([r, r2])
assert s.count() == 2
s.next_flow(r)
@@ -319,7 +319,7 @@ def test_server_playback_full():
f = tflow.tflow()
f.response = mitmproxy.test.tutils.tresp(content=f.request.content)
- s.load([f, f])
+ s.load_flows([f, f])
tf = tflow.tflow()
assert not tf.response
@@ -352,7 +352,7 @@ def test_server_playback_kill():
f = tflow.tflow()
f.response = mitmproxy.test.tutils.tresp(content=f.request.content)
- s.load([f])
+ s.load_flows([f])
f = tflow.tflow()
f.request.host = "nonexistent"
diff --git a/test/mitmproxy/data/addonscripts/addon.py b/test/mitmproxy/data/addonscripts/addon.py
index f34f41cb..3186400a 100644
--- a/test/mitmproxy/data/addonscripts/addon.py
+++ b/test/mitmproxy/data/addonscripts/addon.py
@@ -6,8 +6,8 @@ class Addon:
def event_log(self):
return event_log
- def start(self, opts):
- event_log.append("addonstart")
+ def load(self, opts):
+ event_log.append("addonload")
def configure(self, options, updated):
event_log.append("addonconfigure")
@@ -17,6 +17,6 @@ def configure(options, updated):
event_log.append("addonconfigure")
-def start(opts):
- event_log.append("scriptstart")
+def load(opts):
+ event_log.append("scriptload")
return Addon()
diff --git a/test/mitmproxy/data/addonscripts/concurrent_decorator_class.py b/test/mitmproxy/data/addonscripts/concurrent_decorator_class.py
index 10ba24cd..d486923a 100644
--- a/test/mitmproxy/data/addonscripts/concurrent_decorator_class.py
+++ b/test/mitmproxy/data/addonscripts/concurrent_decorator_class.py
@@ -9,5 +9,5 @@ class ConcurrentClass:
time.sleep(0.1)
-def start(opts):
+def load(opts):
return ConcurrentClass()
diff --git a/test/mitmproxy/data/addonscripts/print.py b/test/mitmproxy/data/addonscripts/print.py
index fdfcc3d9..93b65a64 100644
--- a/test/mitmproxy/data/addonscripts/print.py
+++ b/test/mitmproxy/data/addonscripts/print.py
@@ -1,2 +1,2 @@
-def start(opts):
+def load(l):
print("stdoutprint")
diff --git a/test/mitmproxy/data/addonscripts/recorder.py b/test/mitmproxy/data/addonscripts/recorder.py
index aff524a8..5e0cdfc2 100644
--- a/test/mitmproxy/data/addonscripts/recorder.py
+++ b/test/mitmproxy/data/addonscripts/recorder.py
@@ -22,5 +22,5 @@ class CallLogger:
raise AttributeError
-def start(opts):
+def load(opts):
return CallLogger(*sys.argv[1:])
diff --git a/test/mitmproxy/script/test_concurrent.py b/test/mitmproxy/script/test_concurrent.py
index 0e397b8f..ccae0d31 100644
--- a/test/mitmproxy/script/test_concurrent.py
+++ b/test/mitmproxy/script/test_concurrent.py
@@ -24,7 +24,7 @@ class TestConcurrent(tservers.MasterTest):
"mitmproxy/data/addonscripts/concurrent_decorator.py"
)
)
- sc.start(tctx.options)
+ sc.load(tctx.options)
f1, f2 = tflow.tflow(), tflow.tflow()
tctx.cycle(sc, f1)
@@ -42,7 +42,7 @@ class TestConcurrent(tservers.MasterTest):
"mitmproxy/data/addonscripts/concurrent_decorator_err.py"
)
)
- sc.start(tctx.options)
+ sc.load(tctx.options)
assert tctx.master.has_log("decorator not supported")
def test_concurrent_class(self):
@@ -52,7 +52,7 @@ class TestConcurrent(tservers.MasterTest):
"mitmproxy/data/addonscripts/concurrent_decorator_class.py"
)
)
- sc.start(tctx.options)
+ sc.load(tctx.options)
f1, f2 = tflow.tflow(), tflow.tflow()
tctx.cycle(sc, f1)