我需要使用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")
我得到了一个结果文件,但它是空的。
有人能帮帮我吗?
发布于 2019-08-02 20:29:17
当我将命令改为以下命令时,它可以正常工作:
os.system("tshark -r mirai.pcap -T fields -e ip.src -e frame.len -e ip.proto -E separator=, -E occurrence=f > traffic.csv")
这就是将separatorr
更改为separator
。
我通常使用package pyshark
(https://pypi.org/project/pyshark/)来处理python中的pcap文件。
发布于 2020-01-30 19:33:25
这是一个最简单的方法(在我看来)
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上测试
https://stackoverflow.com/questions/57326230
复制相似问题