python - 如何使用 python 将 pcap 转换为 CSV
问题描述
我需要使用 python 代码将驱动器上的 pcap 文件转换为 csv 文件(我知道如何使用 wireshark UI 进行操作),但我需要通过 python 代码来完成,
我已经尝试过这段代码:
import os
os.system("tshark -r mirai.pcap -T fields -e ip.src -e frame.len -e ip.proto -E separatorr=, -E occurrence=f > traffic.csv")
我得到一个结果文件,但它是空的。
谁能帮助我。
解决方案
这是最简单的方法(在我看来)
os.system ('tshark -r'+in_file +'>'+ out_file +'.txt')
在哪里
in_file = <name of your pcap file>
out_file = <name of your output file>
PS:仅在 python 3 上测试
推荐阅读
- amazon-web-services - 地形 | 秘密经理 | 重复使用现有的秘密而不删除
- rest - 如何使用rest api将数据集作为csv文件导入到power bi?
- java - 通过 HTTP 的 Java 流对象:异常处理的一些最佳实践?
- html - CSS 自适应样式 - 在没有定义高度的情况下向侧边栏添加滚动
- java - 如何使用 Java/JavaFX 代码读取第二个数组上的 JSON 对象
- google-app-engine - 通过云构建更新 appengine 应用程序的任务队列失败并显示 PERMISSION_DENIED
- java - 方法总是返回空列表
- php - 使用 Avada 删除特定产品的 WooCommerce 产品选项卡
- javascript - 使用绝对定位(不重复)在悬停另一个 div 时更改 div 的外观
- node.js - 如何在 node.js 中正确排序异步函数?