How to use the pyshark.tshark.tshark.get_tshark_display_filter_flag function in pyshark

To help you get started, we’ve selected a few pyshark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github KimiNewt / pyshark / tests / test_tshark.py View on Github external
def test_get_display_filter_flag():
    actual = get_tshark_display_filter_flag(LooseVersion('1.10.0'))
    expected = '-Y'
    assert actual == expected

    actual = get_tshark_display_filter_flag(LooseVersion('1.6.0'))
    expected = '-R'
    assert actual == expected
github meyersj / wifi / sensor / env / lib / python2.7 / site-packages / pyshark-0.3.4-py2.7.egg / pyshark / capture / capture.py View on Github external
def get_parameters(self, packet_count=None):
        """
        Returns the special tshark parameters to be used according to the configuration of this class.
        """
        params = []
        if self.display_filter:
            params += [get_tshark_display_filter_flag(), self.display_filter]
        if packet_count:
            params += ['-c', str(packet_count)]
        if all(self.encryption):
            params += ['-o', 'wlan.enable_decryption:TRUE', '-o', 'uat:80211_keys:"' + self.encryption[1] + ' ","' +
                                                                  self.encryption[0] + '"']
        return params
github KimiNewt / pyshark / src / pyshark / capture / capture.py View on Github external
def get_parameters(self, packet_count=None):
        """Returns the special tshark parameters to be used according to the configuration of this class."""
        params = []
        if self._capture_filter:
            params += ["-f", self._capture_filter]
        if self._display_filter:
            params += [get_tshark_display_filter_flag(self._get_tshark_version(),),
                       self._display_filter]
        # Raw is only enabled when JSON is also enabled.
        if self.include_raw:
            params += ["-x"]
        if packet_count:
            params += ["-c", str(packet_count)]

        if self._custom_parameters:
            if isinstance(self._custom_parameters, list):
                params += self._custom_parameters
            elif isinstance(self._custom_parameters, dict):
                for key, val in self._custom_parameters.items():
                    params += [key, val]
            else:
                raise TypeError("Custom parameters type not supported.")