Skip to content

Commit

Permalink
Improve firewall detection by using socketfilterfw
Browse files Browse the repository at this point in the history
  • Loading branch information
F1248 committed Dec 30, 2024
1 parent 8543bd6 commit f130ae7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions Genius/Extensions/Swift/Bool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ extension Bool: DataInitializable {
"no",
"false",
"disabled",
"spfirewall_globalstate_allow_all",
]) {
self = false
} else if string.contains(any: [
"yes",
"true",
"enabled",
"spfirewall_globalstate_limit_connections",
"spfirewall_globalstate_block_all",
]) {
self = true
} else { return nil }
Expand Down
1 change: 0 additions & 1 deletion Genius/Models/Helpers/SystemProfiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Foundation

enum SystemProfiler {

static let firewall = get("Firewall")
static let hardware = get("Hardware")
static let software = get("Software")

Expand Down
2 changes: 1 addition & 1 deletion Genius/Models/SystemInformation/MaintenanceChecks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extension SystemInformation {
applicable: Software.OS.bootMode.value !=? .recovery
)
static let firewall = SystemInformationData<Bool?>(
{ Bool(SystemProfiler.firewall?["spfirewall_globalstate"]) },
{ Bool(Process("/usr/libexec/ApplicationFirewall/socketfilterfw", ["--getglobalstate"])?.runSafe()) },
applicable: Software.OS.bootMode.value !=? .recovery
)
static let gatekeeper = SystemInformationData<Bool?>(Bool(Process("/usr/sbin/spctl", ["--status"])?.runSafe()))
Expand Down

0 comments on commit f130ae7

Please sign in to comment.