Files
CellGuard/action.sh

39 lines
1.3 KiB
Bash
Raw Normal View History

#!/system/bin/sh
# CellGuard — KernelSU-Next "Action" button handler.
# Shows enforcement + diagnostics status.
MODDIR=${0%/*}
PATH=/system/bin:$PATH
CONFIG_DIR="/data/adb/cellguard"
echo "== CellGuard status =="
# --- enforcement (LTE + 5G/NR only) ---
if pgrep -f "$MODDIR/ratlock.sh" >/dev/null 2>&1; then
if [ "$(cat "$CONFIG_DIR/enabled" 2>/dev/null)" = 0 ]; then
echo "RAT lock: running, BLOCK toggle OFF (all RAT allowed)"
else
echo "RAT lock: RUNNING (LTE + 5G/NR only, 2G/3G blocked)"
fi
else
echo "RAT lock: NOT running — reboot or run: sh $MODDIR/ratlock.sh &"
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
# --- diagnostics (kernel CP-frame capture) ---
if [ -e /proc/cgcap/frames ]; then
total=$(head -1 /proc/cgcap/frames | sed -n 's/.*total=\([0-9]*\).*/\1/p')
echo "Diag capture: ACTIVE (cgcap) — frames seen: ${total:-0}"
echo " raw diag: /proc/cgcap/frames (all cpif channels)"
else
echo "Diag capture: OFF — cgcap.ko not loaded"
fi
echo
echo "Decode + IMSI-catcher heuristics run off-device (Android has no Python):"
echo " adb shell su -c 'cat /proc/cgcap/frames' > frames.txt"
echo " python3 tools/cg_decode.py frames.txt"