adacam/recon/recon.sh
Kayos a23a59181e init: factory recon baseline, HDC-S fw 5.7.88
- Full factory recon from fresh Hivemapper Bee (HDC-S)
- OS: Intel ESE Reference Distro (Yocto dunfell), kernel 5.10.32
- WiFi: NXP 9098 (changed from Marvell 88W8997 on prev unit)
- New services: jpeg-recorder, video-processor, beekeeper-plugin
- GNSS on /dev/ttyS2 (UART), IMU on /dev/spidev0.0
- AP currently 192.168.0.10/24 - will move to 10.42.0.0/24 in liberate.sh
- recon.sh: read-only recon script for future devices
2026-03-14 08:59:41 -07:00

202 lines
11 KiB
Bash

#!/bin/sh
# adacam-recon.sh
# Factory Bee recon — read-only, nothing modified.
# Run on fresh/unmodified Hivemapper Bee.
# Output: /data/persist/recon/ (survives OTA)
set -e
OUT="/data/persist/recon"
mkdir -p "$OUT"
TS=$(date +%Y%m%d_%H%M%S)
LOG="$OUT/recon_${TS}.log"
log() { echo "[recon] $1" | tee -a "$LOG"; }
log "=== AdaCam Factory Recon ==="
log "Timestamp: $(date)"
log "Hostname: $(hostname)"
# ── FIRMWARE / OS ────────────────────────────────────────────────────────────
log ""
log "=== FIRMWARE / OS ==="
cat /etc/os-release 2>/dev/null | tee -a "$LOG"
cat /etc/bee-release 2>/dev/null | tee -a "$LOG" || log "no /etc/bee-release"
uname -a | tee -a "$LOG"
cat /proc/version | tee -a "$LOG"
# ── KERNEL ───────────────────────────────────────────────────────────────────
log ""
log "=== KERNEL CONFIG ==="
if [ -f /proc/config.gz ]; then
zcat /proc/config.gz > "$OUT/kernel.config"
log "saved kernel.config"
else
log "WARNING: /proc/config.gz not found"
fi
# ── DEVICE TREE ──────────────────────────────────────────────────────────────
log ""
log "=== DEVICE TREE ==="
if [ -f /sys/firmware/fdt ]; then
cp /sys/firmware/fdt "$OUT/keembay.dtb"
log "saved keembay.dtb (raw)"
# Try to decompile if dtc available
which dtc >/dev/null 2>&1 && dtc -I dtb -O dts "$OUT/keembay.dtb" > "$OUT/keembay.dts" 2>/dev/null && log "decompiled to keembay.dts"
else
log "WARNING: /sys/firmware/fdt not found"
fi
# ── PARTITIONS ───────────────────────────────────────────────────────────────
log ""
log "=== PARTITIONS ==="
fdisk -l 2>/dev/null | tee -a "$LOG"
blkid | tee -a "$LOG"
df -h | tee -a "$LOG"
mount | tee -a "$LOG"
cat /proc/mtd 2>/dev/null | tee -a "$LOG" || log "no MTD devices"
# ── BOOT / RAUC ──────────────────────────────────────────────────────────────
log ""
log "=== RAUC / BOOT ==="
rauc status 2>/dev/null | tee -a "$LOG" || log "rauc not available"
cat /etc/rauc/system.conf 2>/dev/null | tee -a "$LOG" || log "no /etc/rauc/system.conf"
fw_printenv 2>/dev/null | tee -a "$LOG" || log "fw_printenv not available"
# ── SERVICES ─────────────────────────────────────────────────────────────────
log ""
log "=== SYSTEMD SERVICES ==="
systemctl list-units --type=service --all --no-pager 2>/dev/null | tee -a "$LOG"
systemctl list-unit-files --type=service --no-pager 2>/dev/null | tee "$OUT/service-unit-files.txt" | tee -a "$LOG"
# Dump every service unit file
mkdir -p "$OUT/units"
for f in /etc/systemd/system/*.service /lib/systemd/system/*.service; do
[ -f "$f" ] && cp "$f" "$OUT/units/" 2>/dev/null
done
log "saved all service unit files to units/"
# ── PROCESSES ────────────────────────────────────────────────────────────────
log ""
log "=== RUNNING PROCESSES ==="
ps auxww 2>/dev/null | tee "$OUT/processes.txt" | tee -a "$LOG"
# ── NETWORK ──────────────────────────────────────────────────────────────────
log ""
log "=== NETWORK ==="
ip addr | tee "$OUT/ip-addr.txt" | tee -a "$LOG"
ip route | tee "$OUT/ip-route.txt" | tee -a "$LOG"
ip link | tee -a "$LOG"
cat /etc/hostapd/hostapd.conf 2>/dev/null | tee "$OUT/hostapd.conf" | tee -a "$LOG" || log "no hostapd.conf"
cat /etc/wpa_supplicant.conf 2>/dev/null | tee "$OUT/wpa_supplicant.conf" | tee -a "$LOG" || log "no wpa_supplicant.conf"
cat /etc/hosts | tee "$OUT/hosts.txt" | tee -a "$LOG"
ss -tlnp 2>/dev/null | tee "$OUT/open-ports.txt" | tee -a "$LOG" || netstat -tlnp 2>/dev/null | tee "$OUT/open-ports.txt" | tee -a "$LOG"
# ── USB DEVICES ──────────────────────────────────────────────────────────────
log ""
log "=== USB DEVICES ==="
lsusb 2>/dev/null | tee "$OUT/lsusb.txt" | tee -a "$LOG" || log "lsusb not available"
cat /proc/bus/usb/devices 2>/dev/null | tee -a "$LOG" || true
# ── KERNEL MODULES ───────────────────────────────────────────────────────────
log ""
log "=== KERNEL MODULES ==="
lsmod | tee "$OUT/lsmod.txt" | tee -a "$LOG"
find /lib/modules -name "*.ko" 2>/dev/null | sort > "$OUT/all-modules.txt"
log "saved module list ($(wc -l < "$OUT/all-modules.txt") modules)"
# ── FIRMWARE BLOBS ───────────────────────────────────────────────────────────
log ""
log "=== FIRMWARE BLOBS ==="
find /lib/firmware /usr/lib/firmware /opt -name "*.bin" -o -name "*.blob" -o -name "*.fw" 2>/dev/null | \
sort | while read f; do
size=$(stat -c%s "$f" 2>/dev/null || echo "?")
sha=$(sha256sum "$f" 2>/dev/null | cut -d' ' -f1 || echo "?")
echo "$f ($size bytes) sha256=$sha"
done | tee "$OUT/firmware-manifest.txt" | tee -a "$LOG"
# Copy key firmware blobs
mkdir -p "$OUT/firmware"
cp /lib/firmware/luxonis_vpu.bin "$OUT/firmware/" 2>/dev/null && log "saved luxonis_vpu.bin" || log "luxonis_vpu.bin not found at /lib/firmware/"
find /lib/firmware /usr/lib/firmware -name "pcie8997*" 2>/dev/null | while read f; do
cp "$f" "$OUT/firmware/" && log "saved Marvell blob: $(basename $f)"
done
# ── KEY FILE SYSTEM LAYOUT ───────────────────────────────────────────────────
log ""
log "=== FILESYSTEM LAYOUT ==="
find /opt /usr/local/bin /usr/bin -maxdepth 3 -type f 2>/dev/null | sort > "$OUT/opt-binaries.txt"
ls -la /opt/ 2>/dev/null | tee -a "$LOG"
ls -la /data/ 2>/dev/null | tee -a "$LOG"
ls -la /data/persist/ 2>/dev/null | tee -a "$LOG" || log "/data/persist does not exist (clean device)"
# ── odc-api / NODE SERVICES ──────────────────────────────────────────────────
log ""
log "=== ODC-API RECON ==="
find / -name "dashcam-api.js" -o -name "odc-api" -o -name "camera-node*" 2>/dev/null | \
head -20 | tee "$OUT/odc-api-location.txt" | tee -a "$LOG"
# Check what's listening on port 5000
ss -tlnp 2>/dev/null | grep 5000 | tee -a "$LOG"
# ── REDIS ────────────────────────────────────────────────────────────────────
log ""
log "=== REDIS STATE ==="
redis-cli KEYS '*' 2>/dev/null | tee "$OUT/redis-keys.txt" | tee -a "$LOG" || log "redis-cli not available"
redis-cli GET MAP_AI_READY 2>/dev/null | tee -a "$LOG" || true
# ── DEVICE IDENTITY ──────────────────────────────────────────────────────────
log ""
log "=== DEVICE IDENTITY ==="
cat /data/device_name 2>/dev/null | tee -a "$LOG" || log "no /data/device_name"
cat /data/lte_name 2>/dev/null | tee -a "$LOG" || log "no /data/lte_name"
cat /data/lte_mode 2>/dev/null | tee -a "$LOG" || log "no /data/lte_mode"
# ── MITMPROXY / PROXY CONFIG ─────────────────────────────────────────────────
log ""
log "=== MITMPROXY / PROXY ==="
ls -la /data/.mitmproxy/ 2>/dev/null | tee -a "$LOG" || log "no .mitmproxy dir"
cat /data/.mitmproxy/*.py 2>/dev/null | tee "$OUT/mitmproxy-scripts.txt" | tee -a "$LOG" || true
# ── MENDER / OTA ─────────────────────────────────────────────────────────────
log ""
log "=== MENDER / OTA ==="
cat /etc/mender/mender.conf 2>/dev/null | tee "$OUT/mender.conf" | tee -a "$LOG" || log "no mender.conf"
# ── VPU / DEPTHAI ────────────────────────────────────────────────────────────
log ""
log "=== VPU / DEPTHAI ==="
ls -la /sys/class/vpu/ 2>/dev/null | tee -a "$LOG" || log "no /sys/class/vpu"
find /sys/class/vpu -type f 2>/dev/null | while read f; do
echo "=== $f ===" && cat "$f" 2>/dev/null
done | tee "$OUT/vpu-sysfs.txt" | tee -a "$LOG"
find / -name "depthai*" -o -name "xlink*" 2>/dev/null | head -30 | tee "$OUT/depthai-files.txt" | tee -a "$LOG"
python3 -c "import depthai; print('depthai version:', depthai.__version__)" 2>/dev/null | tee -a "$LOG" || log "depthai python not importable"
# ── GNSS ─────────────────────────────────────────────────────────────────────
log ""
log "=== GNSS ==="
redis-cli ZREVRANGE GNSSFusion30Hz 0 0 WITHSCORES 2>/dev/null | tee -a "$LOG" || true
which ubxtool >/dev/null 2>&1 && ubxtool -p MONVER 2>/dev/null | head -5 | tee -a "$LOG" || log "ubxtool not found"
# ── LTE MODEM ────────────────────────────────────────────────────────────────
log ""
log "=== LTE MODEM ==="
ls /dev/ttyUSB* 2>/dev/null | tee -a "$LOG" || log "no ttyUSB devices"
[ -f /data/lte_name ] && cat /data/lte_name | tee -a "$LOG"
# ── ENVIRONMENT ──────────────────────────────────────────────────────────────
log ""
log "=== ENVIRONMENT ==="
env | sort | tee "$OUT/env.txt" | tee -a "$LOG"
# ── DIFFS FROM OLD DEVICE (version check) ───────────────────────────────────
log ""
log "=== VERSION SUMMARY ==="
cat /etc/bee-release 2>/dev/null || true
cat /etc/os-release 2>/dev/null | grep VERSION || true
log ""
log "=== RECON COMPLETE ==="
log "Output saved to: $OUT"
log "Main log: $LOG"
ls -lah "$OUT/"