pyshark.tshark.tshark.TSharkNotFoundException:未找到tshark

2024-10-17 06:13:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在MACOX Catlina上使用pyshark运行下面的代码,当我运行它时,我得到下面的异常(我也使用sudo运行下面的程序,如果它是由于权限问题,但给我相同的错误)

    "Searched these paths: {}".format(possible_paths)
pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Searched these paths: ['C:\\Program Files\\Wireshark\\dumpcap.exe', '/usr/local/bin/dumpcap', '/usr/bin/dumpcap', '/bin/dumpcap', '/usr/sbin/dumpcap', '/sbin/dumpcap', '/opt/X11/bin/dumpcap']
import pyshark

class SniffPacket(object):
    
    def __init__(self):
        self.sniff()
    
    
    def sniff(self):
        capture = pyshark.LiveCapture(interface='en0')
        capture.sniff(timeout=10)
            
if __name__ == '__main__':
    s = SniffPacket() 

我已经安装了wireshark。感谢您的帮助。是不是因为pyshark在Mac上不工作


Tags: selfbinusrdefcapturepathspysharktshark
1条回答
网友
1楼 · 发布于 2024-10-17 06:13:41

打开config.ini文件并将tshark路径更改为tshark.exe所在的路径。(为Windows工作) 如果这不起作用,请尝试将dumpcap路径也更改为存储dumpcap.exe的位置

相关问题 更多 >