aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-04-27 15:58:54 +1200
committerAldo Cortesi <aldo@nullcube.com>2017-04-27 15:58:54 +1200
commitb7afcb5dc2007ce451161e513d3e55d4cc91379e (patch)
treec657a3b8d2f187a37f59ad05c029341568482136 /mitmproxy
parent8c4810f6069bcf592d480e5cc2d7338cd176085e (diff)
downloadmitmproxy-b7afcb5dc2007ce451161e513d3e55d4cc91379e.tar.gz
mitmproxy-b7afcb5dc2007ce451161e513d3e55d4cc91379e.tar.bz2
mitmproxy-b7afcb5dc2007ce451161e513d3e55d4cc91379e.zip
addons.streamfile -> addons.save
Options: streamfile -> save_stream_file streamfile_filter -> save_stream_filter
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/addons/__init__.py4
-rw-r--r--mitmproxy/addons/save.py (renamed from mitmproxy/addons/streamfile.py)20
-rw-r--r--mitmproxy/options.py6
-rw-r--r--mitmproxy/test/taddons.py2
-rw-r--r--mitmproxy/tools/cmdline.py4
-rw-r--r--mitmproxy/tools/console/flowlist.py6
-rw-r--r--mitmproxy/tools/console/statusbar.py4
-rw-r--r--mitmproxy/tools/main.py2
8 files changed, 24 insertions, 24 deletions
diff --git a/mitmproxy/addons/__init__.py b/mitmproxy/addons/__init__.py
index 7a45106c..e87f2cbd 100644
--- a/mitmproxy/addons/__init__.py
+++ b/mitmproxy/addons/__init__.py
@@ -14,7 +14,7 @@ from mitmproxy.addons import setheaders
from mitmproxy.addons import stickyauth
from mitmproxy.addons import stickycookie
from mitmproxy.addons import streambodies
-from mitmproxy.addons import streamfile
+from mitmproxy.addons import save
from mitmproxy.addons import upstream_auth
@@ -36,6 +36,6 @@ def default_addons():
stickyauth.StickyAuth(),
stickycookie.StickyCookie(),
streambodies.StreamBodies(),
- streamfile.StreamFile(),
+ save.Save(),
upstream_auth.UpstreamAuth(),
]
diff --git a/mitmproxy/addons/streamfile.py b/mitmproxy/addons/save.py
index fde5a1c5..9cf65750 100644
--- a/mitmproxy/addons/streamfile.py
+++ b/mitmproxy/addons/save.py
@@ -6,7 +6,7 @@ from mitmproxy import io
from mitmproxy import ctx
-class StreamFile:
+class Save:
def __init__(self):
self.stream = None
self.filt = None
@@ -23,24 +23,24 @@ class StreamFile:
def configure(self, updated):
# We're already streaming - stop the previous stream and restart
- if "streamfile_filter" in updated:
- if ctx.options.streamfile_filter:
- self.filt = flowfilter.parse(ctx.options.streamfile_filter)
+ if "save_stream_filter" in updated:
+ if ctx.options.save_stream_filter:
+ self.filt = flowfilter.parse(ctx.options.save_stream_filter)
if not self.filt:
raise exceptions.OptionsError(
- "Invalid filter specification: %s" % ctx.options.streamfile_filter
+ "Invalid filter specification: %s" % ctx.options.save_stream_filter
)
else:
self.filt = None
- if "streamfile" in updated:
+ if "save_stream_file" in updated:
if self.stream:
self.done()
- if ctx.options.streamfile:
- if ctx.options.streamfile.startswith("+"):
- path = ctx.options.streamfile[1:]
+ if ctx.options.save_stream_file:
+ if ctx.options.save_stream_file.startswith("+"):
+ path = ctx.options.save_stream_file[1:]
mode = "ab"
else:
- path = ctx.options.streamfile
+ path = ctx.options.save_stream_file
mode = "wb"
self.start_stream_to_path(path, mode, self.filt)
diff --git a/mitmproxy/options.py b/mitmproxy/options.py
index 8f8c1484..e477bed5 100644
--- a/mitmproxy/options.py
+++ b/mitmproxy/options.py
@@ -159,11 +159,11 @@ class Options(optmanager.OptManager):
choices = [i.name.lower() for i in contentviews.views]
)
self.add_option(
- "streamfile", Optional[str], None,
- "Write flows to file. Prefix path with + to append."
+ "save_stream_file", Optional[str], None,
+ "Stream flows to file as they arrive. Prefix path with + to append."
)
self.add_option(
- "streamfile_filter", Optional[str], None,
+ "save_stream_filter", Optional[str], None,
"Filter which flows are written to file."
)
self.add_option(
diff --git a/mitmproxy/test/taddons.py b/mitmproxy/test/taddons.py
index 9e2c9838..5680e847 100644
--- a/mitmproxy/test/taddons.py
+++ b/mitmproxy/test/taddons.py
@@ -130,7 +130,7 @@ class context:
def command(self, func, *args):
"""
- Invoke a command function within a command context, mimicing the actual command environment.
+ Invoke a command function with a list of string arguments within a command context, mimicing the actual command environment.
"""
cmd = command.Command(self.master.commands, "test.command", func)
return cmd.call(args)
diff --git a/mitmproxy/tools/cmdline.py b/mitmproxy/tools/cmdline.py
index 2714fed6..ca83d50e 100644
--- a/mitmproxy/tools/cmdline.py
+++ b/mitmproxy/tools/cmdline.py
@@ -66,7 +66,7 @@ def common_options(parser, opts):
opts.make_parser(parser, "scripts", metavar="SCRIPT", short="s")
opts.make_parser(parser, "stickycookie", metavar="FILTER")
opts.make_parser(parser, "stickyauth", metavar="FILTER")
- opts.make_parser(parser, "streamfile", metavar="PATH", short="w")
+ opts.make_parser(parser, "save_stream_file", metavar="PATH", short="w")
opts.make_parser(parser, "anticomp")
# Proxy options
@@ -128,7 +128,7 @@ def mitmdump(opts):
nargs="...",
help="""
Filter expression, equivalent to setting both the view_filter
- and streamfile_filter options.
+ and save_stream_filter options.
"""
)
return parser
diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py
index f1170f9f..00e5cf4e 100644
--- a/mitmproxy/tools/console/flowlist.py
+++ b/mitmproxy/tools/console/flowlist.py
@@ -411,13 +411,13 @@ class FlowListBox(urwid.ListBox):
val = not self.master.options.console_order_reversed
self.master.options.console_order_reversed = val
elif key == "W":
- if self.master.options.streamfile:
- self.master.options.streamfile = None
+ if self.master.options.save_stream_file:
+ self.master.options.save_stream_file = None
else:
signals.status_prompt_path.send(
self,
prompt="Stream flows to",
- callback= lambda path: self.master.options.update(streamfile=path)
+ callback= lambda path: self.master.options.update(save_stream_file=path)
)
else:
return urwid.ListBox.keypress(self, size, key)
diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py
index d2424832..1930fa2f 100644
--- a/mitmproxy/tools/console/statusbar.py
+++ b/mitmproxy/tools/console/statusbar.py
@@ -251,8 +251,8 @@ class StatusBar(urwid.WidgetWrap):
r.append(("heading_key", "s"))
r.append("cripts:%s]" % len(self.master.options.scripts))
- if self.master.options.streamfile:
- r.append("[W:%s]" % self.master.options.streamfile)
+ if self.master.options.save_stream_file:
+ r.append("[W:%s]" % self.master.options.save_stream_file)
return r
diff --git a/mitmproxy/tools/main.py b/mitmproxy/tools/main.py
index 9621dbbc..fefdca5c 100644
--- a/mitmproxy/tools/main.py
+++ b/mitmproxy/tools/main.py
@@ -127,7 +127,7 @@ def mitmdump(args=None): # pragma: no cover
v = " ".join(args.filter_args)
return dict(
view_filter = v,
- streamfile_filter = v,
+ save_stream_filter = v,
)
return {}