hi, first of all sorry for my (really) bad english. i was loocking for a way to pass same capturing filters to tshark from a file. i know there is a capturing filters file in $HOME/.config/wireshark/$PROFILE/cfilters, but when i run: (Prova is my PROFILE) tshark -C Prova -c 50 -I -i wlp0s4f1u1 > out.pcap i capture broadcast packets even if i defined a filter to NOT capturing broadcast stuff. asked 13 Apr '16, 07:14 alexamico |
2 Answers:
You have to add a name to the capture filter you wish to use and then supply the name to the See Bug 8091 and Change 5925 for more information. Note this is only available in development builds, i.e. version >= 2.1.x. answered 13 Apr '16, 08:02 grahamb ♦ edited 13 Apr '16, 10:05 |
The That said, if you know the order of the saved capture filters in the
Here's what it does:
Another solution, and probably a nicer one, would be to just
Passing the With this method, you don't need to know the order of the capture filters in the file, but you do need to know the name of the filter, and you should probably make sure they're all unique; otherwise the search might return an unintended match. If you want more than 1 filter, you can combine them. For example, suppose you want to apply a combined capture filter which comprises the individual capture filters you named "FOO" and "BAR":
EDIT: The solution that grahamb supplied would be preferred, if available, and if you only wanted to apply a single capture filter. The solution I provided could be useful if capture filter labels are not available though or if you wanted to apply more than 1 capture filter. As grahamb mentioned, if you want to apply all filters from the EDIT2: Perhaps a script such as follows is more along the lines of what you're looking for?
answered 13 Apr ‘16, 09:40 cmaynard ♦♦ edited 13 Apr ‘16, 10:37 |
so, if i want to run all and only the filters in $HOME/.config/wireshark/$PROFILE/cfilters i MUST write some sort of script?! there isn't a method to tell tshark to run all and only those filters?
Nope, you can only pass one filter into tshark (and Wireshark for that matter). You can combine multiple filter expressions into a single filter using logical operators, probably with
and
or&&
for your use case.You could write a script to read all the filter expressions in cfilters and combine them programmatically and then call tshark.