How to use the pyshark.tshark.tshark.get_tshark_interfaces 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_tshark_interfaces(mock_check_output):
    mock_check_output.return_value = (
        b'1. wlan0\n2. any\n3. lo (Loopback)\n4. eth0\n5. docker0\n'
    )
    actual = get_tshark_interfaces()
    expected = ['1', '2', '3', '4', '5']
    assert actual == expected
github meyersj / wifi / sensor / env / lib / python2.7 / site-packages / pyshark-0.3.4-py2.7.egg / pyshark / capture / live_capture.py View on Github external
Creates a new live capturer on a given interface. Does not start the actual capture itself.

        :param interface: Name of the interface to sniff on. If not given, takes the first available.
        :param bpf_filter: BPF filter to use on packets.
        :param display_filter: Display (wireshark) filter to use.
        :param only_summaries: Only produce packet summaries, much faster but includes very little information
        :param decryption_key: Optional key used to encrypt and decrypt captured traffic.
        :param encryption_type: Standard of encryption used in captured traffic (must be either 'WEP', 'WPA-PWD', or
        'WPA-PWK'. Defaults to WPA-PWK).
        """
        super(LiveCapture, self).__init__(display_filter=display_filter, only_summaries=only_summaries,
                                          decryption_key=decryption_key, encryption_type=encryption_type)
        self.bpf_filter = bpf_filter
        
        if interface is None:
            self.interfaces = get_tshark_interfaces()
        else:
            self.interfaces = [interface]
github KimiNewt / pyshark / src / pyshark / capture / live_capture.py View on Github external
"""
        super(LiveCapture, self).__init__(display_filter=display_filter, only_summaries=only_summaries,
                                          decryption_key=decryption_key, encryption_type=encryption_type,
                                          output_file=output_file, decode_as=decode_as, disable_protocol=disable_protocol,
                                          tshark_path=tshark_path, override_prefs=override_prefs,
                                          capture_filter=capture_filter, use_json=use_json, include_raw=include_raw,
                                          eventloop=eventloop, custom_parameters=custom_parameters,
                                          debug=debug)
        self.bpf_filter = bpf_filter
        self.monitor_mode = monitor_mode

        if sys.platform == "win32" and monitor_mode:
            raise WindowsError("Monitor mode is not supported by the Windows platform")

        if interface is None:
            self.interfaces = get_tshark_interfaces(tshark_path)
        elif isinstance(interface, str):
            self.interfaces = [interface]
        else:
            self.interfaces = interface