Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7444333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:29:14+00:00 2026-05-29T11:29:14+00:00

I would like to do some analysis on top of my custom protocol that

  • 0

I would like to do some analysis on top of my custom protocol that is dissected via my lua dissector. Therefore I tried to do this

myproto_proto = Proto("myproto", "Myproto Protocol")
m_dest = ProtoField.uint16("myproto.dest", "Destination", base.HEX)
m_src = ProtoField.uint16("myproto.src", "Source", base.HEX)
myproto_proto.fields = { sm_dest, sm_src }

dofile(MYPROTO_PROTO_PATH.."parser.lua")

function myproto_proto.dissector(buffer, pinfo, tree)
   pinfo.cols.protocol = "MYPROTO"

   local subtree = tree:add(myproto_proto, buffer(), "Myproto Protocol Data")
   parse_msg(buffer, pinfo, subtree) -- does the actual parsing and sets the fields
end

udp_table = DissectorTable.get("udp.port")
udp_table:add(9000,myproto_proto)

-- LISTENER / TAP

f_test = Field.new("myproto.dest") -- fails because "field does not exist"
local function my_tap()
   local window = TextWindow.new("Myproto Tap")
   local tap = Listener.new(nil, "myproto")

   local counter = 0
   function remove()
      tap:remove()
   end

   window:set_atclose(remove)

   function tap.packet(pinfo, buffer)
      counter = counter + 1
   end

   function tap.draw(t)
      window:append("Counter: \t" .. counter .. "\n")
   end

   function tap.reset()
      window:clear()
      counter = 0
   end
   retap_packets()
end

register_menu("My Tap", my_tap, MENU_TOOLS_UNSORTED)

My problem is, I’m unable to access the dissected data with a field extractor. So how else could I get the dissected data in my lua tap?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:29:18+00:00Added an answer on May 29, 2026 at 11:29 am

    It’s a known problem that custom Lua Field objects aren’t usable in OSX (it apparently works in Windows XP but not Windows 7).

    There are a few ways to pass data from your dissector to your tap.


    Option 1: Use a shared Lua table

    1. Create a global dictionary that is keyed by the packet number (from pinfo.number, which is visible to both dissector and tap).

      -- we omit the 'local' keyword to make `dict` a global variable
      dict = {}
      
    2. In your dissector, add the packet data to the dictionary:

      dict[pinfo.number] = { dest = m_dest, src = m_src }
      
    3. In your tap, you can access the data by a simple lookup.

      print('dest', dict[pinfo.number].dest )
      

    XXX: Requires a global; Duplicates storage for a variable that is already held in the protocol tree (and should be accessible from the tap).


    Option 2: Use pinfo.private

    This was added in the dev build (1.7.0). It’s similar to the solution above. pinfo.private is a PrivateTable, which is a hash table that stores only strings.

    1. In your dissector, add your data to the packet’s private table:

      pinfo.private["src"] = tostring(m_src)
      pinfo.private["dest"] = tostring(m_dest)
      
    2. In your tap, access the data from the pinfo object:

      print('dest', pinfo.private["dest"] )
      

    XXX: Can only store string values


    Option 3: Reparse the buffer

    1. In your tap, call your parser (i.e., from parser.lua) to reparse the data in buffer, which is passed to the tap.

    XXX: Duplicates work already done by dissector (can double processing time for X-large capture files)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is platform-specific question, however, I would like to do some run-time
I would like to performs some statistical analysis in a definite zone of a
I need to analysis some log file and it look like below, I would
I would like some help with the following regexes. 00 should be replaced by
I would like some advice on the best approach to use in the following
I would like some of my preferences to have icons, like the Settings app.
I am developing a site and i would like some simple markup. I would
I am learning C++ exceptions and I would like some clarification of the scenario:
I am designing RESTful Api's and would like some advice on designing an API
Ok, so I would like some advice on how to set up a model.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.