Initial commit: runaway v1.0.0
Unified MDM bypass tool for macOS. - CLI with 7 subcommands (bypass/suppress/backup/restore/dualboot/status/version) - Modular (lib/*.sh) + standalone (single-file) formats - Auto-detect Recovery mode, APFS volume, FileVault - SSV-safe: all writes target Data volume - Backup/restore original state - MIT License
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Matthew Siqueira
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# unleash — Unified MDM Bypass for macOS
|
||||||
|
|
||||||
|
A single tool to bypass, suppress, backup, restore, and check MDM enrollment on macOS.
|
||||||
|
|
||||||
|
## Why unleash?
|
||||||
|
|
||||||
|
The original project (bypass-mdm) grew into 5 separate scripts. This one unifies everything:
|
||||||
|
|
||||||
|
| Feature | bypass-mdm | unleash |
|
||||||
|
|---------|-----------|---------|
|
||||||
|
| Full bypass (admin + suppress) | v2/v3/express | `unleash bypass` |
|
||||||
|
| Suppress only (no user) | v3 only | `unleash suppress` |
|
||||||
|
| Backup + Restore | express only | `unleash backup / restore` |
|
||||||
|
| Dual-boot | dualboot.sh | `unleash dualboot` |
|
||||||
|
| Status check | v3 verify | `unleash status` |
|
||||||
|
| Auto-detect Recovery | partial | Always |
|
||||||
|
| FileVault unlock | v3 | Yes |
|
||||||
|
| Org MDM host blocking | v3 | Yes |
|
||||||
|
| Daemon disable (durable) | v3 | Yes |
|
||||||
|
| Interactive menu | all | Yes |
|
||||||
|
| CLI flags | none | Yes |
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### From an external SSD (recommended)
|
||||||
|
|
||||||
|
1. Copy the `unleash` folder to your SSD
|
||||||
|
2. Boot into Recovery mode (hold Power on Apple Silicon)
|
||||||
|
3. Open Terminal → `chmod +x "/Volumes/YourSSD/unleash/unleash"`
|
||||||
|
4. Run: `"/Volumes/YourSSD/unleash/unleash"`
|
||||||
|
|
||||||
|
### One-liner (download)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -L https://raw.githubusercontent.com/mateussiqueira/unleash/main/unleash -o unleash
|
||||||
|
chmod +x unleash && ./unleash bypass
|
||||||
|
```
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
| Command | Description |
|
||||||
|
|---------|-------------|
|
||||||
|
| `./unleash` | Interactive menu (auto-detects mode) |
|
||||||
|
| `./unleash bypass` | Full bypass — create admin + suppress MDM |
|
||||||
|
| `./unleash suppress` | Suppress enrollment only (no user) |
|
||||||
|
| `./unleash backup` | Backup current state |
|
||||||
|
| `./unleash restore` | Restore from backup |
|
||||||
|
| `./unleash dualboot` | Target a dual-boot volume (needs sudo) |
|
||||||
|
| `./unleash status` | Check MDM status |
|
||||||
|
| `./unleash version` | Show version |
|
||||||
|
|
||||||
|
## Safety
|
||||||
|
|
||||||
|
- All writes target the **Data volume** (SSV-safe on Apple Silicon)
|
||||||
|
- Backups can restore original state
|
||||||
|
- Never runs `profiles renew`
|
||||||
|
- Never touches Apple Business Manager records
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
unleash/
|
||||||
|
├── unleash # Single entry point (CLI + interactive)
|
||||||
|
├── lib/
|
||||||
|
│ ├── colors.sh # UI colors and helpers
|
||||||
|
│ ├── detect.sh # Volume detection, Recovery/dualboot mode
|
||||||
|
│ ├── validate.sh # Username/password validation
|
||||||
|
│ ├── dscl.sh # Directory Services operations
|
||||||
|
│ ├── suppress.sh # Core MDM suppression logic
|
||||||
|
│ ├── backup.sh # Backup and restore
|
||||||
|
│ └── status.sh # Verify and status check
|
||||||
|
├── examples/
|
||||||
|
├── README.md
|
||||||
|
└── LICENSE
|
||||||
|
```
|
||||||
|
|
||||||
|
## Legal
|
||||||
|
|
||||||
|
This only suppresses MDM locally. Your serial stays in the org's Apple Business Manager. The permanent fix is them releasing it.
|
||||||
|
|
||||||
|
Use on devices you own. I'm not responsible for what you do with this.
|
||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Build a standalone unleash.sh (single file) from modular source.
|
||||||
|
# Usage: bash build-standalone.sh
|
||||||
|
# Output: unleash-standalone.sh
|
||||||
|
|
||||||
|
OUT="unleash-standalone.sh"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
|
||||||
|
cat > "$OUT" << 'HEADER'
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# unleash — Unified MDM bypass tool for macOS (standalone).
|
||||||
|
# Auto-detects Recovery/dualboot mode. One file, zero dependencies.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ./unleash [bypass|suppress|backup|restore|dualboot|status|version|help]
|
||||||
|
|
||||||
|
VERSION="1.0.0"
|
||||||
|
HEADER
|
||||||
|
|
||||||
|
echo "" >> "$OUT"
|
||||||
|
|
||||||
|
for lib in colors detect validate dscl suppress backup status; do
|
||||||
|
echo "# === lib/$lib.sh ===" >> "$OUT"
|
||||||
|
# Remove shebang lines (first line of each lib)
|
||||||
|
tail -n +2 "$SCRIPT_DIR/lib/$lib.sh" >> "$OUT"
|
||||||
|
echo "" >> "$OUT"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Append the main script body (skip shebang, skip lib sourcing)
|
||||||
|
sed -e '1d' -e '/^LIB_DIR=/d' -e '/^for _lib in/,/^done$/d' "$SCRIPT_DIR/unleash" >> "$OUT"
|
||||||
|
|
||||||
|
chmod +x "$OUT"
|
||||||
|
echo "Created: $OUT ($(wc -c < "$OUT") bytes, $(wc -l < "$OUT") lines)"
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Quickstart examples for unleash
|
||||||
|
# Copy these one-liners as needed.
|
||||||
|
|
||||||
|
# === EXPRESS (from external SSD, no download) ===
|
||||||
|
# 1. Copy unleash folder to your SSD
|
||||||
|
# 2. Boot into Recovery
|
||||||
|
# 3. Terminal ->
|
||||||
|
# /Volumes/YourSSDName/unleash/unleash
|
||||||
|
|
||||||
|
# === ONE-LINER (download + run) ===
|
||||||
|
# curl -L https://raw.githubusercontent.com/mateussiqueira/unleash/main/unleash -o unleash
|
||||||
|
# chmod +x unleash && ./unleash bypass
|
||||||
|
|
||||||
|
# === DUAL-BOOT ===
|
||||||
|
# sudo ./unleash dualboot
|
||||||
|
|
||||||
|
# === SUPPRESS ONLY ===
|
||||||
|
# ./unleash suppress
|
||||||
|
|
||||||
|
# === BACKUP ===
|
||||||
|
# ./unleash backup
|
||||||
|
|
||||||
|
# === RESTORE ===
|
||||||
|
# ./unleash restore
|
||||||
|
|
||||||
|
# === STATUS ===
|
||||||
|
# ./unleash status
|
||||||
|
|
||||||
|
echo "See the comments in this file for usage examples."
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
# unleash/lib/backup.sh — Backup and restore engine
|
||||||
|
|
||||||
|
BACKUP_DIR="$(dirname "$(dirname "$0")")/.unleash-backup"
|
||||||
|
|
||||||
|
backup_state() {
|
||||||
|
local data_mount="$1"
|
||||||
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
step "Saving backup to $BACKUP_DIR"
|
||||||
|
|
||||||
|
if [ -f "$data_mount/private/etc/hosts" ]; then
|
||||||
|
cp "$data_mount/private/etc/hosts" "$BACKUP_DIR/hosts.backup"
|
||||||
|
success "hosts saved"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local cfg_src="$data_mount/private/var/db/ConfigurationProfiles/Settings"
|
||||||
|
if [ -d "$cfg_src" ]; then
|
||||||
|
mkdir -p "$BACKUP_DIR/ConfigurationProfiles"
|
||||||
|
cp -r "$cfg_src/"* "$BACKUP_DIR/ConfigurationProfiles/" 2>/dev/null || true
|
||||||
|
success "config profiles saved"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ldp_src="$data_mount/private/var/db/com.apple.xpc.launchd/disabled.plist"
|
||||||
|
if [ -f "$ldp_src" ]; then
|
||||||
|
mkdir -p "$BACKUP_DIR/launchd"
|
||||||
|
cp "$ldp_src" "$BACKUP_DIR/launchd/disabled.plist.backup" 2>/dev/null || true
|
||||||
|
success "launchd override saved"
|
||||||
|
fi
|
||||||
|
|
||||||
|
date +%Y-%m-%d_%H-%M-%S >"$BACKUP_DIR/timestamp"
|
||||||
|
echo "$data_mount" >"$BACKUP_DIR/data_volume_path"
|
||||||
|
success "Backup complete: $(cat "$BACKUP_DIR/timestamp")"
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_state() {
|
||||||
|
[ -f "$BACKUP_DIR/timestamp" ] || error_exit "No backup found at $BACKUP_DIR"
|
||||||
|
|
||||||
|
local data_mount
|
||||||
|
if [ -f "$BACKUP_DIR/data_volume_path" ]; then
|
||||||
|
data_mount=$(cat "$BACKUP_DIR/data_volume_path")
|
||||||
|
if [ ! -d "$data_mount/private/var" ]; then
|
||||||
|
warn "Saved path unavailable — re-detecting..."
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
fi
|
||||||
|
|
||||||
|
step "Restoring from backup ($(cat "$BACKUP_DIR/timestamp"))"
|
||||||
|
echo -e "${YEL}Target: $data_mount${NC}"
|
||||||
|
|
||||||
|
if [ -f "$BACKUP_DIR/hosts.backup" ]; then
|
||||||
|
cp "$BACKUP_DIR/hosts.backup" "$data_mount/private/etc/hosts"
|
||||||
|
success "hosts restored"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$BACKUP_DIR/ConfigurationProfiles" ]; then
|
||||||
|
local cfg="$data_mount/private/var/db/ConfigurationProfiles/Settings"
|
||||||
|
mkdir -p "$cfg"
|
||||||
|
cp -r "$BACKUP_DIR/ConfigurationProfiles/"* "$cfg/" 2>/dev/null || true
|
||||||
|
success "config profiles restored"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$BACKUP_DIR/launchd/disabled.plist.backup" ]; then
|
||||||
|
local ldp="$data_mount/private/var/db/com.apple.xpc.launchd/disabled.plist"
|
||||||
|
mkdir -p "$(dirname "$ldp")"
|
||||||
|
cp "$BACKUP_DIR/launchd/disabled.plist.backup" "$ldp"
|
||||||
|
success "launchd override restored"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i '' '/# Added by unleash/d' "$data_mount/private/etc/hosts" 2>/dev/null || true
|
||||||
|
|
||||||
|
rm -f "$BACKUP_DIR/data_volume_path" "$BACKUP_DIR/timestamp"
|
||||||
|
success "Restore complete"
|
||||||
|
}
|
||||||
|
|
||||||
|
has_backup() {
|
||||||
|
[ -f "$BACKUP_DIR/timestamp" ]
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# unleash/lib/colors.sh — UI helpers and color system
|
||||||
|
|
||||||
|
RED='\033[1;31m'
|
||||||
|
GRN='\033[1;32m'
|
||||||
|
BLU='\033[1;34m'
|
||||||
|
YEL='\033[1;33m'
|
||||||
|
CYAN='\033[1;36m'
|
||||||
|
MAG='\033[1;35m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
error_exit() {
|
||||||
|
echo -e "${RED}ERROR: $1${NC}" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
warn() {
|
||||||
|
echo -e "${YEL}WARNING: $1${NC}" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
success() {
|
||||||
|
echo -e "${GRN}\u2713 $1${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
info() {
|
||||||
|
echo -e "${BLU}\u2139 $1${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
step() {
|
||||||
|
echo -e "${CYAN}\u25b8 $1${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
header() {
|
||||||
|
local title="$1"
|
||||||
|
echo ""
|
||||||
|
echo -e "${CYAN}╔═══════════════════════════════════════════════╗${NC}"
|
||||||
|
echo -e "${CYAN}║ ${title}${NC}"
|
||||||
|
echo -e "${CYAN}╚═══════════════════════════════════════════════╝${NC}"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_default() {
|
||||||
|
local var_name="$1"
|
||||||
|
local prompt_text="$2"
|
||||||
|
local default="$3"
|
||||||
|
local value
|
||||||
|
|
||||||
|
read -p "$prompt_text (default '$default'): " value
|
||||||
|
value="${value:=$default}"
|
||||||
|
eval "$var_name=\"$value\""
|
||||||
|
}
|
||||||
|
|
||||||
|
confirm() {
|
||||||
|
local prompt="$1"
|
||||||
|
local response
|
||||||
|
read -p "$prompt (y/N): " response
|
||||||
|
[[ "$response" =~ ^[Yy]$ ]]
|
||||||
|
}
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
# unleash/lib/detect.sh — Volume, mode, and environment detection
|
||||||
|
|
||||||
|
is_recovery() {
|
||||||
|
[ -d "/System/Installation" ] && return 0
|
||||||
|
|
||||||
|
local vol
|
||||||
|
vol=$(diskutil info / 2>/dev/null | awk -F': *' '/Volume Name/{print $2}' | xargs)
|
||||||
|
case "$vol" in
|
||||||
|
"Recovery"*|"macOS Base"*|"macOS Installer"*) return 0 ;;
|
||||||
|
esac
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
is_root() {
|
||||||
|
[[ $EUID -eq 0 ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve_data_volume() {
|
||||||
|
step "Locating Data volume by APFS role..."
|
||||||
|
|
||||||
|
local id mount_pt
|
||||||
|
|
||||||
|
id=$(diskutil apfs list 2>/dev/null \
|
||||||
|
| awk '/\(Data\)/ && match($0, /disk[0-9]+s[0-9]+/) {print substr($0, RSTART, RLENGTH); exit}')
|
||||||
|
|
||||||
|
if [ -z "$id" ] || ! diskutil info "/dev/$id" >/dev/null 2>&1; then
|
||||||
|
info "APFS role detection failed — trying name-based..."
|
||||||
|
id=$(diskutil list 2>/dev/null \
|
||||||
|
| awk '/[[:space:]]Data[[:space:]]/{for(i=1;i<=NF;i++) if($i ~ /^disk[0-9]+s[0-9]+$/) v=$i} END{print v}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$id" ] || ! diskutil info "/dev/$id" >/dev/null 2>&1; then
|
||||||
|
warn "Auto-detection failed. Available disks:"
|
||||||
|
diskutil list >&2
|
||||||
|
echo ""
|
||||||
|
read -p "Enter Data volume identifier (e.g. disk3s1): " id </dev/tty
|
||||||
|
id="${id#/dev/}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$id" ] || error_exit "No Data volume identifier provided."
|
||||||
|
local data_dev="/dev/$id"
|
||||||
|
diskutil info "$data_dev" >/dev/null 2>&1 || error_exit "Not a valid disk: $data_dev"
|
||||||
|
info "Data volume device: $data_dev"
|
||||||
|
|
||||||
|
_mount_point() {
|
||||||
|
diskutil info "$data_dev" 2>/dev/null \
|
||||||
|
| awk -F': *' '/Mount Point/{print $2}' | sed 's/[[:space:]]*$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_pt=$(_mount_point)
|
||||||
|
|
||||||
|
if [ -z "$mount_pt" ] || [ ! -d "$mount_pt" ]; then
|
||||||
|
info "Not mounted — mounting..."
|
||||||
|
diskutil mount "$data_dev" 2>/dev/null || true
|
||||||
|
mount_pt=$(_mount_point)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$mount_pt" ] || [ ! -d "$mount_pt" ]; then
|
||||||
|
warn "FileVault-locked — need to unlock."
|
||||||
|
echo -e "${YEL}Enter password of a user on this Mac (or FileVault recovery key):${NC}" >&2
|
||||||
|
diskutil apfs unlockVolume "$data_dev" 2>/dev/null \
|
||||||
|
|| error_exit "Failed to unlock. Re-run with valid credentials."
|
||||||
|
mount_pt=$(_mount_point)
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -d "$mount_pt" ] || error_exit "Mount point not found after mount/unlock."
|
||||||
|
[ -d "$mount_pt/private/var/db/dslocal/nodes/Default" ] \
|
||||||
|
|| error_exit "Not a macOS Data volume (no dslocal node at $mount_pt)."
|
||||||
|
|
||||||
|
success "Data volume: $mount_pt"
|
||||||
|
echo "$mount_pt"
|
||||||
|
}
|
||||||
|
|
||||||
|
detect_system_volume() {
|
||||||
|
local data_mount="$1"
|
||||||
|
local vol
|
||||||
|
|
||||||
|
for vol in /Volumes/*; do
|
||||||
|
if [ -d "$vol/System" ] && [ "$vol" != "$data_mount" ]; then
|
||||||
|
basename "$vol"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve_target_volumes() {
|
||||||
|
local base_name data_name
|
||||||
|
|
||||||
|
read -p "Enter target system volume name (default 'Macintosh HD'): " base_name
|
||||||
|
base_name="${base_name:=Macintosh HD}"
|
||||||
|
read -p "Enter target data volume name (default 'Macintosh HD - Data'): " data_name
|
||||||
|
data_name="${data_name:=Macintosh HD - Data}"
|
||||||
|
|
||||||
|
local sys_path="/Volumes/$base_name"
|
||||||
|
local data_path="/Volumes/$data_name"
|
||||||
|
|
||||||
|
[ -d "$sys_path" ] || error_exit "System volume not found: $sys_path"
|
||||||
|
[ -d "$data_path" ] || error_exit "Data volume not found: $data_path"
|
||||||
|
|
||||||
|
echo "$sys_path|$data_path"
|
||||||
|
}
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
# unleash/lib/dscl.sh — Directory Services operations
|
||||||
|
|
||||||
|
dscl_node() {
|
||||||
|
local data_mount="$1"
|
||||||
|
echo "$data_mount/private/var/db/dslocal/nodes/Default"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_user_exists() {
|
||||||
|
local node="$1"
|
||||||
|
local username="$2"
|
||||||
|
dscl -f "$node" localhost -read "/Local/Default/Users/$username" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
find_available_uid() {
|
||||||
|
local node="$1"
|
||||||
|
local uid=501
|
||||||
|
while [ $uid -lt 600 ]; do
|
||||||
|
dscl -f "$node" localhost -search /Local/Default/Users UniqueID $uid 2>/dev/null \
|
||||||
|
| grep -q "UniqueID" || { echo $uid; return 0; }
|
||||||
|
uid=$((uid + 1))
|
||||||
|
done
|
||||||
|
echo 501
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_user() {
|
||||||
|
local node="$1"
|
||||||
|
local data_mount="$2"
|
||||||
|
local username="$3"
|
||||||
|
dscl -f "$node" localhost -delete "/Local/Default/Users/$username" 2>/dev/null || true
|
||||||
|
rm -rf "$data_mount/Users/$username" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
create_admin_user() {
|
||||||
|
local node="$1"
|
||||||
|
local data_mount="$2"
|
||||||
|
local username="$3"
|
||||||
|
local realname="$4"
|
||||||
|
local password="$5"
|
||||||
|
local uid="$6"
|
||||||
|
|
||||||
|
info "Creating admin account: $username"
|
||||||
|
|
||||||
|
dscl -f "$node" localhost -create "/Local/Default/Users/$username" 2>/dev/null \
|
||||||
|
|| error_exit "Failed to create user"
|
||||||
|
dscl -f "$node" localhost -create "/Local/Default/Users/$username" UserShell "/bin/zsh" 2>/dev/null
|
||||||
|
dscl -f "$node" localhost -create "/Local/Default/Users/$username" RealName "$realname" 2>/dev/null
|
||||||
|
dscl -f "$node" localhost -create "/Local/Default/Users/$username" UniqueID "$uid" 2>/dev/null
|
||||||
|
dscl -f "$node" localhost -create "/Local/Default/Users/$username" PrimaryGroupID "20" 2>/dev/null
|
||||||
|
dscl -f "$node" localhost -create "/Local/Default/Users/$username" NFSHomeDirectory "/Users/$username" 2>/dev/null
|
||||||
|
|
||||||
|
dscl -f "$node" localhost -passwd "/Local/Default/Users/$username" "$password" 2>/dev/null \
|
||||||
|
|| error_exit "Failed to set password"
|
||||||
|
dscl -f "$node" localhost -append "/Local/Default/Groups/admin" GroupMembership "$username" 2>/dev/null \
|
||||||
|
|| error_exit "Failed to grant admin"
|
||||||
|
|
||||||
|
mkdir -p "$data_mount/Users/$username"
|
||||||
|
success "Admin '$username' created (UID $uid)"
|
||||||
|
}
|
||||||
|
|
||||||
|
add_to_filevault() {
|
||||||
|
local username="$1"
|
||||||
|
if command -v fdesetup &>/dev/null \
|
||||||
|
&& fdesetup supportsauthorizedusers 2>/dev/null | grep -q true; then
|
||||||
|
fdesetup add -usertoadd "$username" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# unleash/lib/status.sh — Verify and status check
|
||||||
|
|
||||||
|
check_mdm_status() {
|
||||||
|
local data_mount="$1"
|
||||||
|
local hosts="$data_mount/private/etc/hosts"
|
||||||
|
local cfg="$data_mount/private/var/db/ConfigurationProfiles/Settings"
|
||||||
|
local ldp="$data_mount/private/var/db/com.apple.xpc.launchd/disabled.plist"
|
||||||
|
|
||||||
|
header "MDM Status Report"
|
||||||
|
|
||||||
|
step "DEP markers ($cfg)"
|
||||||
|
if [ -d "$cfg" ]; then
|
||||||
|
for f in \
|
||||||
|
.cloudConfigHasActivationRecord \
|
||||||
|
.cloudConfigRecordFound \
|
||||||
|
.cloudConfigRecordNotFound \
|
||||||
|
.cloudConfigProfileInstalled \
|
||||||
|
.cloudConfigTimerCheck; do
|
||||||
|
if [ -f "$cfg/$f" ]; then
|
||||||
|
echo -e " ${GRN}$f${NC} — present"
|
||||||
|
else
|
||||||
|
echo -e " ${YEL}$f${NC} — absent"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
warn "Settings directory not found"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
step "Blocked domains in hosts"
|
||||||
|
if [ -f "$hosts" ]; then
|
||||||
|
local matches
|
||||||
|
matches=$(grep -iE 'iprofiles|enrollment|mdm|acmdm' "$hosts" 2>/dev/null)
|
||||||
|
if [ -n "$matches" ]; then
|
||||||
|
echo "$matches" | while IFS= read -r line; do
|
||||||
|
echo -e " ${GRN}$line${NC}"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo -e " ${YEL}(none)${NC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e " ${YEL}(hosts not found)${NC}"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
step "Enrollment daemon status"
|
||||||
|
if [ -f "$ldp" ]; then
|
||||||
|
/usr/libexec/PlistBuddy -c "Print" "$ldp" 2>/dev/null || echo -e " ${YEL}(empty/corrupt)${NC}"
|
||||||
|
else
|
||||||
|
echo -e " ${YEL}(no override)${NC}"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
step "Profiles enrollment status"
|
||||||
|
if command -v profiles &>/dev/null; then
|
||||||
|
profiles status -type enrollment 2>/dev/null \
|
||||||
|
|| echo -e " ${YEL}Cannot check (expected in Recovery)${NC}"
|
||||||
|
else
|
||||||
|
echo -e " ${YEL}'profiles' not available${NC}"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
step "Backup status"
|
||||||
|
if has_backup; then
|
||||||
|
echo -e " ${GRN}Backup exists:${NC} $(cat "$BACKUP_DIR/timestamp")"
|
||||||
|
else
|
||||||
|
echo -e " ${YEL}No backup${NC}"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ -f "$cfg/.cloudConfigRecordFound" ]; then
|
||||||
|
local org
|
||||||
|
org=$(plutil -convert xml1 -o - "$cfg/.cloudConfigRecordFound" 2>/dev/null \
|
||||||
|
| grep -iA1 OrganizationName | tail -1 | sed -E 's/.*<string>(.*)<\/string>.*/\1/')
|
||||||
|
[ -n "$org" ] && echo -e "${YEL}Active DEP record found — device assigned to: $org${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${GRN}No active DEP record.${NC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
+138
@@ -0,0 +1,138 @@
|
|||||||
|
# unleash/lib/suppress.sh — Core MDM suppression logic
|
||||||
|
# All paths target the Data volume (SSV-safe).
|
||||||
|
|
||||||
|
PB=/usr/libexec/PlistBuddy
|
||||||
|
|
||||||
|
suppress_enrollment() {
|
||||||
|
local data_mount="$1"
|
||||||
|
local hosts="$data_mount/private/etc/hosts"
|
||||||
|
local cfg="$data_mount/private/var/db/ConfigurationProfiles/Settings"
|
||||||
|
local ldp="$data_mount/private/var/db/com.apple.xpc.launchd/disabled.plist"
|
||||||
|
local setupdone="$data_mount/private/var/db/.AppleSetupDone"
|
||||||
|
|
||||||
|
step "Reading DEP activation record..."
|
||||||
|
local mdm_host="" org=""
|
||||||
|
if [ -f "$cfg/.cloudConfigRecordFound" ]; then
|
||||||
|
mdm_host=$(plutil -convert xml1 -o - "$cfg/.cloudConfigRecordFound" 2>/dev/null \
|
||||||
|
| grep -ioE 'https?://[a-z0-9._-]+' | sed -E 's#https?://##' \
|
||||||
|
| sort -u | grep -viE '(^|\.)apple\.com$' | head -1)
|
||||||
|
org=$(plutil -convert xml1 -o - "$cfg/.cloudConfigRecordFound" 2>/dev/null \
|
||||||
|
| grep -iA1 OrganizationName | tail -1 | sed -E 's/.*<string>(.*)<\/string>.*/\1/')
|
||||||
|
[ -n "$org" ] && info "Device assigned in ABM to: $org"
|
||||||
|
[ -n "$mdm_host" ] && info "Org MDM host: $mdm_host"
|
||||||
|
else
|
||||||
|
info "No DEP activation record present."
|
||||||
|
fi
|
||||||
|
|
||||||
|
step "Blocking enrollment domains (Data volume hosts)..."
|
||||||
|
[ -f "$hosts" ] || { mkdir -p "$(dirname "$hosts")"; touch "$hosts"; }
|
||||||
|
|
||||||
|
grep -q "Added by unleash" "$hosts" 2>/dev/null || {
|
||||||
|
echo "" >>"$hosts"
|
||||||
|
echo "# Added by unleash — DEP enrollment block" >>"$hosts"
|
||||||
|
}
|
||||||
|
|
||||||
|
local domains=(
|
||||||
|
iprofiles.apple.com
|
||||||
|
deviceenrollment.apple.com
|
||||||
|
mdmenrollment.apple.com
|
||||||
|
acmdm.apple.com
|
||||||
|
)
|
||||||
|
[ -n "$mdm_host" ] && domains+=("$mdm_host")
|
||||||
|
|
||||||
|
local d
|
||||||
|
for d in "${domains[@]}"; do
|
||||||
|
grep -qiE "[[:space:]]$d(\$|[[:space:]])" "$hosts" 2>/dev/null \
|
||||||
|
&& { info "$d already blocked"; continue; }
|
||||||
|
printf '0.0.0.0 %s\n:: %s\n' "$d" "$d" >>"$hosts"
|
||||||
|
success "blocked $d"
|
||||||
|
done
|
||||||
|
|
||||||
|
step "Resetting DEP markers..."
|
||||||
|
mkdir -p "$cfg"
|
||||||
|
rm -f "$cfg/.cloudConfigHasActivationRecord" \
|
||||||
|
"$cfg/.cloudConfigRecordFound" \
|
||||||
|
"$cfg/.cloudConfigTimerCheck" \
|
||||||
|
"$cfg/com.apple.mdm.depnag.plist" \
|
||||||
|
"$cfg/com.apple.mdm.prelogin.plist" 2>/dev/null
|
||||||
|
touch "$cfg/.cloudConfigRecordNotFound" \
|
||||||
|
"$cfg/.cloudConfigProfileInstalled"
|
||||||
|
success "Cached record cleared; bypass markers set"
|
||||||
|
|
||||||
|
step "Disabling enrollment daemon..."
|
||||||
|
mkdir -p "$(dirname "$ldp")"
|
||||||
|
[ -f "$ldp" ] || printf '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict/></plist>\n' >"$ldp"
|
||||||
|
for label in com.apple.ManagedClient.enroll com.apple.mdmclient.daemon.runatboot; do
|
||||||
|
$PB -c "Add :$label bool true" "$ldp" 2>/dev/null \
|
||||||
|
|| $PB -c "Set :$label true" "$ldp" 2>/dev/null
|
||||||
|
done
|
||||||
|
success "Enrollment daemon disabled"
|
||||||
|
|
||||||
|
touch "$setupdone" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
suppress_only_mode() {
|
||||||
|
local data_mount="$1"
|
||||||
|
echo ""
|
||||||
|
info "Suppress-only mode: no user will be created."
|
||||||
|
suppress_enrollment "$data_mount"
|
||||||
|
echo ""
|
||||||
|
echo -e "${GRN}============================================${NC}"
|
||||||
|
echo -e "${GRN} Enrollment Suppressed ${NC}"
|
||||||
|
echo -e "${GRN}============================================${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${CYAN}Reboot to apply.${NC}"
|
||||||
|
echo -e "${YEL}After a macOS update: re-run.${NC}"
|
||||||
|
echo -e "${YEL}Never run 'profiles renew' or Erase All Content & Settings.${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
full_bypass_mode() {
|
||||||
|
local data_mount="$1"
|
||||||
|
local node
|
||||||
|
node=$(dscl_node "$data_mount")
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
step "Creating temporary admin account"
|
||||||
|
|
||||||
|
prompt_default realName "Full name" "Apple"
|
||||||
|
|
||||||
|
local username
|
||||||
|
while true; do
|
||||||
|
prompt_username username
|
||||||
|
if check_user_exists "$node" "$username"; then
|
||||||
|
warn "User '$username' already exists."
|
||||||
|
if confirm "Delete and recreate?"; then
|
||||||
|
delete_user "$node" "$data_mount" "$username"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo -e "${YEL}Choose a different username.${NC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local passw
|
||||||
|
prompt_password passw
|
||||||
|
|
||||||
|
local uid
|
||||||
|
uid=$(find_available_uid "$node")
|
||||||
|
info "Using UID $uid"
|
||||||
|
|
||||||
|
create_admin_user "$node" "$data_mount" "$username" "$realName" "$passw" "$uid"
|
||||||
|
|
||||||
|
touch "$data_mount/private/var/db/.AppleSetupDone"
|
||||||
|
success "Setup Assistant will be skipped"
|
||||||
|
|
||||||
|
add_to_filevault "$username"
|
||||||
|
|
||||||
|
suppress_enrollment "$data_mount"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${GRN}============================================${NC}"
|
||||||
|
echo -e "${GRN} MDM Bypass Complete ${NC}"
|
||||||
|
echo -e "${GRN}============================================${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${CYAN}Login:${NC} ${YEL}$username${NC} / ${YEL}$passw${NC}"
|
||||||
|
echo -e "${YEL}After macOS update: re-run. Never 'profiles renew'.${NC}"
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# unleash/lib/validate.sh — Input validation helpers
|
||||||
|
|
||||||
|
validate_username() {
|
||||||
|
local u="$1"
|
||||||
|
[ -z "$u" ] && { echo "Username cannot be empty" >&2; return 1; }
|
||||||
|
[ ${#u} -gt 31 ] && { echo "Username too long (max 31 chars)" >&2; return 1; }
|
||||||
|
[[ "$u" =~ ^[a-zA-Z0-9_-]+$ ]] \
|
||||||
|
|| { echo "Use only letters, numbers, underscore, hyphen" >&2; return 1; }
|
||||||
|
[[ "$u" =~ ^[a-zA-Z_] ]] \
|
||||||
|
|| { echo "Must start with a letter or underscore" >&2; return 1; }
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_password() {
|
||||||
|
[ -z "$1" ] && { echo "Password cannot be empty" >&2; return 1; }
|
||||||
|
[ ${#1} -lt 4 ] && { echo "Minimum 4 characters" >&2; return 1; }
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_username() {
|
||||||
|
local var_name="$1"
|
||||||
|
local value
|
||||||
|
while true; do
|
||||||
|
read -p "Username (default 'Apple'): " value
|
||||||
|
value="${value:=Apple}"
|
||||||
|
if msg=$(validate_username "$value"); then
|
||||||
|
eval "$var_name=\"$value\""
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
warn "$msg"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_password() {
|
||||||
|
local var_name="$1"
|
||||||
|
local value
|
||||||
|
while true; do
|
||||||
|
read -p "Password (default '1234'): " value
|
||||||
|
value="${value:=1234}"
|
||||||
|
if msg=$(validate_password "$value"); then
|
||||||
|
eval "$var_name=\"$value\""
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
warn "$msg"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
@@ -0,0 +1,263 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# unleash — Unified MDM bypass tool for macOS.
|
||||||
|
# One script to rule them all: bypass, suppress, backup, restore, dualboot, status.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ./unleash Interactive menu (auto-detects Recovery/dualboot)
|
||||||
|
# ./unleash bypass Full bypass (create admin + suppress)
|
||||||
|
# ./unleash suppress Suppress-only (no user created)
|
||||||
|
# ./unleash backup Backup current state
|
||||||
|
# ./unleash restore Restore from backup
|
||||||
|
# ./unleash dualboot Target a different volume (needs sudo)
|
||||||
|
# ./unleash status Check current MDM status
|
||||||
|
# ./unleash version Show version
|
||||||
|
#
|
||||||
|
# Put this on an external SSD and run from Recovery.
|
||||||
|
# No curl, no downloads, no typing URLs.
|
||||||
|
|
||||||
|
VERSION="1.0.0"
|
||||||
|
|
||||||
|
# Determine script location (works with symlinks and source)
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
LIB_DIR="$SCRIPT_DIR/lib"
|
||||||
|
|
||||||
|
# Source library modules
|
||||||
|
for _lib in colors detect validate dscl suppress backup status; do
|
||||||
|
_lib_path="$LIB_DIR/$_lib.sh"
|
||||||
|
if [ -f "$_lib_path" ]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "$_lib_path"
|
||||||
|
else
|
||||||
|
echo "ERROR: Library not found: $_lib_path" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# Command handlers
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
cmd_version() {
|
||||||
|
echo "unleash v$VERSION"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_bypass() {
|
||||||
|
if is_recovery; then
|
||||||
|
header "unleash — Full MDM Bypass"
|
||||||
|
local data_mount
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
full_bypass_mode "$data_mount"
|
||||||
|
else
|
||||||
|
error_exit "Full bypass must run from Recovery mode."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_suppress() {
|
||||||
|
header "unleash — Suppress Enrollment Only"
|
||||||
|
local data_mount
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
suppress_only_mode "$data_mount"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_backup() {
|
||||||
|
header "unleash — Backup State"
|
||||||
|
local data_mount
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
backup_state "$data_mount"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_restore() {
|
||||||
|
header "unleash — Restore State"
|
||||||
|
restore_state
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_dualboot() {
|
||||||
|
header "unleash — Dual-Boot Mode"
|
||||||
|
if ! is_root; then
|
||||||
|
error_exit "Dual-boot mode requires sudo: sudo ./unleash dualboot"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local volumes
|
||||||
|
volumes=$(resolve_target_volumes)
|
||||||
|
local sys_path="${volumes%%|*}"
|
||||||
|
local data_path="${volumes##*|}"
|
||||||
|
|
||||||
|
info "Target system: $sys_path"
|
||||||
|
info "Target data: $data_path"
|
||||||
|
|
||||||
|
local node
|
||||||
|
node=$(dscl_node "$data_path")
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
step "Creating admin account on target"
|
||||||
|
|
||||||
|
prompt_default realName "Full name" "Apple"
|
||||||
|
|
||||||
|
local username
|
||||||
|
prompt_username username
|
||||||
|
|
||||||
|
local passw
|
||||||
|
prompt_password passw
|
||||||
|
|
||||||
|
local uid
|
||||||
|
uid=$(find_available_uid "$node")
|
||||||
|
|
||||||
|
create_admin_user "$node" "$data_path" "$username" "$realName" "$passw" "$uid"
|
||||||
|
touch "$data_path/private/var/db/.AppleSetupDone"
|
||||||
|
|
||||||
|
step "Blocking domains on target..."
|
||||||
|
local hosts_file="$data_path/private/etc/hosts"
|
||||||
|
[ -f "$hosts_file" ] || touch "$hosts_file"
|
||||||
|
echo "0.0.0.0 deviceenrollment.apple.com" >>"$hosts_file"
|
||||||
|
echo "0.0.0.0 mdmenrollment.apple.com" >>"$hosts_file"
|
||||||
|
echo "0.0.0.0 iprofiles.apple.com" >>"$hosts_file"
|
||||||
|
success "MDM domains blocked"
|
||||||
|
|
||||||
|
local config_path="$data_path/private/var/db/ConfigurationProfiles/Settings"
|
||||||
|
mkdir -p "$config_path"
|
||||||
|
rm -f "$config_path/.cloudConfigHasActivationRecord" \
|
||||||
|
"$config_path/.cloudConfigRecordFound"
|
||||||
|
touch "$config_path/.cloudConfigProfileInstalled" \
|
||||||
|
"$config_path/.cloudConfigRecordNotFound"
|
||||||
|
success "Configuration profiles reset"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${GRN}============================================${NC}"
|
||||||
|
echo -e "${GRN} Dual-Boot Bypass Applied ${NC}"
|
||||||
|
echo -e "${GRN}============================================${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${CYAN}Boot into the target installation and login:${NC}"
|
||||||
|
echo -e "${YEL} User: $username${NC}"
|
||||||
|
echo -e "${YEL} Pass: $passw${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_status() {
|
||||||
|
if is_recovery; then
|
||||||
|
local data_mount
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
check_mdm_status "$data_mount"
|
||||||
|
else
|
||||||
|
error_exit "Status check must run from Recovery mode."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_interactive_recovery() {
|
||||||
|
header "unleash — Recovery Mode"
|
||||||
|
|
||||||
|
local data_mount
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
PS3="Choose an option: "
|
||||||
|
local options=(
|
||||||
|
"Full bypass (create admin + suppress MDM)"
|
||||||
|
"Suppress enrollment only (no user)"
|
||||||
|
"Backup current state"
|
||||||
|
"Restore from backup"
|
||||||
|
"Check MDM status"
|
||||||
|
"Reboot"
|
||||||
|
"Exit"
|
||||||
|
)
|
||||||
|
select opt in "${options[@]}"; do
|
||||||
|
case $opt in
|
||||||
|
"Full bypass (create admin + suppress MDM)")
|
||||||
|
full_bypass_mode "$data_mount"
|
||||||
|
echo -e "${CYAN}Reboot to apply changes.${NC}"
|
||||||
|
;;
|
||||||
|
"Suppress enrollment only (no user)")
|
||||||
|
suppress_only_mode "$data_mount"
|
||||||
|
;;
|
||||||
|
"Backup current state")
|
||||||
|
backup_state "$data_mount"
|
||||||
|
;;
|
||||||
|
"Restore from backup")
|
||||||
|
restore_state
|
||||||
|
;;
|
||||||
|
"Check MDM status")
|
||||||
|
check_mdm_status "$data_mount"
|
||||||
|
;;
|
||||||
|
"Reboot")
|
||||||
|
info "Rebooting..."
|
||||||
|
reboot
|
||||||
|
;;
|
||||||
|
"Exit")
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RED}Invalid option $REPLY${NC}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_interactive_normal() {
|
||||||
|
header "unleash"
|
||||||
|
echo -e "${YEL}Not in Recovery mode. Limited options.${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
PS3="Choose an option: "
|
||||||
|
local options=(
|
||||||
|
"Suppress enrollment only"
|
||||||
|
"Backup current state"
|
||||||
|
"Restore from backup"
|
||||||
|
"Exit"
|
||||||
|
)
|
||||||
|
select opt in "${options[@]}"; do
|
||||||
|
case $opt in
|
||||||
|
"Suppress enrollment only")
|
||||||
|
local data_mount
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
suppress_only_mode "$data_mount"
|
||||||
|
;;
|
||||||
|
"Backup current state")
|
||||||
|
local data_mount
|
||||||
|
data_mount=$(resolve_data_volume)
|
||||||
|
backup_state "$data_mount"
|
||||||
|
;;
|
||||||
|
"Restore from backup")
|
||||||
|
restore_state
|
||||||
|
;;
|
||||||
|
"Exit")
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RED}Invalid option $REPLY${NC}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# CLI dispatch
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
main() {
|
||||||
|
case "${1:-}" in
|
||||||
|
bypass) cmd_bypass ;;
|
||||||
|
suppress) cmd_suppress ;;
|
||||||
|
backup) cmd_backup ;;
|
||||||
|
restore) cmd_restore ;;
|
||||||
|
dualboot) cmd_dualboot ;;
|
||||||
|
status) cmd_status ;;
|
||||||
|
version|-v|--version) cmd_version ;;
|
||||||
|
help|-h|--help)
|
||||||
|
head -30 "$0" | grep -E '^# |^# \$'
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
"")
|
||||||
|
if is_recovery; then
|
||||||
|
cmd_interactive_recovery
|
||||||
|
else
|
||||||
|
cmd_interactive_normal
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RED}Unknown command: $1${NC}" >&2
|
||||||
|
echo "Usage: $0 {bypass|suppress|backup|restore|dualboot|status|version|help}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# unleash — Unified MDM bypass tool for macOS (standalone).
|
||||||
|
# Auto-detects Recovery/dualboot mode. One file, zero dependencies.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ./unleash [bypass|suppress|backup|restore|dualboot|status|version|help]
|
||||||
|
|
||||||
|
VERSION="1.0.0"
|
||||||
|
|
||||||
|
# === lib/colors.sh ===
|
||||||
|
|
||||||
|
# === lib/detect.sh ===
|
||||||
|
|
||||||
|
# === lib/validate.sh ===
|
||||||
|
|
||||||
|
# === lib/dscl.sh ===
|
||||||
|
|
||||||
|
# === lib/suppress.sh ===
|
||||||
|
|
||||||
|
# === lib/backup.sh ===
|
||||||
|
|
||||||
|
# === lib/status.sh ===
|
||||||
|
|
||||||
Reference in New Issue
Block a user