Wireshark mailing list archives

Re: Pass command line arguments to a LUA script?


From: Tony Trinh <tony19 () gmail com>
Date: Mon, 25 Jul 2011 21:09:48 -0400

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 () wireshark org> 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).

$
___________________________________________________________________________
Sent via:    Wireshark-users mailing list <wireshark-users () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-users
Unsubscribe: https://wireshark.org/mailman/options/wireshark-users
             mailto:wireshark-users-request () wireshark org?subject=unsubscribe

Current thread: