Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pyshark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ class UnsupportedVersionException(Exception):
from pyshark.capture.file_capture import FileCapture
from pyshark.capture.remote_capture import RemoteCapture
from pyshark.capture.inmem_capture import InMemCapture
from pyshark.capture.pipe_capture import PipeCapture
15 changes: 15 additions & 0 deletions src/pyshark/capture/pipe_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,18 @@ def close(self):
# Close pipe
os.close(self._pipe)
super(PipeCapture, self).close()

def sniff_continuously(self, packet_count=None):
"""
Captures from the set interface, returning a generator which returns packets continuously.

Can be used as follows:
for packet in capture.sniff_continuously();
print 'Woo, another packet:', packet

Note: you can also call capture.apply_on_packets(packet_callback) which should have a slight performance boost.

:param packet_count: an amount of packets to capture, then stop.
"""
# Retained for backwards compatibility and to add documentation.
return self._packets_from_tshark_sync(packet_count=packet_count)
Loading