Closes #1960 'Z' removes unmarked flows

This commit is contained in:
Ujjwal Verma 2017-02-03 01:35:53 +05:30
parent 79aa994275
commit 11b4b3209d
2 changed files with 14 additions and 0 deletions

View File

@ -230,6 +230,17 @@ class View(collections.Sequence):
self.sig_view_refresh.send(self)
self.sig_store_refresh.send(self)
def clear_not_marked(self):
"""
Clears only the unmarked flows.
"""
for flow in self._store.copy().values():
if not flow.marked:
self._store.pop(flow.id)
self._refilter()
self.sig_store_refresh.send(self)
def add(self, f: mitmproxy.flow.Flow) -> bool:
"""
Adds a flow to the state. If the flow already exists, it is

View File

@ -35,6 +35,7 @@ def _mkhelp():
("W", "stream flows to file"),
("X", "kill and delete flow, even if it's mid-intercept"),
("z", "clear flow list or eventlog"),
("Z", "clear unmarked flows"),
("tab", "tab between eventlog and flow list"),
("enter", "view flow"),
("|", "run script on this flow"),
@ -354,6 +355,8 @@ class FlowListBox(urwid.ListBox):
self.master.view.update(f)
elif key == "z":
self.master.view.clear()
elif key == "Z":
self.master.view.clear_not_marked()
elif key == "e":
self.master.toggle_eventlog()
elif key == "g":