usb sniffing with wireshark - usb

at the moment I am using usbmon to sniff usb. for better understandability I want to use wireshark. I've used wireshark before for sniffing ethernet packets. But what to capture to sniff USB Packets ? I meant I need to start by selecting which interface to capture in wireshark. but what wold I select there for usb ?

Grab newest wireshark.
Use lsusb before and after plugin in device so You know which usb bus its plugged into.
type in terminal:
su -c "modprobe usbmon" && su -c "wireshark"
(First load kernel module that allow for usb sniffing for root, second load wireshark as root)
Than select usbmonX, where X stand for usb bus number (lsusb show those numbers).
After than you still need to filter packets for device / vendor id, or something else device specific, as wireshark will show all packets from all devices plugged into that bus. (Again lsusb before/after plugging you device will help).

Have you taken a look at the documentation for that on the Wireshark website?
In libpcap 1.0.x, the devices for capturing on USB have the name usbn, where n is the number of the bus. In libpcap 1.1.0 and later, they have the name usbmonn.

a quick notice since I just started using wireshark to sniff usb packets on linux. as I understand you need usbmon module loaded (which if you are using it should be). Additionally I seem to recall that while wireshark can be setup to let non root users sniff ethernet packets, some limitation required root access for usb packs (at least at the time of writting).
Similar to what others have said, on my system, Ubuntu 12.10, the usb interfaces have names like "usbmon1 USB bus number 1" and so forth.
(you might look at http://biot.com/blog/usb-sniffing-on-linux)
the link listed has an image showing a filter which can be used to select only traffic to from a device number (from lsusb).
I hope thats helpful

#przemo_li You want to filter by device address to see the communication from both the host and the device. The filter for that is usb.device_address ==.

Related

Payload of captured USB packets is always all-zero in Big Sur M1

I am monitoring USB traffic with Wireshark in the interface XHC2. However, the payload of all USB packets is all-zero. The packet's length is correct, but the packet's payload is all zero. It does not matter which device, which packet or whichever. It is always zero. Obviously, this is not the reality, since the devices work properly and lot of information is displayed via lsusb.
My guess is that the XHC interface is setting the payload to 0 before delivering to upper layers, but I do not know if it is intentionally, a bug, kernel issue, my fault or something related with Wireshark.
I also tried tcpdump -i XHC2 and the saved pcap file is the same.
Additional info:
Mac Mini M1 with Big Sur
Wireshark ARM 3.6
SIP disabled
It's unlikely to be related to Wireshark, given that it happened when you captured with tcpdump as well.
You should file an issue on Apple's Feedback Assistant.

How does USB integration work from the device end?

Hopefully I will have more luck today. I have no prior USB integration and about 8 months of learning embedded systems on Atmel devices. I am trying to use an Atmel SAM L series to connect over USB to a computer. The use case is for data transfer. Specifically, the MCU will be gathering data from it's sensors and packaging it for USB transfer.
I have searched through and read up on all of Atmel's included USB examples. I have also started reading through usb.org's class specifications for CDC.
I have running now something that lets me send data along one com port, into the target usb and then out the debugger usb to another com port. However, I don't think this is real USB.
My problem is two fold.
1.) I do not fully understand what differentiates USB from serial communication on a com port.
2.) Even if I were doing it correctly, I'm not sure how to test and verify that I have indeed created a legitimate USB device that can be accepted by a host computer.
Links to documentation(Atmel or generic) or example code would be appreciated.
1) USB is defined in the USB specifications from http://www.usb.org. Serial ports were an older and simpler interface that involved sending data back and forth asynchonously on pins with names like TX and RX. The USB CDC class and its ACM subclass allow you to make a USB device that emulates a serial port. If you make your device be a USB CDC ACM device, then you don't need to supply any drivers for Windows 10, Linux, or Mac OS X.
2) You can read the USB specification and the CDC ACM specification. You can run the USB command verifier. You can test your device with a variety of different USB hosts to make sure it works.

Mimic USB Vendor or Product ID

After having been studying a USB Packet Sniffer based around the BeagleBoard xM (https://gitorious.org/beagleboard-usbsniffer/), I have been at a loss as to how the driver actually works in a certain area.
I now understand that the BeagleBoard acts as a one port USB hub for the USB host to see, so that it may view and log the packets going through it. The part i'm trying to currently understand is how exactly the BeagleBoard is able to be somewhat transparent, and able to mimic the USB Vendor/Product ID's of the device being sniffed.
There is nothing to mimic. If it behaves as a hub, it can see all the traffic going between the computer and the device under test because all the USB packets would go through the hub. Packets are received by the hub and transmitted along to the other device.

OpsView/Nagios SNMP USB device monitoring

Is there any way to monitor USB devices, connected to the server in Opsview Core?
Or there is any software that I can install to make SNMP possible for USB devices?
Some of the USB security dongles often disconnects by themselves. The point is to have notifications when they lost.
Thanks!
If your USB dongles are connected to the Opsview Server, and if this server is running Linux (i don't know much about Opsview except that it can use nagios plugins), it would probably need only a few lines of code to write a plugin that parses /proc/bus/usb/devices or the output of lsusb and checks for the vendor id / product id / product name of the USB dongles.

Logitech Unifying Receiver Protocol?

Is there a place where I can find documentation or an SDK about the Logitech Unifying Receiver?
I recently obtained a wireless mouse, which came with a Logitech Unifying Receiver (a small USB dongle that plugs into the computer and communicates with the mouse/other compatible devices (such as keyboards)).
I wanted to try writing an app for my smartphone that pretends to be a mouse and sends data to the receiver.
I was able to monitor the data from the USB bus by using usbmon, and could probably use that to hack something out, but wanted to know if I could find the info I need somewhere on the internet without having to derive it on my own.
I'm going to try using SL4A on Android, if that helps any.
I have discovered some Logitech documents on a shared folder in Google Docs via this Chromium bug report. For convenience, I converted all doc(x) files to PDFs and put those on https://lekensteyn.nl/files/logitech/.
You will find Logitech HID++ 1.0 Specification for Unifying Receivers (pdf) very interesting, it describes the USB traffic (instead of the 2.4GHz wireless traffic as noted by Avery). My article Logitech Unifying for Linux: Reverse Engineering and unpairing tool documents a way to capture the traffic with usbmon and QEMU. It also includes tools to make the usbmon output prettier to read (for this protocol).
This is Avery, aka Tequals0. The USB dongle is a USB HID mouse/keyboard device, so all that traffic that you are seeing is basically generic HID traffic- if you want to pair your phone to your dongle, you will have to emulate the wireless traffic, not the USB traffic-that is generated by the dongle.
There is some info at Tequals0 blog, and AveryLouie also got some python tool operating with unifying