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

tshark smb,srt filter error

0

Hi All,

i am trying to get some smb statistics for certain file using tshark , i think i am using the correct syntax but still getting errors as follows below even if i remove the \ i get invalid - "New" was unexpected in this context. Please advice Thanks

C:\traces_test>"c:\Program Files\Wireshark\tshark.exe" -n -r tracesmb_fileop1.pcap -q -z "smb,srt,smb.file==\\New Video 12_20196.xml"

tshark: Couldn't register smb,srt tap: Filter "smb.file==\New Video 12_20196.xml" is invalid - "\" was unexpected in this context.

asked 19 Oct '13, 10:22

tbaror's gravatar image

tbaror
10121215
accept rate: 0%

Normally quoting or escaping does the trick, but I can't get this to work either. Note that you will probably have to escape the backslashes when we do work out what extra is required.

To work out what to put in filter try it out in the GUI, generally selecting the field, right clicking and choosing "Apply As Filter" then "Selected". You'll see for a file with the name \server\path the filter in the filter box becomes \\server\\path

(19 Oct '13, 12:47) grahamb ♦

Thanks for the comment, but i do need tshark for scripting :-( i will give it further try with extra escaping. thanks

(19 Oct '13, 21:41) tbaror

One Answer:

2

This was answered on the dev mailing list here by Evan. The answer is to escape the quotes required around the string to match and escape the backslash in the string, e.g.

tshark.exe" -n -r tracesmb_fileop1.pcap -q -z "smb,srt,smb.file==\"\\New Video 12_20196.xml\""

answered 20 Oct '13, 16:31

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%