从USBPcap库读取原始数据
Read raw data from USBPcap library
我使用USBPcap来捕获USB设备驱动器和操作系统之间传输的数据,但它会将数据保存在.pcap
文件中,该文件只能由Wireshark自己读取。我进入USBPcap源代码,但因为我不知道任何关于Windows API的信息,我无法理解源代码,只是在调试时发现了这个文件:
https://github.com/desowin/usbpcap/blob/master/USBPcapCMD/thread.c#L177
我需要原始数据,而不是.pcap
编码的文件。我怎么能得到它?
.pcap
文件格式很简单,最简单的解决方案是自己解析或使用现有库:https://wiki.wireshark.org/Development/LibpcapFileFormat
USBPcap使用上述格式:https://github.com/desowin/usbpcap/blob/37a8e3cf12234df96a7e101eec336085dbb3e4c7/USBPcapDriver/include/USBPcap.h#L63
文件头为:
typedef struct pcap_hdr_s {
UINT32 magic_number; /* magic number */
UINT16 version_major; /* major version number */
UINT16 version_minor; /* minor version number */
INT32 thiszone; /* GMT to local correction */
UINT32 sigfigs; /* accuracy of timestamps */
UINT32 snaplen; /* max length of captured packets, in octets */
UINT32 network; /* data link type */
} pcap_hdr_t;
每个数据包的格式为:
typedef struct pcaprec_hdr_s {
UINT32 ts_sec; /* timestamp seconds */
UINT32 ts_usec; /* timestamp microseconds */
UINT32 incl_len; /* number of octets of packet saved in file */
UINT32 orig_len; /* actual length of packet */
} pcaprec_hdr_t;
相关文章:
- C++将文本文件中的数据读取到结构数组中
- C++:将值赋值给原始数据类型(例如布尔值)是原子操作吗?
- 为 Sql 服务器实现 odbc 包装器.将数据库数据读取为字符或要求驱动程序将数据转换为 C 类型
- 从USBPcap库读取原始数据
- BoostSpirit.Qi-针对原始数据类型进行边界检查
- Qt - 将空指针(原始数据)转换为 QImage 并将其显示在标签上
- 使用 QDataStream 对原始数据进行反序列化
- 当原始数据是常量时,修改指针指向的位置是 UB 吗?
- IMAGE_SECTION_HEADER的虚拟地址和指针到原始数据的差异
- 如何将来自文本文件的数据读取到结构的int阵列中
- 直接从 RAM 发送原始数据
- MEX C++原始数据访问
- 服务器客户端通过原始数据错误C 发送接收结构
- 如何从C 中的卷曲中获取原始数据
- 在C/C 中创建和发送原始数据包
- 如何捕获麦克风缓冲区原始数据
- 将sqlite原始数据读取到qbyTearray
- 使用QDataStream读取/写入原始数据
- 读取扫描器原始数据从usb
- 如何在mac os中从磁盘读取原始数据