01 — ESTABLISH-CIRCUIT OPEN
Detects Tor binary (tor/tor2, which/locate). Probes SOCKS5 ports 9050/9150/1080 with TCP connect + SOCKS5 handshake. Uses stem Controller.from_port(9051) to enumerate circuits — guard node fingerprint, path length, exit country. Measures SOCKS5h proxy latency via HEAD request to check.torproject.org. Returns CircuitProfile with socks5_port, guard_fingerprint, exit_country, latency_ms.
02 — SPIN-ONION-SERVICE INJECT
Generates Ed25519 keypair (PyNaCl SigningKey). Derives v3 onion address via SHA3-256(".onion checksum" + pubkey + \x03)[:2] checksum, then base32(pubkey + checksum + \x03).lower() + ".onion" — 56-char hostname. Writes hs_ed25519_secret_key + hs_ed25519_public_key (chmod 600) + hostname to ~/.specter_phantomnet/hs_{name}/. Attempts stem HiddenServiceDir ADD_ONION register. Returns OnionService with onion_address, port, version=3.
03 — ONION-C2-REGISTER INJECT
Fingerprints the host environment: AI env key prefix-match (ANTHROPIC_/OPENAI_/HF_/TOGETHER_/REPLICATE_), psutil process scan for ollama/vllm/litellm/tgi/llama-server, model directory scan across MODEL_DIRS, container detection (/.dockerenv + /proc/1/cgroup cgroup-v2 keyword + nvidia-smi GPU count). POSTs EnvironmentFingerprint JSON to operator onion address via SOCKS5h proxy. Sends heartbeat with random jitter 0–30s. Returns C2Registration.
04 — HARVEST-WEIGHTS INJECT
Recursively globs target directory for WEIGHT_EXTENSIONS: .safetensors, .gguf, .bin, .pth, .pt, .ckpt, .pkl. SHA-256 hashes each file. Detects model family by filename substring (codellama → codellama, llama → llama, mistral, phi, gemma, qwen, deepseek, falcon). Streams file in 512KB chunks via HTTP POST to operator onion address over SOCKS5h proxy. Returns WeightHarvest with files_found, files_exfiltrated, total_bytes_sent.
05 — HARVEST-CREDENTIALS INJECT
Scans environment variables (os.environ), CREDENTIAL_SOURCES config paths (~/.config, ~/.aws/credentials, ~/.bashrc, ~/.zshrc, ~/.profile), and .env / .env.local files under search_root. Matches 10 provider regex patterns: Anthropic (sk-ant-api03-), OpenAI (sk-proj- / sk-[A-Za-z0-9]{48}), HuggingFace (hf_), AWS access key (AKIA), Replicate, Together, OpenRouter, Cohere, W&B, Replicate token. Redacts: first 8 chars + "..." + stars. Returns CredentialHarvest.
06 — HARVEST-INFERENCE-LOGS UNLEASHED
Probes INFERENCE_LOG_PATHS for Ollama (~/.ollama/logs/server.log, /var/log/ollama/), vLLM (/var/log/vllm/, /tmp/vllm*), LiteLLM, and TGI. Also uses psutil process open_files() to discover live log file descriptors from inference processes. Extracts prompt/response pairs via regex: JSON "prompt"/"content"/"response"/"text" fields, [INST]/[/INST] Llama-2 format, <|im_start|> ChatML markers. Truncates entries at 500 chars. Requires PHANTOMNET_UNLEASHED_KEY.
07 — ENCODE-TRAFFIC INJECT
Defeats ML-based Tor traffic classifiers via: (1) fixed-cell 512B padding defeating DeepCoFFEA (arXiv:2107.09028, IEEE S&P 2022) — injects CircuitPaddingMachines=1/ReducedCircuitPadding=0 via stem torrc; (2) timing jitter 50–200ms uniform random per request; (3) NetCLR 2025 guard rotation — GuardLifetime="1 day", NumEntryGuards=1, UseEntryGuardsAsDirGuards=0. Stealth score >0.92 = base 0.70 + deltas (cell_padding +0.10, timing_jitter +0.08, deepcoffea +0.04, netclr +0.03, dummy_traffic +0.05). Returns TrafficMorph with stealth_score, torrc_config, techniques_applied.
08 — PERSIST-CIRCUIT UNLEASHED
Auto-detects persistence mechanism: systemd (survival_score=0.92) if systemctl is available, else cron (0.80), shell profile (~/.bashrc, 0.60), or container entrypoint (0.70). Writes ~/.specter_phantomnet/torrc with MaxCircuitDirtiness 86400 (24h guard rotation), then ~/.specter_phantomnet/restart_circuit.sh (chmod 700) as keepalive. Registers cron @reboot entry or systemd user service. Survival_score multiplied by 0.3 if mechanism not active. Returns PersistenceResult with mechanism, survival_score, torrc_path, restart_script_path.
09 — SEED-PAYLOAD INJECT
Computes SHA-256 hash of payload file. Detects MIME type (.gguf/.safetensors → application/octet-stream, else python-magic or generic). Starts HTTPServer daemon thread on 127.0.0.1:serve_port serving the file at /<path_key>. Registers file in module-level _REGISTRY dict for download count tracking. Returns PayloadSeed with onion_url (operator_onion + "/" + path_key), file_hash, mime_type. Chains with T158 GENESIS for supply-chain delivery of backdoored model files over Tor.
10 — REPORT OPEN
Generates PHN-{hex12} session ID. Collects results from all subsystems executed in session. Redacts sensitive fields: private_key_path cleared, credential value_redacted preserved (full values stripped), log entries truncated. Ed25519 signs payload with ~/.red-specter/phantomnet/signing_key.pem. ML-DSA-65 countersigns. Saves JSON report to ~/.red-specter/phantomnet/reports/. Supports list_reports() and load_report() for engagement management.