Ask Your Question

DanS's profile - activity

2023-04-04 18:42:08 +0000 received badge  Notable Question (source)
2023-04-04 18:42:08 +0000 received badge  Popular Question (source)
2021-06-11 15:21:57 +0000 asked a question dissector byte swap words in double field

dissector byte swap words in double field Hi, I am writing a dissector using lua for data that contains 64-bit floating

2021-04-29 15:01:30 +0000 commented answer lua dissector not a TreeItem!

Thank you ChuckC. I had been checking that the members had been correctly spelt etc. but this detail escaped my checks.

2021-04-29 14:59:18 +0000 marked best answer lua dissector not a TreeItem!

Hi, I am using lua to write a dissector for my own message format, and I get "not a TreeItem" part way through my data

With the TCP payload data :

46 49 4e 53 00 00 00 1a 00 00 00 02 00 00 000080 00 07 00 1a 00 00 01 00 20 01 01 82 07 d0 00 00 b8

and my dissector

fins_proto = Proto("FINS", "FINS protocol")

fins_proto.fields.header     = ProtoField.string("fins.header", "Header")
fins_proto.fields.length     = ProtoField.uint32("fins.length", "Length")
fins_proto.fields.command    = ProtoField.uint32("fins.command", "Command", base.HEX)
fins_proto.fields.tcpErr     = ProtoField.uint32("fins.tcpErr", "TCP Err", base.HEX)
fins_proto.fields.icf        = ProtoField.uint8("fins.icf", "ICF", base.HEX)
fins_proto.fields.rsv        = ProtoField.uint8("fins.rsv", "RSV", base.HEX)

function fins_proto.dissector(buffer, pinfo, tree)

    local subtree = tree:add(fins_proto, buffer(), "FINS Protocol Data")
    subtree:add(fins_proto.fields.header, buffer(0,4))
    subtree:add(fins_proto.fields.length, buffer(4,4))
    subtree:add(fins_proto.fields.command, buffer(8,4))

    pinfo.cols.protocol = "FINS"
    subtree.add(fins_proto.fields.tcpErr, buffer(12,4))
    subtree:add(fins_proto.fields.icf, buffer(16,1))
    subtree:add(fins_proto.fields.rsv, buffer(17,1))
end

tcp_table = DissectorTable.get("tcp.port")
tcp_table:add(8085, fins_proto)

I get the output

FINS Protocol Data
       Header: FINS
       Length: 26
       Command: 0x00000002
Lua Error: [string "fins2.lua"]:18: not a TreeItem!

If I comment out line 18 -- subtree.add(fins_proto.fields.tcpErr, buffer(12,4)) then I can proceed through the dissection.

FINS Protocol Data
       Header: FINS
       Length: 26
       Command: 0x00000002
       ICF: 0x80
       RSV: 0x00

Please can someone tell me what a TreeItem is, and what I am doing wrong here?

many thanks dan

2021-04-29 14:59:18 +0000 received badge  Scholar (source)
2021-04-29 14:03:45 +0000 asked a question lua dissector not a TreeItem!

lua dissector not a TreeItem! Hi, I am using lua to write a dissector for my own message format, and I get "not a TreeIt