mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 11:31:46 +00:00
feat(check): detect third-party firewalls before built-in check
(#374) Support Little Snitch, LuLu, Radio Silence, Hands Off!, Murus, Vallum.
This commit is contained in:
@@ -112,8 +112,31 @@ check_filevault() {
|
|||||||
check_firewall() {
|
check_firewall() {
|
||||||
# Check whitelist
|
# Check whitelist
|
||||||
if command -v is_whitelisted > /dev/null && is_whitelisted "firewall"; then return; fi
|
if command -v is_whitelisted > /dev/null && is_whitelisted "firewall"; then return; fi
|
||||||
# Check firewall status using socketfilterfw (more reliable than defaults on modern macOS)
|
|
||||||
unset FIREWALL_DISABLED
|
unset FIREWALL_DISABLED
|
||||||
|
|
||||||
|
# Check third-party firewalls first (lightweight path-based detection, no sudo required)
|
||||||
|
local third_party_firewall=""
|
||||||
|
if [[ -d "/Applications/Little Snitch.app" ]] || [[ -d "/Library/Little Snitch" ]]; then
|
||||||
|
third_party_firewall="Little Snitch"
|
||||||
|
elif [[ -d "/Applications/LuLu.app" ]]; then
|
||||||
|
third_party_firewall="LuLu"
|
||||||
|
elif [[ -d "/Applications/Radio Silence.app" ]]; then
|
||||||
|
third_party_firewall="Radio Silence"
|
||||||
|
elif [[ -d "/Applications/Hands Off!.app" ]]; then
|
||||||
|
third_party_firewall="Hands Off!"
|
||||||
|
elif [[ -d "/Applications/Murus.app" ]]; then
|
||||||
|
third_party_firewall="Murus"
|
||||||
|
elif [[ -d "/Applications/Vallum.app" ]]; then
|
||||||
|
third_party_firewall="Vallum"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$third_party_firewall" ]]; then
|
||||||
|
echo -e " ${GREEN}✓${NC} Firewall ${third_party_firewall} active"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fall back to macOS built-in firewall check
|
||||||
local firewall_output=$(sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate 2> /dev/null || echo "")
|
local firewall_output=$(sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate 2> /dev/null || echo "")
|
||||||
if [[ "$firewall_output" == *"State = 1"* ]] || [[ "$firewall_output" == *"State = 2"* ]]; then
|
if [[ "$firewall_output" == *"State = 1"* ]] || [[ "$firewall_output" == *"State = 2"* ]]; then
|
||||||
echo -e " ${GREEN}✓${NC} Firewall Network protection enabled"
|
echo -e " ${GREEN}✓${NC} Firewall Network protection enabled"
|
||||||
|
|||||||
Reference in New Issue
Block a user