如何以编程方式将IP包字节写入PCAP文件格式? [英] How to programmatically write IP packet bytes into PCAP file format?

查看:245
本文介绍了如何以编程方式将IP包字节写入PCAP文件格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一组代表IP数据包的缓冲区,如何生成PCAP文件?我正在寻找一个用C / C ++或Java做的API。

Assuming that I have a set of buffers that represents an IP packet, how can generate a PCAP file? I'm looking for an API to do this in C/C++ or Java.

推荐答案

jnetpcap 包括类 PcapDumper 会将一个字节数组写入pcap文件,如此处记录

jnetpcap includes the class PcapDumper which will write an array of bytes to a pcap file as documented here.

[原始提问者注意:这个答案被低估了,因为我回答了你的问题,并批评其他人提出了一个合理的问题,而不是因为答案实际上是错在任何方面]

[note to original questioner: this answer was downvoted because i answered your question, and criticised others for closing a reasonable question, not because the answer is actually wrong in any way]

这篇关于如何以编程方式将IP包字节写入PCAP文件格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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