SerialPort Sniffing

和自甴很熟 提交于 2020-01-23 02:57:26

问题


I have a device that connects to pc via USB, which gets mapped to virtual serial port by driver and a software, that connects to that serial port and allows me to manage the device. I don't know what protocol software uses to connect with the device. I could figure out the protocol by looking at communication between device and software, but the thing with serial ports is that once software connects to serial port, there is not way other software could connect to that port too (which makes sense of course).

So I thought I could write a piece of software that does following:

  1. connects to virtual serial port the device is at
  2. creates virtual serial port a software would connect to
  3. internally transfers everything from first port to second and vice versa, but logging all this information to some dump file

My question here is: is that possible to create virtual serial port using .NET? I heard no, because you somehow need to create a driver or something and that requires kernel-level programming, is that right? And if that is, still, is there a way I could observe communication between a device and a software without any bridging software?

Thanks in advance! Aaron


回答1:


Have you tried Portmon.

This is what the website says

it's a utility that monitors and displays all serial and parallel port activity on a system. It has advanced filtering and search capabilities that make it a powerful tool for exploring the way Windows works, seeing how applications use ports, or tracking down problems in system or application configurations.

http://technet.microsoft.com/en-us/sysinternals/bb896644

KNOWN ISSUE: There's a bug in PortMon v3.03 (see here) which makes the needed 'Computer' menu item not appear on some systems. One workaround is to connect to local machine in v3.02 before opening v3.03.




回答2:


If the menu Capture / Ports is greyed, this method works:

Start an instance of portmon using portmon /c from command prompt. Then start another one, use ctrl-r with 127.0.0.1 as the address to connect to your own PC.



来源:https://stackoverflow.com/questions/8960384/serialport-sniffing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!