I have a device which when a certain application is on send data to that application. I need to take a sniff that data and retrieve certain information which is not being shown. The device is custom and for one reason or another has no data sheets. So have to sniff the communication and reconstruct the commands being sent from the application to this device. So I would like to accomplish this in C# or C++. Right now I have tried every sniffing software and yes they sniff it but I want to be able to this live and retrieve the data and present it live.
开发者_运维百科Thank you
The easiest way to do this is to put your software in between the device and the other software. Then, pass-through all of the data, capturing out whatever you need.
To do this, you would need to utilize serial port loopback software. There is a lot of it out there. See http://www.virtual-serial-port.com/virtual-serial-port-kit.html. I personally have used a product from GPSGate, but I believe there are free loopback drivers available.
A more complicated (but more passive!) method is to monitor IOCTLs. I can't direct you how to do this, as I do not know, but it is something to look into. The software at http://www.serial-port-monitor.com/ uses this method.
An alternative piece of software giving you virtual serial ports is com0com (http://com0com.sourceforge.net/). However, it also has a hub functionality where the output of the device can be sent to many applications, which might or might not be useful to you depending on whether you just need to monitor the output from the device or in both directions.
If nothing else it might give you some open source code to base your own sniffer on if you go down the device filter route. But if you go down that route you might need to look at driver signing if you need it to work on 64 bit versions of Windows 7.
精彩评论