aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy
diff options
context:
space:
mode:
authorMarcelo Glezer <mg@tekii.com.ar>2014-12-11 15:21:33 -0300
committerMarcelo Glezer <mg@tekii.com.ar>2014-12-11 15:21:33 -0300
commit14a3e0073fe3a9b8103801d400d293186a9dc7f9 (patch)
tree059dc0a16765493604bb3e5045ec47ad4318d64c /libmproxy
parent4952643a0d76eb1e9bd51cbbe95c565ae48b97a2 (diff)
downloadmitmproxy-14a3e0073fe3a9b8103801d400d293186a9dc7f9.tar.gz
mitmproxy-14a3e0073fe3a9b8103801d400d293186a9dc7f9.tar.bz2
mitmproxy-14a3e0073fe3a9b8103801d400d293186a9dc7f9.zip
append file mode for saving flows merged to master
Diffstat (limited to 'libmproxy')
-rw-r--r--libmproxy/cmdline.py14
-rw-r--r--libmproxy/dump.py8
2 files changed, 14 insertions, 8 deletions
diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py
index b892f1fd..bf5add33 100644
--- a/libmproxy/cmdline.py
+++ b/libmproxy/cmdline.py
@@ -179,7 +179,7 @@ def get_common_options(options):
stickyauth=stickyauth,
stream_large_bodies=stream_large_bodies,
showhost=options.showhost,
- wfile=options.wfile,
+ outfile=options.outfile,
verbosity=options.verbose,
nopop=options.nopop,
replay_ignore_content = options.replay_ignore_content,
@@ -249,11 +249,17 @@ def common_options(parser):
action="store_const", dest="verbose", default=1, const=2,
help="Increase event log verbosity."
)
- parser.add_argument(
+ outfile = parser.add_mutually_exclusive_group()
+ outfile.add_argument(
"-w", "--wfile",
- action="store", dest="wfile", default=None,
+ action="store", dest="outfile", type=lambda f: (f, "wb"),
help="Write flows to file."
)
+ outfile.add_argument(
+ "-a", "--afile",
+ action="store", dest="outfile", type=lambda f: (f, "ab"),
+ help="Append flows to file."
+ )
parser.add_argument(
"-z", "--anticomp",
action="store_true", dest="anticomp", default=False,
@@ -371,7 +377,7 @@ def common_options(parser):
group = parser.add_argument_group("Onboarding App")
group.add_argument(
- "-a", "--noapp",
+ "--noapp",
action="store_false", dest="app", default=True,
help="Disable the mitmproxy onboarding app."
)
diff --git a/libmproxy/dump.py b/libmproxy/dump.py
index 0d9432c9..8f260745 100644
--- a/libmproxy/dump.py
+++ b/libmproxy/dump.py
@@ -36,7 +36,7 @@ class Options(object):
"stickyauth",
"stream_large_bodies",
"verbosity",
- "wfile",
+ "outfile",
"replay_ignore_content",
"replay_ignore_params",
]
@@ -92,10 +92,10 @@ class DumpMaster(flow.FlowMaster):
if options.stickyauth:
self.set_stickyauth(options.stickyauth)
- if options.wfile:
- path = os.path.expanduser(options.wfile)
+ if options.outfile:
+ path = os.path.expanduser(options.outfile[0])
try:
- f = file(path, "wb")
+ f = file(path, options.outfile[1])
self.start_stream(f, self.filt)
except IOError, v:
raise DumpError(v.strerror)