Skip to content

Instantly share code, notes, and snippets.

@brainstorm
Created September 3, 2022 14:31
Show Gist options
  • Select an option

  • Save brainstorm/32d91ceccc824b4153b8c29a70c86ced to your computer and use it in GitHub Desktop.

Select an option

Save brainstorm/32d91ceccc824b4153b8c29a70c86ced to your computer and use it in GitHub Desktop.

Revisions

  1. brainstorm created this gist Sep 3, 2022.
    19 changes: 19 additions & 0 deletions usb_printer_epson_wireshark_dissector.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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)