Files

35 lines
1.2 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# meta-acct.sh — Meta Accounts Center read API (via authenticated browser session).
#
# Usage:
# meta-acct.sh list-linked <agent> # linked profiles in this Meta Account
# meta-acct.sh security-status <agent> # login & recovery / security checkup
# meta-acct.sh login-activity <agent> # "Where you're logged in" sessions
#
# The agent's browser must have an active Meta session (phone/email OTP login).
# Reads NODES.md for the CDP port. Outputs JSON.
#
# Scope: Accounts Center linkage/security surface only. No writes.
# Runs the Python implementation inside the agent's NetVM netns.
set -euo pipefail
NETVM_DIR="${NETVM_DIR:-$HOME/Projects/NetVM}"
SCRIPT="$NETVM_DIR/bin/meta-acct.py"
if [ $# -ne 2 ]; then
echo "Usage: meta-acct.sh <list-linked|security-status|login-activity> <agent>" >&2
exit 2
fi
cmd="$1"
agent="$2"
# Get the node name from ACCOUNTS.md (agent == node per unified naming)
node="$agent"
# Run inside the netns so we reach the browser's CDP on 127.0.0.1.
# NETVM_DIR must be explicit: sudo resets HOME to /root.
exec sudo -n ip netns exec "warp-$node" \
env NETVM_DIR="$NETVM_DIR" python3 "$SCRIPT" "$cmd" "$agent"