desowin / usbpcap

USB packet capture for Windows
http://desowin.org/usbpcap
902 stars 170 forks source link

How do I replay usbpcap file or each packet one by one? #46

Closed vcidst closed 5 years ago

vcidst commented 6 years ago

I have a pcap file generated by sniffing usb interaction with a hardware that I want to reverse engineer. How do I send exactly the same packets again to the device (replay packets) using either python (pyusb) or C?

Here's a link to part of the data dump that contains 20 packets

desowin commented 5 years ago

The linked data dump is not generated by USBPcap. Based on that dump, it is impossible to tell to which endpoint the data was being directed. PipeHandle 0xffffe3884a84d7d8 can really mean any endpoint of the device.

USBPcap does keep track of pipe handles when they are opened and uses that information to fill USBPcap pseudoheader with the actual endpoint information.

Once you know the endpoint, you simply read or write data to the endpoint using the bulk transfer (all transfers in the linked dump are bulk transfers).