Hello, in the question How can I decrypt SSL session with Lua dissector, a custom Lua dissector is added to the dissector table "usb.bulk". My usecase is similar: I need to dissect a proprietary protocol on top of the USB protocol. But the following instruction (as seen in that question) doesn't seem to do the trick:
Normally I would replace the dissector with my own, keeping a reference to the original one and call that explicitly if needed (like described here) - but I do not know which dissector(s) from that DissectorTable I need to replace. So I am stuck with the following questions:
Any help is much appreciated. Thank you in advance. asked 04 Oct '16, 07:40 patrick_oppe... edited 04 Oct '16, 07:44 |
One Answer:
Handling of USB captures is a bit complex in terms that the possibility to choose a dissector for the payload automatically often depends on whether the enumeration phase has been captured or not, because the "integer" dissector tables refer to values of fields of USB descriptors which are only transferred over the bus during the enumeration phase. So in the particular case of that other Question, the For payloads which follow some characteristic patterns, the choice of dissector is slightly easier, because it is possible to use heuristic to choose the proper dissector even if the enumeration phase is missing in the capture. A heuristic dissector also needs to be registered for a transport protocol, and all heuristic dissectors registered for a given transport are tried on all payload PDUs of that transport until one of them succeeds, with the following exception: if a heuristic dissector for protocol X succeeds on a PDU, it may declare that PDU to be part of a "conversation" of protocol X; doing so makes the transport protocol's dissector invoke the dissector for protocol X on further PDUs with identical address attributes (in our case, the USB address So the first things to do for you is to check what type of USB transfer your proprietary protocol is using, whether the pattern is unambiguous enough that it would be safe to base a heuristic on it. If you cannot rely on heuristic and the transfer used is bulk, find out what answered 04 Oct '16, 09:06 sindy edited 04 Oct '16, 09:10 |
Thank you for your profound answer! It was the 'bInterfaceClass' field I was looking for. When I add my dissector to the dissector table with the value that my capture data contains (0xffff), it gets called properly! If I need to distinguish between different message types, I can ask the development team to provide more specific values for bInterfaceClass.
In combination with 'usb.transfer_type', this already solves my problem, so there is no need for me to write a heuristic dissector (which would have been rather difficult for my protocol, anyway).