From b14430ee3244e0144615c604887ca637b06949c9 Mon Sep 17 00:00:00 2001 From: ruihan Date: Sat, 20 Jun 2026 13:30:13 -0300 Subject: [PATCH] v1.6.0: Homebrew tap, Pages, PT-BR docs, 6 new test modules --- CHANGELOG.md | 44 +++++++++++++++ README.pt-BR.md | 112 ++++++++++++++++++++++++++++++++++++++ docs/index.md | 43 +++++++++++++++ examples/record-demo.sh | 35 ++++++++++++ tests/test_check.bats | 21 +++++++ tests/test_config.bats | 37 +++++++++++++ tests/test_doctor.bats | 20 +++++++ tests/test_history.bats | 16 ++++++ tests/test_uninstall.bats | 12 ++++ tests/test_whitelist.bats | 23 ++++++++ unleash | 2 +- unleash-standalone.sh | 2 +- 12 files changed, 365 insertions(+), 2 deletions(-) create mode 100644 README.pt-BR.md create mode 100644 docs/index.md create mode 100644 examples/record-demo.sh create mode 100644 tests/test_check.bats create mode 100644 tests/test_config.bats create mode 100644 tests/test_doctor.bats create mode 100644 tests/test_history.bats create mode 100644 tests/test_uninstall.bats create mode 100644 tests/test_whitelist.bats diff --git a/CHANGELOG.md b/CHANGELOG.md index a411201..1a0a5da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,49 @@ # Changelog +## [1.6.0] — 2026-06-20 + +### Added +- **Homebrew tap**: `brew install mateussiqueira/unleash/unleash` +- **GitHub Pages**: full command reference at https://mateussiqueira.github.io/unleash/ +- **README.pt-BR.md**: Brazilian Portuguese translation +- **Bats tests**: doctor, whitelist, config, check, history, uninstall modules +- **docs/index.md**: landing page for GitHub Pages + +### Changed +- Version bumped to 1.6.0 +- Homebrew formula in separate tap repository + +## [1.5.0] — 2026-06-20 + +### Added +- **report**: Human-readable or JSON-format system audit report +- **demo**: Simulated MDM bypass flow (no real changes) +- **vpn-kill**: pf kill-switch that blocks MDM outside VPN tunnel +- Third-party firewall detection (Little Snitch, LuLu, Radio Silence) + +### Fixed +- Migration Assistant artifact cleanup now covers all users + +## [1.4.0] — 2026-06-20 + +### Added +- **doctor**: Pre-flight diagnostics (root, Recovery, libs, disk, dependencies) +- **update**: Self-update from GitHub releases +- **uninstall**: Complete removal with 4 safety prompts +- **reinstall**: Atomic update (uninstall + install) + +## [1.3.0] — 2026-06-20 + +### Added +- **config**: Persistent settings in ~/.unleash.conf +- **test** command / `--dry-run` global flag +- **history / history-clear**: Event log viewer +- Structured logging (levels, timestamps, color, file output) +- CLI aliases for every command + +### Changed +- README rewritten (140 → 489 lines) — comprehensive command reference + ## [1.2.0] — 2026-06-20 ### Added diff --git a/README.pt-BR.md b/README.pt-BR.md new file mode 100644 index 0000000..208bdda --- /dev/null +++ b/README.pt-BR.md @@ -0,0 +1,112 @@ +# unleash + +Ferramenta única para bypass/supressão de MDM no macOS. Funciona do Modo de Recuperação. Apple Silicon e Intel. + +> Leia em: [English](README.md) | **Português** + +## Instalação rápida + +```bash +# Homebrew (mais fácil) +brew install mateussiqueira/unleash/unleash + +# Download direto +curl -L https://raw.githubusercontent.com/mateussiqueira/unleash/main/unleash-standalone.sh -o unleash +chmod +x unleash && sudo ./unleash +``` + +## Como usar + +1. Copie a pasta `unleash` para um SSD externo (FAT32/APFS/exFAT) +2. Inicialize no Modo de Recuperação: + - **Apple Silicon**: segure o botão de energia → Opções → Continuar + - **Intel**: Cmd+R na inicialização +3. Abra o Terminal (Utilitários) e execute: + +```bash +chmod +x "/Volumes/SeuSSD/unleash/unleash" +"/Volumes/SeuSSD/unleash/unleash" +``` + +Escolha "Full bypass" no menu. Ou use a linha de comando: + +```bash +"/Volumes/SeuSSD/unleash/unleash" bypass +``` + +## Comandos principais + +| Comando | Função | +|---------|--------| +| `bypass` | Bypass completo — cria admin + suprime MDM | +| `suppress` | Silencia o MDM sem criar usuário | +| `heal` | Verifica e reaplica supressão após updates | +| `persist` | Auto-heal em toda inicialização | +| `firewall` | Bloqueia IPs da Apple via pf (kernel) | +| `whitelist` | Bloqueia só MDM, mantém iCloud | +| `harden` | Mata processos MDM + remove perfis | +| `audit` | Varredura profunda + score de risco | +| `check` | Relatório pré-formatação | +| `monitor` | Vigia MDM a cada 5min | +| `doctor` | Diagnóstico pré-vôo completo | +| `report` | Status completo do sistema | +| `demo` | Simulação sem alterar nada | +| `vpn-kill` | Bloqueia MDM fora da VPN | +| `update` | Auto-update do GitHub | +| `uninstall` | Remove todos os vestígios | +| `test` | Simulação (dry-run) | + +## Aliases + +`by` = bypass, `sv` = suppress, `fw` = firewall, `wl` = whitelist, +`st` = status, `mn` = monitor, `doc` = doctor, `up` = update + +## Por que não usar só o bypass-mdm? + +O projeto original cresceu para 5 scripts (v2, v3, express, dualboot.sh, verify.sh), cada um com opções diferentes. O Unleash substitui todos em um único comando. + +## Como funciona + +O MDM opera em 4 camadas. O Unleash ataca todas: + +1. **Marcadores DEP** — remove arquivos `.cloudConfig*`, cria iscas +2. **Rede** — `/etc/hosts` bloqueia 13+ domínios Apple + servidor MDM da org +3. **Daemons** — desabilita `ManagedClient.enroll`, `activationd`, etc +4. **Usuário** — limpa `~/Library/Preferences/com.apple.mdm.*` de todos os usuários + +Firewall pf (comandos `firewall`/`whitelist`) pega o que o `/etc/hosts` não consegue — especialmente DNS-over-HTTPS. + +## Intel vs Apple Silicon + +| | Intel T2 | Apple Silicon | +|---|---|---| +| Recuperação | Cmd+R | Segurar Power | +| Volume sistema | Gravável (SIP off) | SSV (só leitura) | +| FileVault | Suportado | Suportado | +| Migration Assistant | Menos risco | **Traz MDM de volta** | + +## Migration Assistant + +Se você migrar de um Intel para Apple Silicon, o MDM vai voltar após o reboot. O Migration Assistant copia artefatos de usuário que os scripts antigos não limpam. O Unleash limpa `/Users/*/Library` explicitamente. + +Se ainda assim voltar, execute `sudo ./unleash harden` do sistema já iniciado. + +## Troubleshooting + +**MDM volta após reboot** — execute `unleash suppress` da Recuperação. Se persistir, são artefatos do Migration Assistant. Execute `unleash harden` após o login. + +**profiles mostra matrícula** — cosmético. O SSV armazena estado de perfil em modo somente leitura. Verifique os marcadores DEP com `unleash status`. + +**FileVault não desbloqueia** — você precisa da senha de um usuário ou da chave de recuperação. + +**Update do macOS** — execute `unleash heal`. Se usou `persist` antes do update, ele faz isso automaticamente. + +## Limitações + +- O serial continua no Apple Business Manager. Só a organização pode remover. +- Um wipe completo limpa o volume de Dados — execute novamente da Recuperação. +- O bloqueio de hosts pode ser burlado por DNS cache ou DoH. Firewall pf resolve. + +## Licença + +MIT. Veja [LICENSE](LICENSE). diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..0bec68b --- /dev/null +++ b/docs/index.md @@ -0,0 +1,43 @@ +# unleash + +Single-script MDM bypass for macOS. Apple Silicon + Intel. Recovery mode. + +## Quick install + +```bash +# Homebrew (easiest) +brew install mateussiqueira/unleash/unleash + +# Or download directly +curl -L https://raw.githubusercontent.com/mateussiqueira/unleash/main/unleash-standalone.sh -o unleash +chmod +x unleash && sudo ./unleash +``` + +## Commands + +| Command | What it does | +|---------|-------------| +| `bypass` | Full MDM bypass from Recovery | +| `suppress` | Silence enrollment, no user | +| `heal` | Fix after macOS updates | +| `persist` | Auto-heal on every boot | +| `firewall` | Block MDM at kernel level (pf) | +| `whitelist` | Block MDM only, keep iCloud | +| `harden` | Kill MDM + remove profiles | +| `audit` | Deep scan + risk score | +| `check` | Pre-format safety report | +| `monitor` | Watch MDM every 5min | +| `doctor` | Pre-flight diagnostics | +| `report` | Full system status | +| `demo` | Simulated bypass (no real changes) | +| `vpn-kill` | Block MDM outside VPN | +| `update` | Self-update from GitHub | +| `uninstall` | Remove all traces | +| `test` | Dry-run simulation | + +## Documentation + +- [Full README](https://github.com/mateussiqueira/unleash) +- [Quick Reference](https://github.com/mateussiqueira/unleash/blob/main/QUICKSTART.md) +- [Contributing](https://github.com/mateussiqueira/unleash/blob/main/CONTRIBUTING.md) +- [Changelog](https://github.com/mateussiqueira/unleash/blob/main/CHANGELOG.md) diff --git a/examples/record-demo.sh b/examples/record-demo.sh new file mode 100644 index 0000000..02b3364 --- /dev/null +++ b/examples/record-demo.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# record-demo.sh +# Generates a terminal demo output for README/site. +# Run: bash record-demo.sh > demo-output.txt + +echo "$ ./unleash --version" +./unleash --version +echo "" + +echo "$ sudo ./unleash doctor" +echo "[SUDO] Simulated doctor output for demo:" +echo " ✓ Script location: /Users/user/unleash" +echo " ✓ Library files: 21/21 modules loaded" +echo " ✓ Root privileges" +echo " ⚠ Recovery mode: no (limited to booted commands)" +echo " ✓ Disk space: 89234 MB free" +echo " ✓ pfctl available" +echo " ✓ profiles command" +echo " ✓ launchctl available" +echo " ⚠ Third-party firewall: Little Snitch detected" +echo "" + +echo "$ sudo ./unleash check" +sudo ./unleash check 2>/dev/null || echo "[DEMO] Would show pre-format assessment" +echo "" + +echo "$ sudo ./unleash audit" +echo "[DEMO] Audit scan complete:" +echo " Profiles: 0" +echo " DEP record: clean" +echo " Risk: LOW" +echo "" + +echo "$ ./unleash --version" +./unleash --version diff --git a/tests/test_check.bats b/tests/test_check.bats new file mode 100644 index 0000000..7141db4 --- /dev/null +++ b/tests/test_check.bats @@ -0,0 +1,21 @@ +#!/usr/bin/env bats + +setup() { + load '../lib/colors.sh' + load '../lib/check.sh' +} + +@test "run_preformat_check exits cleanly" { + run run_preformat_check 2>/dev/null || true + [ "$status" -eq 0 ] +} + +@test "check_upgrade_safety exits cleanly" { + run check_upgrade_safety 2>/dev/null || true + [ "$status" -eq 0 ] +} + +@test "run_preformat_check contains SAFE or MDM" { + run run_preformat_check 2>/dev/null || true + echo "$output" | grep -qiE "safe|mdm" +} diff --git a/tests/test_config.bats b/tests/test_config.bats new file mode 100644 index 0000000..e4c60a9 --- /dev/null +++ b/tests/test_config.bats @@ -0,0 +1,37 @@ +#!/usr/bin/env bats + +setup() { + load '../lib/colors.sh' + load '../lib/config.sh' + CONFIG_FILE=$(mktemp) +} + +teardown() { + rm -f "$CONFIG_FILE" +} + +@test "load_config handles missing file" { + CONFIG_FILE="/nonexistent/config" + run load_config + [ "$status" -eq 0 ] +} + +@test "save_config writes key=value" { + save_config "WEBHOOK" "https://example.com" 2>/dev/null || true + run grep "WEBHOOK=https://example.com" "$CONFIG_FILE" + [ "$status" -eq 0 ] +} + +@test "load_config reads saved values" { + save_config "LOG_LEVEL" "verbose" 2>/dev/null || true + VERBOSE=false + load_config + [ "$VERBOSE" = true ] +} + +@test "save_config updates existing key" { + save_config "KEY" "old" 2>/dev/null || true + save_config "KEY" "new" 2>/dev/null || true + run grep -c "KEY=new" "$CONFIG_FILE" + [ "$output" -eq 1 ] +} diff --git a/tests/test_doctor.bats b/tests/test_doctor.bats new file mode 100644 index 0000000..7a87243 --- /dev/null +++ b/tests/test_doctor.bats @@ -0,0 +1,20 @@ +#!/usr/bin/env bats + +setup() { + load '../lib/colors.sh' + load '../lib/detect.sh' + load '../lib/doctor.sh' +} + +@test "run_doctor exits cleanly" { + run run_doctor 2>/dev/null || true + [ "$status" -eq 0 ] +} + +@test "run_doctor detects missing libs" { + local old_dir="$LIB_DIR" + LIB_DIR="/nonexistent" + run run_doctor 2>/dev/null || true + LIB_DIR="$old_dir" + echo "$output" | grep -qi "missing\|error" +} diff --git a/tests/test_history.bats b/tests/test_history.bats new file mode 100644 index 0000000..e4aec19 --- /dev/null +++ b/tests/test_history.bats @@ -0,0 +1,16 @@ +#!/usr/bin/env bats + +setup() { + load '../lib/colors.sh' + load '../lib/history.sh' +} + +@test "show_history exits cleanly with no logs" { + run show_history 2>/dev/null || true + [ "$status" -eq 0 ] +} + +@test "clear_history does not error with no logs" { + run clear_history 2>/dev/null || true + [ "$status" -eq 0 ] +} diff --git a/tests/test_uninstall.bats b/tests/test_uninstall.bats new file mode 100644 index 0000000..31f20f5 --- /dev/null +++ b/tests/test_uninstall.bats @@ -0,0 +1,12 @@ +#!/usr/bin/env bats + +setup() { + load '../lib/colors.sh' + load '../lib/uninstall.sh' +} + +@test "do_uninstall requires root" { + EUID=501 + run do_uninstall 2>/dev/null || true + [ "$status" -ne 0 ] +} diff --git a/tests/test_whitelist.bats b/tests/test_whitelist.bats new file mode 100644 index 0000000..0dc5504 --- /dev/null +++ b/tests/test_whitelist.bats @@ -0,0 +1,23 @@ +#!/usr/bin/env bats + +setup() { + load '../lib/colors.sh' + load '../lib/whitelist.sh' + TEST_DIR=$(mktemp -d) + mkdir -p "$TEST_DIR/etc/pf.anchors" +} + +teardown() { + rm -rf "$TEST_DIR" +} + +@test "install_selective_block creates anchor" { + run install_selective_block "$TEST_DIR" 2>/dev/null || true + [ -f "$TEST_DIR/etc/pf.anchors/com.unleash.selective" ] +} + +@test "install_selective_block contains MDM domains" { + run install_selective_block "$TEST_DIR" 2>/dev/null || true + run grep -c "mdmenrollment" "$TEST_DIR/etc/pf.anchors/com.unleash.selective" + [ "$output" -gt 0 ] +} diff --git a/unleash b/unleash index 4ec4ff8..cb38dfb 100755 --- a/unleash +++ b/unleash @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -VERSION="1.5.0" +VERSION="1.6.0" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" LIB_DIR="$SCRIPT_DIR/lib" diff --git a/unleash-standalone.sh b/unleash-standalone.sh index a1a0cd0..9c8b4fe 100755 --- a/unleash-standalone.sh +++ b/unleash-standalone.sh @@ -1,6 +1,6 @@ #!/bin/bash set -euo pipefail -VERSION="1.5.0" +VERSION="1.6.0" RED='\033[1;31m' GRN='\033[1;32m' BLU='\033[1;34m'