Wireshark mailing list archives

Re: Getting a pcap filename from a Lua script


From: Tony Trinh <tony19 () gmail com>
Date: Sun, 15 Jan 2012 11:12:48 -0500

On Sun, Jan 15, 2012 at 6:34 AM, Maayan Zadik <maayanz () designartnetworks com
wrote:

**

Is there a way to retrieve the capture file name from inside the Lua
script, that way I can name the log: “<filename>_log”?****



Someone asked<http://www.wireshark.org/lists/wireshark-users/201109/msg00095.html>
about
this a few months ago. No, the Lua API currently does not support this, but
there might be other ways to accomplish the same goal:

1) Pass environment variable, containing the filename, to the Lua script

   echo "print('\$PCAP:', os.getenv('PCAP'))" > foo.lua
   PCAP=foo.pcap tshark -r foo.pcap -Xlua_script:foo.lua -q

2) Print to stdout from Lua, and redirect to file

   tshark -r foo.pcap -Xlua_script:foo.lua -q > foo.pcap.analysis.txt
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: