python - pyshark.tshark.tshark.TSharkNotFoundException: 找不到 TShark
问题描述
我正在尝试在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 上运行吗?
解决方案
打开 config.ini 文件,将 tshark 路径更改为你的 tshark.exe 所在的路径。(适用于 Windows)如果这不起作用,请尝试将 dumpcap 路径也更改为存储 dumpcap.exe 的位置。
推荐阅读
- google-sheets-api - 在哪里可以找到 Google Sheets gRPC API 文档(不是 REST)
- python-3.x - 如何通信两个 python 文件,以便一个在另一个通过控制台读取之前打印(交互式)
- python - 从计数器列表中提取公共键
- android - 包含自定义视图时未传递 Android 数据绑定数据
- kdb - 检索表中日期前 10 天的所有条目,与 where 子句匹配
- html - 将 3 个 Div 与位置并排对齐:固定
- node.js - 使用 Node.js 根据时间重命名图像数组
- c# - 在 Unity 中将球移动到随机坐标
- sql-server - 与 SQL Server 建立连接时出现与网络相关或特定于实例的错误的 Azure AD SQL 身份验证
- ssh - 从 linux 到 windows 的 ssh 只能通过密码而不是密钥工作