Java PCAP 文件解析器库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26978618/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java PCAP file parser library
提问by Amir Rossert
I'm looking for a fast way to parse PCAP file packets.
我正在寻找一种解析 PCAP 文件包的快速方法。
I'm currently using jNetPcaplike so:
我目前正在使用jNetPcap,如下所示:
Pcap pcap = Pcap.openOffline(file, errbuf);
pcap.loop(10, jpacketHandler, "jNetPcap rocks!");
But it is pretty slow, is there any other good Java libraries that can parse PCAP files?
但是它很慢,有没有其他好的Java库可以解析PCAP文件?
采纳答案by Alexandro González
Just stumbled upon pcap parsing task in Java and found a pcap parser in Kaitai Struct. Surprisingly, it turns out to be blazing fast — probably because it's not a wrapper over C pcap library, but just a raw parser instead. My average results (on the same box, of course) are as following:
刚刚在 Java 中偶然发现了 pcap 解析任务,并在 Kaitai Struct 中找到了一个pcap 解析器。令人惊讶的是,结果证明它非常快——可能是因为它不是 C pcap 库的包装器,而只是一个原始解析器。我的平均结果(当然是在同一个盒子上)如下:
- jpcap - 10,301 pps
- jnetpcap - 15,148 pps
- pcap.ksy in Kaitai Struct - 121,176 pps
- jpcap - 10,301 页
- jnetpcap - 15,148 页
- 开泰结构中的 pcap.ksy - 121,176 pps
So, if you don't need capturing, I wholeheartedly recommend trying out Kaitai Struct parser.
所以,如果你不需要capture,我衷心推荐你尝试 Kaitai Struct 解析器。