Wireshark-users: Re: [Wireshark-users] Pass command line arguments to a LUA script?
From: "RUOFF, LARS (LARS)** CTR **" <lars.ruoff@xxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Jul 2011 17:59:43 +0200
 
Ok, that works on Windows too.
Thank you!
 
Lars
 

________________________________

From: wireshark-users-bounces@xxxxxxxxxxxxx [mailto:wireshark-users-bounces@xxxxxxxxxxxxx] On Behalf Of Tony Trinh
Sent: mardi 26 juillet 2011 03:10
To: Community support list for Wireshark
Subject: Re: [Wireshark-users] Pass command line arguments to a LUA script?


AFAIK, you cannot directly pass args from the command line to Wireshark Lua, but an easy alternative would be to use environment variables. Set an environment variable and query it from your script, using os.getenv <http://www.lua.org/manual/5.1/manual.html#pdf-os.getenv> . 

Here's an example from OSX:

$ echo "print('TESTVAR', os.getenv('TESTVAR'))" > test.lua
$ TESTVAR="hello world" tshark -v -Xlua_script:test.lua 
TESTVAR hello world


TShark 1.7.0 (SVN Rev 38064 from /trunk)


Copyright 1998-2011 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiled (64-bit) with GLib 2.28.8, with libpcap 1.1.1, with libz 1.2.5, without
POSIX capabilities, without threads support, without libpcre, without SMI,
without c-ares, without ADNS, with Lua 5.1, without Python, without GnuTLS,
without Gcrypt, with MIT Kerberos, without GeoIP.


Running on Mac OS 10.7.0 (Darwin 11.0.0), with locale en_US.UTF-8, with libpcap
version 1.1.1, with libz 1.2.5.


Built using llvm-gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
2335.15.00).


$