Skip to content

Instantly share code, notes, and snippets.

@z4yx
Forked from anonymous/ble_cc2540dongle.lua
Last active January 14, 2018 10:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save z4yx/c8038d4b4e7da42efc0a to your computer and use it in GitHub Desktop.
Save z4yx/c8038d4b4e7da42efc0a to your computer and use it in GitHub Desktop.
-- =================================================
--
-- =================================================
proto = Proto("tible","TI BLE CC2540Dongle")
-- =================================================
-- Read reserve other protocol fileds
-- =================================================
usb_transtype_f = Field.new("usb.transfer_type") -- BULK=0x03
usb_datalen_f = Field.new("usb.data_len")
usb_capdata_f = Field.new("usb.capdata")
-- =================================================
-- fields
-- =================================================
first_F = ProtoField.uint32("tible.first", "first byte")
proto.fields = { first_F }
-- =================================================
-- dissector
-- =================================================
function proto.dissector(buffer, pinfo, tree)
if usb_datalen_f() and usb_transtype_f().value == 0x03 then
local start = buffer:len() - usb_datalen_f().value
--orig_ble_dis:call(buffer(start + 8):tvb(), pinfo, tree)
local buflen = usb_datalen_f().value - 10
if buflen > 0 then
pinfo.cols.info = "BLE:"
local blebuf = buffer(start + 8, buflen)
orig_ble_dis:call(blebuf():tvb(), pinfo, tree)
else
pinfo.cols.info = "BLE unknown"
orig_ble_dis:call(buffer(start + 8):tvb(), pinfo, tree)
end
end
end
-- BT LE LL Dissector
ble_table = DissectorTable.get("wtap_encap")
orig_ble_dis = ble_table:get_dissector(155)
-- =================================================
-- Register
-- =================================================
register_postdissector(proto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment