How do I test to see if Little Snitch is running and the network filter is actually running?
It doesn’t see the menu that little snitch uses in the menu bar,
How do I test to see if Little Snitch is running and the network filter is actually running?
It doesn’t see the menu that little snitch uses in the menu bar,
Instead of testing for a menu condition you could test for connectivity. This shows you if the filter is really working.
You find many great hints how to test for connectivity on this Stackexchange post.
[test] Test if Little Snitch is Working.kmmacros (6.5 KB)
The first group ("Testing for connectivity in general") will test if your connection is working at all. Otherwise it wouldn't make sense to test for Little Snitch.
The second group ("Testing a host blocked by Little Snitch") will test if a host and port that should be blocked by Little Snitch is really blocked.
####You have to set the test hosts and ports in the two shell scripts according to your Little Snitch rules:
In the first, green Shell Script action test for a host and port that is not blocked by Little Snitch.
If this test fails your connection is likely to be down and the macro will be aborted.
In the second, red Shell Script action test for a host and port that is blocked according to your Little Snitch rules.
You get a message that tells you the outcome of the test.
Another advantage of this method is that it works independently of the Little Snitch version.
A caveat is that if the test host (in the example: google-analytics.com) is down you'll get a wrong confirmation. So, choose a reliable test host.
You could also double-up by testing two different hosts in shell script #2:
if ! nc -zw1 google-analytics.com 80; then
nc -zw1 facebook.com 443
fi
With that script, only if none of the two hosts can be connected you'll get the "Little Snitch is working" confirmation.
Thanks Tom!
BTW, can I call this macro from another one, and pass the result to the first macro?
Yes, have a look at the KM Wiki, for example “Execute a Macro”.
To further use any result just store it in a variable and then put that variable to use in the other macro.