This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Can’t get tcp.port of packet in lua

0

Hello how can i get a tcp.port of packet in lua?

asked 05 Apr '12, 01:22

Zvika's gravatar image

Zvika
6224
accept rate: 0%


One Answer:

1

Use pinfo.src_port or pinfo.dst_port.

From a dissector:

function proto_foo.dissector(buf, pinfo, tree)
    print('src_port', pinfo.src_port)
    print('dst_port', pinfo.dst_port)
end

From a tap:

function tap.packet(pinfo, buf)
    print('src_port', pinfo.src_port)
    print('dst_port', pinfo.dst_port)
end

answered 05 Apr '12, 09:48

bstn's gravatar image

bstn
3751415
accept rate: 14%