Created
August 24, 2023 18:50
-
-
Save korylprince/4cd2a9554d16d88dd1914e4586f21619 to your computer and use it in GitHub Desktop.
Check macOS Lightspeed Filter Agent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Checks if Lightspeed Filter Agent processes are running, binaries are installed, and Network Extension is running | |
# If a component is not installed or not running, returns "Error: <error reason>" | |
# Otherwise returns mobilefilter version | |
# check for installed binaries | |
if ! test -f /Applications/.lightspeed-agent/lsproxy; then | |
printf "<result>Error: lsproxy binary not found</result>" | |
exit 1 | |
fi | |
if ! test -f /Applications/.lightspeed-agent/lsfilter; then | |
printf "<result>Error: lsfilter binary not found</result>" | |
exit 1 | |
fi | |
if ! test -f /Applications/Lightspeed\ Agent.app/Contents/MacOS/Lightspeed\ Agent; then | |
printf "<result>Error: Lightspeed Agent.app not found</result>" | |
exit 1 | |
fi | |
if ! test -f /usr/local/bin/proxyforce; then | |
printf "<result>Error: proxyforce binary not found</result>" | |
exit 1 | |
fi | |
if ! test -f /usr/local/bin/mobilefilter; then | |
printf "<result>Error: mobilefilter binary not found</result>" | |
exit 1 | |
fi | |
# check for running processes | |
if ! pgrep -x lsproxy >/dev/null 2>&1; then | |
printf "<result>Error: lsproxy process not running</result>" | |
exit 1 | |
fi | |
if ! pgrep -x lsfilter >/dev/null 2>&1; then | |
printf "<result>Error: lsproxy process not running</result>" | |
exit 1 | |
fi | |
if ! pgrep -x "Lightspeed Agent" >/dev/null 2>&1; then | |
printf "<result>Error: Lightspeed Agent.app process not running</result>" | |
exit 1 | |
fi | |
if ! pgrep -x proxyforce >/dev/null 2>&1; then | |
printf "<result>Error: proxyforce process not running</result>" | |
exit 1 | |
fi | |
if ! pgrep -x mobilefilter >/dev/null 2>&1; then | |
printf "<result>Error: mobilefilter process not running</result>" | |
exit 1 | |
fi | |
# check if Network Extension is active | |
if ! $(systemextensionsctl list | grep -q "com.lightspeedsystems.network-agent.network-extension"); then | |
printf "<result>Error: Network extension not installed</result>" | |
exit 1 | |
fi | |
if ! $(systemextensionsctl list | grep "com.lightspeedsystems.network-agent.network-extension" | grep -q "activated enabled"); then | |
printf "<result>Error: Network extension not active</result>" | |
exit 1 | |
fi | |
if ! pgrep -x "com.lightspeedsystems.network-agent.network-extension" >/dev/null 2>&1; then | |
printf "<result>Error: Network extension process not running</result>" | |
exit 1 | |
fi | |
printf "<result>$(/usr/local/bin/mobilefilter -v)</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment