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

String syntax error

0

Hi! I have one little problem:

C:\Program Files\Wireshark\tshark -x lua_script:hello.lua Capturing on Microsoft tshark: Invalid capture filter "lua_script:hello.lua" for interface Microsoft!

That string isn't a valid capture filter <syntax error="">. See the User's Guide for a description of the capture filter syntax. 0 packets captured

hello.lua contains only this: print("Hello World")

What's the problem?

asked 07 Sep '12, 01:47

speede05's gravatar image

speede05
6224
accept rate: 0%


One Answer:

0

The problem is that you used "-x" instead of "-X". As -x does not take an argument, tshark sees "lua_script:hello.lua" as a capture filter.

Capitalize! ;-)

answered 07 Sep '12, 01:56

SYN-bit's gravatar image

SYN-bit ♦♦
17.1k957245
accept rate: 20%

ok..but it's not good... new problem...

'tshark' is not recognized as an internal or external command, operable program or batch file.

(07 Sep '12, 02:06) speede05

that's because of the blank in "Program Files". So, quote yourself!

"C:\Program Files\Wireshark\tshark" -X ....

(07 Sep '12, 02:19) Kurt Knochner ♦

what can i do? i tried in root running, but is not good

(07 Sep '12, 02:38) speede05

What do you mean by "running in root" and what exactkly is not good?

(07 Sep '12, 02:43) Kurt Knochner ♦

i moved the wireshark folder into "C"... i can here running the script, but not good...

so... "C:\Wireshark>tshark -X lua_script:hello.lua Capturing on Microsoft 0 packets captured"

where is the string "Hello World"

(07 Sep '12, 02:53) speede05

Which version of tshark are you running? Do you see "with lua 5.1" in the output of "tshark -v"?

(07 Sep '12, 02:59) SYN-bit ♦♦

where did you place the file hello.lua?

Do you see the following (or a similar) message?

tshark: The file "hello.lua" doesn't exist.

(07 Sep '12, 03:03) Kurt Knochner ♦

BTW: The script needs to be in the folder where you start the tshark command, not in the Wireshark install folder, unless you specify the whole path.

So, either this (hello.lua in c:\temp)

cd \temp
c:\temp>"c:\Program Files\Wireshark\tshark.exe" -X lua_script:hello.lua

or this (hello.lua in c:\programm files\wireshark)

"c:\Program Files\Wireshark\tshark.exe" -X lua_script:"c:\Program Files\Wireshark\hello.lua"

You need to double quote the blank in the path name, as that's a specific problem of the DOS box commandline.

(07 Sep '12, 03:13) Kurt Knochner ♦

ohh... it's good... i dont enabled lua :...

(07 Sep '12, 03:23) speede05
showing 5 of 9 show 4 more comments