Skip to content

Instantly share code, notes, and snippets.

@brainstorm
Created September 3, 2022 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainstorm/32d91ceccc824b4153b8c29a70c86ced to your computer and use it in GitHub Desktop.
Save brainstorm/32d91ceccc824b4153b8c29a70c86ced to your computer and use it in GitHub Desktop.
Wireshark EPSON USB printer dissector
usb_printer_epson_protocol = Proto("USB_PRINTER_EPSON", "USB printer EPSON")
local printjob_payload = ProtoField.none("usb_printer_epson.payload", "Payload", base.HEX)
usb_printer_epson_protocol.fields = { printjob_payload }
function usb_printer_epson_protocol.dissector(buffer, pinfo, tree)
length = buffer:len()
--- We are only interested on the 16KB BULK transfers as they contain the PDF being sent?
if length < 10000 then return end
pinfo.cols.protocol = usb_printer_epson_protocol.name
local subtree = tree:add(usb_printer_epson_protocol, buffer(), "USB Printer EPSON")
subtree:add_le(printjob_payload, buffer(0,length))
end
DissectorTable.get("usb.bulk"):add(0xffff, usb_printer_epson_protocol)
@brainstorm
Copy link
Author

brainstorm commented Aug 5, 2023

@brainstorm
Copy link
Author

FTDI FT dissector is pretty good: https://github.com/wireshark/wireshark/blob/master/epan/dissectors/packet-ftdi-ft.c

But has some minor flaws when dissecting the actual payload (i.e 01 00 from a USB dongle serial transfer gets interpreted as line status when in reality is part of the payload).

@brainstorm
Copy link
Author

brainstorm commented Aug 5, 2023

Also, don't fall for the "ifconfig: interface XHC20 does not exist" error when running ifconfig up, see: https://apple.stackexchange.com/a/462852/406377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment