使用python scrip将Pcap文件转换为文本

2024-05-02 04:17:39 发布

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

我使用下面的代码将带有给定列的pcap file转换为text file。输出文本文件。代码不给出任何错误,它给出输出,但它给出空的,没有任何数据。你能帮我找出错误吗

from scapy.all import *
data = "Emotet-infection-with-Gootkit.pcap"
a = rdpcap(data)
os.system("tshark  -T fields -e _ws.col.Info -e http -e frame.time -e  "
      "data.data -w Emotet-infection-with-Gootkit.pcap > Emotet-infection-with-Gootkit.txt -c 1000")
os.system("tshark -r Emotet-infection-with-Gootkit.pcap -Y http -w Emotet-infection-with-Gootkit.pcap")
sessions = a.sessions()
i = 1
for session in sessions:
 http_payload = ""

Tags: 代码texthttpdataos错误withpcap