Ask Your Question
0

Cannot locate HART-IP in LUA

asked 2023-05-11 19:10:58 +0000

Hi, Team

I am building a custom LUA dissector invoking a built-in HART-IP dissector embedded with Dissector.get("hart-ip") command but it returns nil (nothing). I'HART-IP is also missing in Dissector.list() output.

Is there any to call HART-IP dissector in LUA ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-13 12:57:32 +0000

Chuckc gravatar image

updated 2023-05-13 13:00:27 +0000

POC (possibility for improvement?)

easypost_hartip_f = Field.new("hart_ip")

    local hartip_fi = easypost_hartip_f()
    local tcp_dtable = DissectorTable.get("tcp.port")
    tcp_dtable:try(5094, tvb:range(hartip_fi.offset):tvb(), pinfo, tree)
edit flag offensive delete link more

Comments

Hi!

Thanks, but the first line returns error "bad argument #1 to 'new' (Field_new: a field with this name must exist)"

Yevgeny Bakalenko gravatar imageYevgeny Bakalenko ( 2023-05-15 07:43:57 +0000 )edit

11.4.1. Field:

A Field object can only be created outside of the callback functions of dissectors, post-dissectors, heuristic-dissectors, and taps.

11.4.2. FieldInfo:

A FieldInfo object can only be used within the callback functions of dissectors, post-dissectors, heuristic-dissectors, and taps.

Are you accessing it inside a dissector or tap? Will not work in the Lua->Evaluate window.

Chuckc gravatar imageChuckc ( 2023-05-15 13:06:50 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2023-05-11 19:10:58 +0000

Seen: 78 times

Last updated: May 13 '23