mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 13:23:15 +02:00
The Magisk app's Modules tab "Disable" / "Remove" buttons work by creating marker files (disable, remove) in /data/adb/modules/hosts/. Tapping Disable in the app on next boot would skip the module's magic-mount of /system/etc/hosts, silently disabling all hosts-file blocking. Defense in depth: 1. deploy.sh chattr +i's the module dir + its hosts file so the Magisk app cannot create disable/remove markers (kernel returns EPERM). The +i attribute survives reboot. 2. hosts_enforcer.sh adds protect_magisk_module(): every poll cycle (and on startup) scans for disable/remove/update markers, deletes them, logs TAMPER, and re-asserts +i on the dir. Safety net in case the lock is bypassed. 3. sync_magisk_module() now drops +i briefly before its cp and re-locks via protect_magisk_module() so workout-state hosts swaps still work. 4. deploy.sh detects the previously-silent failure mode of the module being enabled on disk but not yet magic-mounted (no /system/etc/hosts) and aborts with a clear reboot-required message instead of producing a deploy that does nothing. 5. focus_ctl.sh hosts-status now prints the lock state and warns about any present markers. Verified end-to-end on BL9000EEA0000102: - Pre-reboot: chattr +i set, touch /data/adb/modules/hosts/disable returns Operation not permitted. - Post-reboot: /system/etc/hosts magic-mounted (178303 lines, sha matches canonical), lock survives reboot, ping youtube.com -> 127.0.0.1. - Tamper test: chattr -i + touch disable -> enforcer logs 'TAMPER: removed Magisk module marker' within 15s and re-locks. Documented intentional override path inline (focus_ctl.sh hosts-stop; chattr -i; touch disable). |
||
|---|---|---|
| .github | ||
| .vscode | ||
| C | ||
| CPP | ||
| docs/superpowers | ||
| horatio | ||
| linux_configuration | ||
| phone_focus_mode | ||
| pomodoro_app | ||
| python_pkg | ||
| robotgo_demo | ||
| scripts | ||
| sonic_pi | ||
| TS | ||
| .binary-allowlist | ||
| .copilotignore | ||
| .fvmrc | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| batch3_bloatware_uninstall.sh | ||
| COMPLETE_IMPLEMENTATION_SUMMARY.md | ||
| DELIVERABLES_INDEX.md | ||
| eslint.config.mjs | ||
| lint_python.sh | ||
| out.json | ||
| package-lock.json | ||
| package.json | ||
| POLLING_OPTIMIZATION_REPORT.md | ||
| pyproject.toml | ||
| QUICK_OPTIMIZATION_GUIDE.md | ||
| QUICK_REFERENCE_SHELL_QUALITY.md | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| run.sh | ||
| setup.sh | ||
| SHELL_QUALITY_IMPLEMENTATION_SUMMARY.md | ||
| SHELL_SCRIPT_QUALITY_GUIDELINES.md | ||
testsAndMisc
A collection of personal projects, scripts, and experiments — from a GPS-based phone focus tool to C/C++ demos, with CI, linting, and pre-commit hooks across the board.
Highlights
Phone Focus Mode
Location-based app restriction for rooted Android. Automatically disables non-whitelisted apps within 500 m of home using ADB + Magisk. Features Haversine distance calculation, hysteresis to prevent toggling, fail-safe unlock, and state persistence. Bash, Android ADB.
Linux Configuration
Automated Arch Linux setup: fresh-install scripts, i3 window manager config, LaTeX environment, and system tests. Includes documentation and test result logging.
Scripts
Utility scripts for development workflows — C/C++ build file validation, secret detection, and custom makepkg helpers.
Other Projects
| Directory | Description |
|---|---|
poker_modifier_app/ |
Browser-based poker hand modifier (HTML/JS) |
pomodoro_app/ |
Pomodoro timer (Flutter) |
Bash/ |
FFmpeg build scripts |
C/, CPP/, TS/ |
Language-specific experiments |
sonic_pi/ |
Music programming experiments |
robotgo_demo/ |
Go desktop automation demo |
python_pkg/ |
Python package structure example |
Tooling
- Python linting: Ruff with all rules enabled (see
pyproject.toml) - JS/TS linting: ESLint (flat config)
- CI: GitHub Actions — lint, build, and test on push
- Testing: pytest (Python), custom shell-based test harness for scripts