File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,4 @@ class UnsupportedVersionException(Exception):
15
15
from pyshark .capture .file_capture import FileCapture
16
16
from pyshark .capture .remote_capture import RemoteCapture
17
17
from 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):
50
50
# Close pipe
51
51
os .close (self ._pipe )
52
52
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