USB RS-232 Serial Port monitoring/sniffing
I have a radio connected via a USB serial port to my Ubuntu box. Software on the Linux box manipulates the radio and the raio sends back lots of information like signal strength.
I need to capture the traffic going in anf out of the USB port. I can get lots of statistics using the "cat usbmon" approach but I have not discovered any way to capture the actual data. Any Suggestions? Thanks, Mike |
Welcome.
Does it show up as something like /dev/ttyUSB0 on your system? If so, then it can be treated like a regular serial port. Then you could whip up something easy with perl using Device::SerialPort, though I expect that there is probably something similar for Python if that is more familiar to you. |
Thanks!
The Unix device is /dev/usbtty0
Perhaps I did not make the problem clear: The port is connected to an RS-232 cable which is connected to the radio at the other end. I can not use a simple Perl script because the the port is already mounted by the radio's software running on the computer. What I need is a peice of code that will report back to me what is going up and down that rs232 cable. I think of it like a Tee where the data goes up and down the cable but I need to tap/sniff the data. Mike |
Nothing as simple as tee, but I was recently at a conference where a new (as in kernel 4.9+ only) kernel probing framework was demonstrated. The presenter has for example a tool that is used to snoop another tty. Everything displayed on the target was replicated on the snooper.
Used eBPF to inject a kprobe - needs pyhon/lua code to inject c code for the intercept and knowledge of the (kernel) function being probed and its parameters. Not simple, but probably a template for what you are planning. The video of the presentation is here. He should have links at the end, but this is the home page of bcc, the userspace compiler collection that takes that python/lua and generates the probe for you. Have fun - I have. |
@syg00:
Thanks. Yes, that is what I am looking for but I guess I don't understand why such a tool does not already exist. Huh... Mike |
There is apparently jpnevulator in the repositories of at least the Debian-based distros which might do the job, but I haven't tried that yet. There are also some tricks you can do with socat but I've gotten mixed results from that route.
|
@Turbocapitalist:
That's it! it took me a while to get it running, anf I have not totally certified the output, but it does appear that this is giving me access to the serial ports. Thanks. I do not know how to give you credit or points on thos forum but I am happy to. Mike |
All times are GMT -5. The time now is 09:04 AM. |