mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-24 04:14:57 +08:00
@@ -1588,8 +1588,8 @@ class FlowMaster(controller.Master):
|
||||
self.stream.add(i)
|
||||
self.stop_stream()
|
||||
|
||||
def start_stream(self, fp):
|
||||
self.stream = FlowWriter(fp)
|
||||
def start_stream(self, fp, filt):
|
||||
self.stream = FilteredFlowWriter(fp, filt)
|
||||
|
||||
def stop_stream(self):
|
||||
self.stream.fo.close()
|
||||
@@ -1635,3 +1635,16 @@ class FlowReader:
|
||||
return
|
||||
raise FlowReadError("Invalid data format.")
|
||||
|
||||
|
||||
class FilteredFlowWriter:
|
||||
def __init__(self, fo, filt):
|
||||
self.fo = fo
|
||||
self.filt = filt
|
||||
|
||||
def add(self, f):
|
||||
if self.filt and not f.match(self.filt):
|
||||
return
|
||||
d = f._get_state()
|
||||
tnetstring.dump(d, self.fo)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user