Skip to content

Commit

Permalink
Merge pull request #138 from michael-mri/master
Browse files Browse the repository at this point in the history
Make sure BPF filter applies to all interfaces
  • Loading branch information
KimiNewt authored Nov 3, 2016
2 parents 336013e + d0a4ec8 commit da077b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/pyshark/capture/live_capture.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from pyshark.capture.capture import Capture
from pyshark.tshark.tshark import get_tshark_interfaces
import sys

# Define basestring as str if we're in python3.
if sys.version_info >= (3, 0):
basestring = str

class LiveCapture(Capture):
"""
Expand Down Expand Up @@ -45,10 +49,10 @@ def get_parameters(self, packet_count=None):
Returns the special tshark parameters to be used according to the configuration of this class.
"""
params = super(LiveCapture, self).get_parameters(packet_count=packet_count)
for interface in self.interfaces:
params += ['-i', interface]
if self.bpf_filter:
params += ['-f', self.bpf_filter]
for interface in self.interfaces:
params += ['-i', interface]
return params

# Backwards compatibility
Expand Down
4 changes: 0 additions & 4 deletions src/pyshark/capture/live_ring_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,5 @@ def get_parameters(self, packet_count=None):
Returns the special tshark parameters to be used according to the configuration of this class.
"""
params = super(LiveRingCapture, self).get_parameters(packet_count=packet_count)
for interface in self.interfaces:
params += ['-i', interface]
if self.bpf_filter:
params += ['-f', self.bpf_filter]
params += ['-b', 'filesize:' + str(self.ring_file_size), '-b', 'files:' + str(self.num_ring_files), '-w', self.ring_file_name, '-P']
return params

0 comments on commit da077b5

Please sign in to comment.