From d45d0ce22aef2ec5a2c6ebbf0c2e0f4a1fa83f28 Mon Sep 17 00:00:00 2001 From: Jake Drahos Date: Thu, 11 Jun 2015 16:15:24 -0500 Subject: [PATCH] Added functionality to write marked flows to file w (write) -> m (marked) --- libmproxy/console/__init__.py | 7 +++++++ libmproxy/console/flowlist.py | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index cbcba52ff..20580a28a 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -594,6 +594,13 @@ class ConsoleMaster(flow.FlowMaster): def save_flows(self, path): return self._write_flows(path, self.state.view) + + def save_marked_flows(self, path): + marked_flows = [] + for f in self.state.view: + if f.marked: + marked_flows.append(f) + return self._write_flows(path, marked_flows) def load_flows_callback(self, path): if not path: diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index f78354196..cd0b869b1 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -121,6 +121,11 @@ class ConnectionItem(urwid.WidgetWrap): prompt = "Save all flows to", callback = self.master.save_flows ) + if k == "m": + signals.status_prompt_path.send( + prompt = "Save marked flows to", + callback = self.master.save_marked_flows + ) else: signals.status_prompt_path.send( prompt = "Save this flow to", @@ -220,6 +225,7 @@ class ConnectionItem(urwid.WidgetWrap): keys = ( ("all flows", "a"), ("this flow", "t"), + ("marked flows", "m"), ), callback = self.save_flows_prompt, )