#!/system/bin/sh # CellGuard — KernelSU-Next "Action" button handler. Status readout only. MODDIR=${0%/*} PATH=/system/bin:$PATH CG=/data/adb/cellguard kv() { grep -m1 "^$1=" "$CG/status" 2>/dev/null | cut -d= -f2-; } echo "== CellGuard ==" # --- enforcement: block 2G/3G (ratlock) --- if pgrep -f ratlock.sh >/dev/null 2>&1; then if [ "$(cat "$CG/enabled" 2>/dev/null)" = "0" ]; then echo "Block 2G/3G: OFF (all RAT allowed)" else echo "Block 2G/3G: ON (LTE + 5G/NR only)" fi else echo "Block 2G/3G: daemon not running — reboot" fi for s in 0 1; do v=$(cmd phone get-allowed-network-types-for-users -s "$s" 2>/dev/null) [ -n "$v" ] && echo " SIM$s allowed: $v" done # --- detection (cgdetect) --- if pgrep -f cgdetect.sh >/dev/null 2>&1; then if [ "$(cat "$CG/detect_enabled" 2>/dev/null)" = "0" ]; then echo "Detection: OFF" else echo "Detection: ON" fi else echo "Detection: daemon not running — reboot" fi # --- live serving + capture --- rat=$(kv rat); plmn=$(kv plmn); op=$(kv operator) [ -n "$rat" ] && echo "Serving: $rat $op PLMN $plmn" if [ -e /proc/cgcap/frames ]; then echo "Diag capture: $(head -1 /proc/cgcap/frames | sed -n 's/.*total=\([0-9]*\).*/\1/p') frames" else echo "Diag capture: cgcap not loaded" fi echo "Alerts: $(grep -c . "$CG/alerts" 2>/dev/null)"