在python中解析大型tcpdump文件 [英] Parsing large tcpdump files in python

查看:39
本文介绍了在python中解析大型tcpdump文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的 tcpdump 捕获(在 .dump 文件中有 > 1gb 的数据),我想对其进行解析以获取一些统计信息,例如发送流量所涉及的不同 IP 的数量等.我想知道是否有一种干净的方法可以通过 python 访问二进制跟踪文件中的此类数据吗?我尝试这样做的方式是运行tcpdump -r something.dump >myfile.out然后尝试使用 python 代码解析 myfile.out 以获取我想要的数据.但是上面的命令需要很长时间才能完成,并且希望使用更好的方法来执行此操作.

I have a large tcpdump capture ( with > 1gb of data in a .dump file) which I would like to parse to get some statistics like the number of different IPs involved in sending traffic, etc. I would like to know if there is a clean way of accessing such data in the binary trace file through python? The way I tried doing it is by running tcpdump -r something.dump > myfile.out And then try to parse myfile.out with python code to get the data i want. But the command above is taking forever to complete and would like to use a better way of doing this.

Wireshark 在尝试打开文件时内存不足.

Wireshark runs out of memory while trying to open the file.

推荐答案

看看dpkt 模块.它应该能够按需解析 pcap 文件.Jon Oberheide 有一个很棒的 博客帖子展示了如何访问 pcap 数据包捕获文件中的数据包的解析表示.

这篇关于在python中解析大型tcpdump文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆