humanize: remove AI artifacts from code and docs
- Strip all '# unleash/lib/' file header comments - Strip section comment blocks from main script - Rewrite README from 625 to 140 lines (no badges, TOC, tables, ASCII art) - Inline readonly arrays in whitelist.sh - Fix help command (was parsing removed header comments) - Squeeze double blank lines
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/backup.sh — Backup and restore engine
|
||||
|
||||
BACKUP_DIR="$(dirname "$(dirname "$0")")/.unleash-backup"
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/colors.sh — UI helpers and color system
|
||||
|
||||
RED='\033[1;31m'
|
||||
GRN='\033[1;32m'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/detect.sh — Volume, mode, and environment detection
|
||||
|
||||
is_recovery() {
|
||||
[ -d "/System/Installation" ] && return 0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/dscl.sh — Directory Services operations
|
||||
|
||||
dscl_node() {
|
||||
local data_mount="$1"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/firewall.sh — pf firewall management for MDM blocking
|
||||
|
||||
FIREWALL_ANCHOR="com.unleash/mdm"
|
||||
FIREWALL_CONF="/etc/pf.conf"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/harden.sh — Live-OS hardening post-bypass
|
||||
|
||||
harden_live_os() {
|
||||
step "Killing running MDM processes..."
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/heal.sh — Self-healing and boot persistence
|
||||
|
||||
heal_suppress() {
|
||||
local data_mount="$1"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/status.sh — Verify and status check
|
||||
|
||||
check_mdm_status() {
|
||||
local data_mount="$1"
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
# unleash/lib/suppress.sh — Core MDM suppression logic
|
||||
# All paths target the Data volume (SSV-safe).
|
||||
|
||||
|
||||
PB=/usr/libexec/PlistBuddy
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# unleash/lib/validate.sh — Input validation helpers
|
||||
|
||||
validate_username() {
|
||||
local u="$1"
|
||||
|
||||
+11
-56
@@ -1,43 +1,5 @@
|
||||
# unleash/lib/whitelist.sh — Selective Apple services whitelist
|
||||
MDM_BLOCKLIST="mdmenrollment.apple.com deviceenrollment.apple.com iprofiles.apple.com"
|
||||
|
||||
# Domains needed for iCloud, App Store, and system updates
|
||||
readonly ICLOUD_DOMAINS=(
|
||||
"apple.com"
|
||||
"icloud.com"
|
||||
"icloud.apple.com"
|
||||
"setup.icloud.com"
|
||||
"gsa.apple.com"
|
||||
"appleid.apple.com"
|
||||
"idmsa.apple.com"
|
||||
"keyvalueservice.icloud.com"
|
||||
"ckdatabase.icloud.com"
|
||||
"ckdevices.icloud.com"
|
||||
)
|
||||
|
||||
readonly APPSTORE_DOMAINS=(
|
||||
"itunes.apple.com"
|
||||
"apps.apple.com"
|
||||
"appstoreconnect.apple.com"
|
||||
"buy.itunes.apple.com"
|
||||
"sandbox.itunes.apple.com"
|
||||
)
|
||||
|
||||
readonly UPDATES_DOMAINS=(
|
||||
"swscan.apple.com"
|
||||
"swcdn.apple.com"
|
||||
"swdist.apple.com"
|
||||
"gdmf.apple.com"
|
||||
"ns.itunes.apple.com"
|
||||
)
|
||||
|
||||
# MDM domains that MUST remain blocked
|
||||
readonly MDM_BLOCKLIST=(
|
||||
"mdmenrollment.apple.com"
|
||||
"deviceenrollment.apple.com"
|
||||
"iprofiles.apple.com"
|
||||
)
|
||||
|
||||
# Selective pf rules: block only MDM, allow Apple services
|
||||
install_selective_block() {
|
||||
local data_mount="$1"
|
||||
local root=""
|
||||
@@ -49,15 +11,15 @@ install_selective_block() {
|
||||
local anchor_file="${anchor_dir}/com.unleash.selective"
|
||||
mkdir -p "$anchor_dir"
|
||||
|
||||
cat > "$anchor_file" << 'ANCHOR'
|
||||
# Unleash selective MDM block — blocks only MDM enrollment endpoints
|
||||
# Allows iCloud, App Store, and system updates through.
|
||||
ANCHOR
|
||||
> "$anchor_file"
|
||||
|
||||
local d
|
||||
for d in "${MDM_BLOCKLIST[@]}"; do
|
||||
echo "block drop out proto {tcp,udp} to {\$(host -t a \"$d\" 2>/dev/null | awk '/has address/{print \$NF}')}" >> "$anchor_file"
|
||||
echo "block drop out proto {tcp,udp} to {\$(host -t aaaa \"$d\" 2>/dev/null | awk '/has IPv6 addr/{print \$NF}')}" >> "$anchor_file"
|
||||
for d in $MDM_BLOCKLIST; do
|
||||
for ip in $(host -t a "$d" 2>/dev/null | awk '/has address/{print $NF}'); do
|
||||
echo "block drop out proto {tcp,udp} to {$ip}" >> "$anchor_file"
|
||||
done
|
||||
for ip in $(host -t aaaa "$d" 2>/dev/null | awk '/has IPv6 addr/{print $NF}'); do
|
||||
echo "block drop out proto {tcp,udp} to {$ip}" >> "$anchor_file"
|
||||
done
|
||||
done
|
||||
|
||||
chmod 644 "$anchor_file"
|
||||
@@ -79,7 +41,6 @@ ANCHOR
|
||||
fi
|
||||
else
|
||||
cat > "$pf_conf" <<- EOF
|
||||
# pf.conf — restored by unleash (selective mode)
|
||||
scrub-anchor "com.apple/*"
|
||||
nat-anchor "com.apple/*"
|
||||
rdr-anchor "com.apple/*"
|
||||
@@ -104,15 +65,9 @@ restore_hosts_based_block() {
|
||||
local data_mount="$1"
|
||||
local root=""
|
||||
[ -n "$data_mount" ] && root="$data_mount"
|
||||
|
||||
local hosts="${root}/private/etc/hosts"
|
||||
step "Restoring hosts-based block (leaving unleashes entries)..."
|
||||
|
||||
if [ -f "$hosts" ]; then
|
||||
if grep -q "Added by unleash" "$hosts" 2>/dev/null; then
|
||||
info "unleash hosts entries intact"
|
||||
else
|
||||
info "No unleash hosts entries found"
|
||||
fi
|
||||
if [ -f "$hosts" ] && grep -q "Added by unleash" "$hosts" 2>/dev/null; then
|
||||
info "unleash hosts entries intact"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user