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

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%


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

permanent link

answered 05 Apr '12, 09:48

bstn's gravatar image

bstn
3751415
accept rate: 14%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×637
×431

question asked: 05 Apr '12, 01:22

question was seen: 4,121 times

last updated: 05 Apr '12, 09:48

p​o​w​e​r​e​d by O​S​Q​A