fix mitmproxy -w

This commit is contained in:
Maximilian Hils
2014-12-29 14:40:34 +01:00
parent 3e63107e94
commit ad973de0b3
2 changed files with 7 additions and 7 deletions

View File

@@ -432,20 +432,20 @@ class ConsoleMaster(flow.FlowMaster):
print >> sys.stderr, "Script load error:", err
sys.exit(1)
if options.wfile:
err = self.start_stream(options.wfile)
if options.outfile:
err = self.start_stream_to_path(options.outfile[0], options.outfile[1])
if err:
print >> sys.stderr, "Script load error:", err
print >> sys.stderr, "Stream file error:", err
sys.exit(1)
if options.app:
self.start_app(self.options.app_host, self.options.app_port)
def start_stream(self, path):
def start_stream_to_path(self, path, mode="wb"):
path = os.path.expanduser(path)
try:
f = file(path, "wb")
flow.FlowMaster.start_stream(self, f, None)
f = file(path, mode)
self.start_stream(f, None)
except IOError, v:
return str(v)
self.stream_path = path

View File

@@ -263,7 +263,7 @@ class FlowListBox(urwid.ListBox):
self.master.path_prompt(
"Stream flows to: ",
self.master.state.last_saveload,
self.master.start_stream
self.master.start_stream_to_path
)
else:
return urwid.ListBox.keypress(self, size, key)