How to use the pyshark.tshark.tshark.get_process_path 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_path(mock_exists):
    mock_exists.return_value = True
    actual = get_process_path("/some/path/tshark")
    expected = "/some/path/tshark"
    assert actual == expected
github KimiNewt / pyshark / src / pyshark / capture / live_capture.py View on Github external
async def _get_tshark_process(self, packet_count=None, stdin=None):
        read, write = os.pipe()

        dumpcap_params = [get_process_path(process_name="dumpcap", tshark_path=self.tshark_path)] + self._get_dumpcap_parameters()

        self._log.debug("Creating Dumpcap subprocess with parameters: %s" % " ".join(dumpcap_params))
        dumpcap_process = await asyncio.create_subprocess_exec(*dumpcap_params, stdout=write,
                                                               stderr=self._stderr_output())
        self._created_new_process(dumpcap_params, dumpcap_process, process_name="Dumpcap")

        tshark = await super(LiveCapture, self)._get_tshark_process(packet_count=packet_count, stdin=read)
        return tshark
github KimiNewt / pyshark / src / pyshark / capture / capture.py View on Github external
def _get_tshark_path(self):
        return get_process_path(self.tshark_path)