Skip to content

Instantly share code, notes, and snippets.

@kyab
Created October 21, 2019 03:29
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 kyab/fd4a7af16f1dcdfa597628519c3e6d45 to your computer and use it in GitHub Desktop.
Save kyab/fd4a7af16f1dcdfa597628519c3e6d45 to your computer and use it in GitHub Desktop.
snmpex_proto = Proto("snmpex","My SNMP Extension")
snmpex_proto.fields.location = ProtoField.string("snmpex_proto.location","Location")
-- create a function to dissect it
function snmpex_proto.dissector(buffer,pinfo,tree)
print("mydissector get called!(print)")
pinfo.cols.protocol = "SNMPEX"
local subtree = tree:add(snmpex_proto, buffer(), "My SNMP Extension")
-- subtree:add(snmpex_proto.fields.location, location, tostring(buffer()))
subtree:add(snmpex_proto.fields.location, buffer())
end
oid_table = DissectorTable.get("snmp.variable_oid")
oid_table:add("1.3.6.1.2.1.1.6.0",snmpex_proto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment