2026-07-12 09:21:54 -07:00
|
|
|
#!/system/bin/sh
|
2026-07-12 11:09:41 -07:00
|
|
|
# CellGuard — KernelSU-Next "Action" button handler. Status readout only.
|
2026-07-12 09:21:54 -07:00
|
|
|
MODDIR=${0%/*}
|
|
|
|
|
PATH=/system/bin:$PATH
|
2026-07-12 11:09:41 -07:00
|
|
|
CG=/data/adb/cellguard
|
|
|
|
|
|
|
|
|
|
kv() { grep -m1 "^$1=" "$CG/status" 2>/dev/null | cut -d= -f2-; }
|
2026-07-12 09:21:54 -07:00
|
|
|
|
2026-07-12 11:09:41 -07:00
|
|
|
echo "== CellGuard =="
|
2026-07-12 09:21:54 -07:00
|
|
|
|
2026-07-12 11:09:41 -07:00
|
|
|
# --- 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)"
|
2026-07-12 09:21:54 -07:00
|
|
|
else
|
2026-07-12 11:09:41 -07:00
|
|
|
echo "Block 2G/3G: ON (LTE + 5G/NR only)"
|
2026-07-12 09:21:54 -07:00
|
|
|
fi
|
|
|
|
|
else
|
2026-07-12 11:09:41 -07:00
|
|
|
echo "Block 2G/3G: daemon not running — reboot"
|
2026-07-12 09:21:54 -07:00
|
|
|
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
|
|
|
|
|
|
2026-07-12 11:09:41 -07:00
|
|
|
# --- 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
|
2026-07-12 09:21:54 -07:00
|
|
|
else
|
2026-07-12 11:09:41 -07:00
|
|
|
echo "Detection: daemon not running — reboot"
|
2026-07-12 09:21:54 -07:00
|
|
|
fi
|
|
|
|
|
|
2026-07-12 11:09:41 -07:00
|
|
|
# --- 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)"
|