No, there is no Lua function to open a capture file in tshark
(as can be seen in the Wireshark User Manual and wiki). Instead, you can use a shell script to pass the files to tshark
for Lua tap processing. This would replace the Lua that opens the .snoop
files.
For example, this bash
script (tested in OSX) passes all .snoop
files in the current directory to tshark
(one file at a time), where tap.lua
processes the file contents.
for x in *.snoop; do tshark -q -Xlua_script:/path/to/tap.lua -r "$x"; done
Parameters:
-q
= silences the packet info output from processing the capture file-Xlua_script
= loads a Lua script (unnecessary if file is already in Lua initialization path)-r
= opens a capture file, prints packet info, and then exits
EDIT: No need for -v
when -r
is provided. In fact, -v
prevents -r
from doing anything.
answered 22 May '12, 06:24
helloworld
3.1k●4●20●41
accept rate: 28%
...but it should work on all UN*Xes, and should work with other Bourne-compatible shells (Bourne shell, Korn shell, etc.) It should work on Windows with, for example, the Cygwin Bourne shell or other Bourne-compatible shells for Windows, although
/path/to/tap.lua
would becomedrive_and:\path\to\tap.lua
.for windows:
Or with Windows PowerShell:
ls C:\temp\*.snoop | % { tshark -q -r "$_.FullName" "-Xlua_script:C:\temp\tap.lua"
}