[英]How do I intercept messages from a USB device on Linux?
I have a popular drawing tablet that I connect to my PC with USB.我有一个流行的绘图板,我通过 USB 连接到我的 PC。 Once connected, the tablet detects hand movements and manipulates the pointer accordingly.
连接后,平板电脑会检测手部动作并相应地操纵指针。 Somewhere, the tablet is transmitting this data to my computer.
某处,平板电脑正在将此数据传输到我的计算机。
My goal is to intercept these transmissions and manipulate the mouse after I process the data.我的目标是在处理数据后拦截这些传输并操纵鼠标。 The buzzwords I have found are: device drivers and HID , but I haven't been able to piece together much more than that.
我发现的流行词是:设备驱动程序和HID ,但除此之外我还没有能够拼凑出更多的东西。
Assuming this is possible, I have a few questions:假设这是可能的,我有几个问题:
My computer is running Ubuntu (but answers related to any form of a Linux OS are greatly appreciated!).我的计算机正在运行 Ubuntu(但非常感谢与任何形式的 Linux 操作系统相关的答案!)。
Note: This question is similar but intended for Windows.注意:此问题类似,但适用于 Windows。
Actually you missed a buzzword " USB sniffing ".实际上,您错过了一个流行词“ USB 嗅探”。 ;-)
;-)
Here are a few tutorials on USB sniffing on Linux, to get you started.这里有一些关于 Linux 上 USB 嗅探的教程,可以帮助您入门。
Essentially you use the usbmon
Linux kernel module to capture the USB-packets and Wireshark as a front-end to display and analyse the captured USB stream.本质上,您使用
usbmon
Linux 内核模块来捕获 USB 数据包,并使用Wireshark作为前端来显示和分析捕获的 USB 流。
To add another useful resource: Kernel manual for usbmon添加另一个有用的资源: usbmon 的内核手册
You can use the following commands on Debian Linux to view debug log for usbmon in text format using usbmon Kernel's built in usb monitoring:您可以在 Debian Linux 上使用以下命令使用 usbmon 内核的内置 usb 监控以文本格式查看 usbmon 的调试日志:
$sudo -i
to use root $sudo -i
使用 root#modprobe usbmon
#ls /sys/kernel/debug/usb/usbmon
to view bus sockets #ls /sys/kernel/debug/usb/usbmon
查看总线套接字#cat /sys/kernel/debug/usb/devices
to view devices at each bus socket #cat /sys/kernel/debug/usb/devices
查看每个总线套接字的设备#cat /sys/kernel/debug/usb/usbmon/<bus socket>
to view or you can route stdout to a file using >
#cat /sys/kernel/debug/usb/usbmon/<bus socket>
查看或者您可以使用>
标准输出路由到文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.