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

*Solved* Accessing capture data with Lua

0

I have already made a Lua script that uses a Listener to listen for packets as they are captured, and then uses data from them. But I am at a loss in figuring out how to access packet data after the capture has already occurred. For example, I want to be able to have my packet data listed out (either from a capture that just occurred, or from a capture file that I opened), click on my script in the menu, then select a packet by its packet number, and then have access to all of its fields as if I had captured the packet from a listener. Is there a way to do this from Lua?

Edit: I discovered a function called "retap_packets", described in the GUI page in the Lua API documentation, and from its description, it sounds like what I'm looking for, but after trying it, it doesn't seem to work.

Edit again: To whom it may concern, I was originally calling the retap_packets() function before the declaration of the listener.packet() function. Putting it after that declaration fixed the problem.

asked 26 Aug '16, 13:01

jr0026's gravatar image

jr0026
6113
accept rate: 0%

edited 26 Aug '16, 14:31

The right way to answer your own question is to, well, answer your own question - put whatever you discovered into an answer, and add that answer to the question. That way, the question shows up as answered, and other people who want to do the same thing can find the answer more easily. (Think of a Q&A site, like this site, as a "crowdsourced FAQ" rather than as a forum.)

(26 Aug '16, 17:29) Guy Harris ♦♦