File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,4 @@ class UnsupportedVersionException(Exception):
1515from pyshark .capture .file_capture import FileCapture
1616from pyshark .capture .remote_capture import RemoteCapture
1717from pyshark .capture .inmem_capture import InMemCapture
18+ from pyshark .capture .pipe_capture import PipeCapture
Original file line number Diff line number Diff line change @@ -50,3 +50,18 @@ def close(self):
5050 # Close pipe
5151 os .close (self ._pipe )
5252 super (PipeCapture , self ).close ()
53+
54+ def sniff_continuously (self , packet_count = None ):
55+ """
56+ Captures from the set interface, returning a generator which returns packets continuously.
57+
58+ Can be used as follows:
59+ for packet in capture.sniff_continuously();
60+ print 'Woo, another packet:', packet
61+
62+ Note: you can also call capture.apply_on_packets(packet_callback) which should have a slight performance boost.
63+
64+ :param packet_count: an amount of packets to capture, then stop.
65+ """
66+ # Retained for backwards compatibility and to add documentation.
67+ return self ._packets_from_tshark_sync (packet_count = packet_count )
You can’t perform that action at this time.
0 commit comments