Show HN: Nightcrawler – 一款运行在智能手机上的本地 AI 渗透测试代理
Show HN: Nightcrawler – A local AI pentesting agent running on a smartphone

原始链接: https://github.com/garagehq/nightcrawler/

**Nightcrawler** 是一款基于移动端的自动化渗透测试代理,专为在智能手机(如已 Root 的 OnePlus 8 并运行 Kali NetHunter)上完全独立运行而设计。它利用本地 12 亿参数的 AI 模型,无需云端连接或互联网接入即可执行端到端的安全评估。 该代理通过循环切换目标并执行少量、谨慎的操作来模拟人类行为,从而实现隐蔽运行,最大限度地降低被发现的风险。其核心功能包括: * **自动化生命周期:** 利用包含超过 24,000 个 CVE 和 27 个预构建攻击剧本的数据库,处理信息搜集、服务枚举、漏洞扫描及漏洞利用。 * **本地推理:** 所有决策均通过 OpenCL 加速的 LFM2.5 模型在手机 GPU 上完成。 * **安全与隐蔽性:** 配备双层“范围代理”以防止越权操作,并使用低速扫描频率以规避网络监控(IDS/IPS)。 * **离线潜力:** 包含一个可选的 WPA2 破解模式,可配合外部 USB WiFi 适配器使用。 * **管理:** 用户可通过网页仪表板监控进度,该仪表板提供实时 C2(指挥与控制)能力并生成最终的修复报告。 Nightcrawler 仅供授权的专业安全测试使用。未经授权的使用属于违法行为。

一场关于“Nightcrawler”的 Hacker News 讨论引发了关于安全研究法律风险的辩论。Nightcrawler 是一款专为安卓系统设计的本地自主 AI 渗透测试代理。 开发者 NickySlicks 解释称,Nightcrawler 在移动硬件上本地运行一个 12 亿参数的模型,并利用安全代理来限定范围,同时使用确定性剧本(playbooks)来应对模型的高故障率。该工具专为隐蔽的物理接触场景而设计,因为携带智能手机比携带笔记本电脑更不容易引起注意。 然而,讨论主要由德国用户主导,他们认为德国严格的“黑客法”使得发布军民两用安全工具变得极其危险。评论者强调,德国法院通常优先考虑“意图”,而意图很难证明,并列举了一些研究人员仅因识别出漏洞就遭到起诉的案例。参与者指出,具有讽刺意味的是,虽然传统安全工具面临巨大的法律障碍,但 AI 驱动的工具往往能规避审查。尽管该项目具有创新性,但该讨论凸显了一个日益增长的担忧:当前的国际法律框架已无法应对不断演变的开源安全软件格局。
相关文章

原文

An autonomous penetration testing agent that runs entirely on a smartphone. Drop the phone on a network, walk away, and it discovers hosts, maps services, finds vulnerabilities, and generates a pentest report — all without cloud connectivity.

 ░█▄░█ █ █▀▀ █░█ ▀█▀ █▀▀ █▀█ ▄▀█ █░█░█ █░░ █▀▀ █▀█
 ░█░▀█ █ █▄█ █▀█ ░█░ █▄▄ █▀▄ █▀█ ▀▄▀▄▀ █▄▄ ██▄ █▀▄  v0.1.0

 AUTONOMOUS MOBILE PENTEST AGENT
 OnePlus 8 · NetHunter · LFM2.5-1.2B · OpenCL GPU

Penetration testing (pentesting) is the practice of testing a computer network's security by simulating an attack — with the network owner's explicit permission. Professional pentesters are hired to find vulnerabilities before real attackers do.

Nightcrawler automates this process on a phone. It uses a small AI model (LFM2.5-1.2B-Instruct-Heretic, 1.2 billion parameters) running locally on the phone's GPU to decide what to do next — which host to probe, which tool to use, what to look for. No internet connection or cloud API required.

  1. WiFi Breach (optional) — If dropped without WiFi, it can autonomously crack WPA2 networks using an external USB WiFi adapter
  2. Reconnaissance — Discovers devices on the network using stealthy scans
  3. Enumeration — Probes discovered services (web servers, file shares, SSH, DNS, etc.)
  4. Exploitation — Tests for known vulnerabilities and default credentials
  5. Reporting — Generates a structured pentest report with findings and remediation advice

The agent operates like a patient human pentester — it rotates across hosts, does one small action per turn, and builds knowledge gradually over hours. This makes it much harder to detect than traditional vulnerability scanners that blast every host at once.

Term What it means
Drop box A device left on a target network to perform testing autonomously
Scope The set of networks/hosts you're authorized to test
Rules of Engagement (ROE) A legal document specifying what you're allowed to do
Stealth Techniques to avoid detection by network monitoring (IDS/IPS)
MCP Model Context Protocol — a standard interface for AI tool use
C2 Command and Control — the web dashboard for monitoring and steering the agent
┌──────────────────────────────────────────────────────────┐
│                   PHONE (OnePlus 8)                       │
│                                                           │
│  ┌─────────────┐     ┌──────────────────┐                │
│  │  LFM2.5     │     │  Agent Loop      │                │
│  │  1.2B model │◄───►│  (main.py)       │                │
│  │  on GPU     │     │  Decides what     │                │
│  │  (:8080)    │     │  to do next       │                │
│  └─────────────┘     └────────┬─────────┘                │
│                               │                           │
│                      ┌────────▼─────────┐                │
│                      │  Scope Proxy     │  ← Safety layer │
│                      │  Validates every │    Blocks out-  │
│                      │  command before  │    of-scope     │
│                      │  execution       │    actions      │
│                      └────────┬─────────┘                │
│                               │                           │
│                      ┌────────▼─────────┐                │
│                      │  Kali MCP Server │  ← Runs the    │
│                      │  nmap, curl,     │    actual       │
│                      │  smbclient, ...  │    commands     │
│                      └──────────────────┘                │
│                                                           │
│  ┌──────────────────┐  ┌──────────────────┐              │
│  │  Web Dashboard   │  │  SQLite DB       │              │
│  │  (:8888)         │  │  Hosts, vulns,   │              │
│  │  Monitor & steer │  │  creds, commands │              │
│  └──────────────────┘  └──────────────────┘              │
└──────────────────────────────────────────────────────────┘

For the full system design, see docs/ARCHITECTURE.md.

  • Fully autonomous — no human in the loop during operation
  • 100% local inference — AI runs on the phone's GPU, no cloud needed
  • Scope-enforced — two-layer defense prevents out-of-scope actions
  • Stealth-first — slow scan rates, host rotation, cover traffic, nmap -T2 only
  • 27 exploit playbooks — multi-step attack chains that execute automatically
  • 24,956-entry CVE database — version-aware vulnerability matching
  • Web dashboard — real-time monitoring, host management, C2 controls
  • WiFi breach mode — autonomous WPA2 cracking with USB adapter (Pwnagotchi-inspired)
  • Passive discovery — background capture of mDNS/NBNS/DHCP/ARP broadcasts
  • Multi-network — data isolated per network, survives DHCP changes via MAC-keyed hosts
  • Self-healing — garbage detection, context reset, watchdogs, stuck detection
  • Training capture — logs successful interactions for future model fine-tuning
  • Report generation — downloadable pentest report with vulns, exploit chains, remediation

See docs/FEATURES.md for the complete feature reference.

  • Android phone with Kali NetHunter (tested on OnePlus 8, Snapdragon 865)
  • Root access via Magisk
  • 12GB+ RAM (model uses ~1.3GB, Android uses ~4GB, rest for tools)
  • USB WiFi adapter for offline WiFi breach mode (Ralink RT3572 recommended)
  • Custom kernel with MAC80211 for monitor mode (build guide)
  • NVIDIA AGX for offloading to a larger model over Tailscale

All inference via OpenCL on Adreno 650 GPU:

Model Quantization Prompt Speed Generation Speed
LFM2.5-1.2B-Instruct-Heretic (production) Q8_0 115 tok/s 13 tok/s
Qwen3.5-0.8B Q8_0 30.5 tok/s 6.3 tok/s
Qwen3.5-4B Q4_0 10.1 tok/s 2.0 tok/s

Note: Android throttles the GPU on battery power (6x slowdown). Nightcrawler includes a GPU governor daemon that forces max performance and auto-throttles at ≤15% battery.

# 1. Install (inside Kali NetHunter chroot)
bash INSTALL.sh

# 2. Wait for llama-server to start (~5 min after boot)
curl -s http://127.0.0.1:8080/health  # Should return {"status":"ok"}

# 3. Start all services
bash scripts/run-36h.sh

# 4. Open the web dashboard (from any device on your Tailscale network)
# https://<your-tailscale-hostname>:8888

Dry Run (no real commands executed)

NC_DRY_RUN=1 python3 main.py

This uses a mock Kali server so you can test the agent loop without executing real network commands.

Manual Start (if not using tmux launcher)

kali-server-mcp --port 5000 &
python3 scope_proxy.py --config config.yaml --port 8800 --upstream http://127.0.0.1:5000 &
bash scripts/webui-daemon.sh start
python3 main.py &

Edit config.yaml before deployment:

mission:
  id: "CLIENT-YYYY-XXX"           # Your engagement ID
  scope:
    networks: ["auto"]             # "auto" = detect from wlan0 at startup
    excluded_hosts: ["auto"]       # "auto" = gateway + self IP
    excluded_ports: [502, 503]     # SCADA/ICS ports to never touch
  authorization: "ROE-YYYY-XXX.pdf"
  max_runtime_hours: 0             # 0 = no limit

model:
  local:
    ctx_size: 8192
    port: 8080

Dynamic scope detection means zero config changes when moving between networks — the agent reads the current subnet from wlan0 at startup.

nightcrawler/
├── main.py                  # Entry point
├── config.yaml              # Mission scope + model config
├── scope_proxy.py           # Scope enforcement proxy
├── INSTALL.sh               # Installer
│
├── agent/                   # Core agent logic
│   ├── loop.py              # Decision loop + error recovery
│   ├── planner.py           # Phase state machine (recon → exploit)
│   ├── llm_client.py        # LLM API client (llama.cpp / remote)
│   ├── db.py                # SQLite backend (hosts, vulns, creds)
│   ├── host_memory.py       # Per-host observations + auto-tagging
│   ├── cve_db.py            # 24,956-entry CVE database
│   ├── attack_planner.py    # Strategic directives for exploit phase
│   ├── output_parser.py     # Extract structured data from tool output
│   ├── offline_manager.py   # WiFi breach pipeline state machine
│   ├── net_detect.py        # Auto-detect network from wlan0
│   ├── cover_traffic.py     # Stealth blending with realistic web traffic
│   ├── passive_capture.py   # Background tcpdump for broadcast traffic
│   └── ...
│
├── proxy/                   # Scope enforcement components
│   ├── scope.py             # IP/port/host validation
│   ├── rate_limiter.py      # Command rate limiting + jitter
│   └── command_filter.py    # Destructive command blocklist
│
├── webui/                   # Web dashboard (Flask)
│   ├── server.py            # API + stealth middleware
│   └── templates/index.html # Dashboard UI
│
├── data/                    # Static data files
│   ├── cve_exploits.json    # CVE→exploit command mappings
│   └── playbooks.json       # 27 multi-step attack playbooks
│
├── prompts/                 # LLM prompt templates (hot-reloadable)
├── scripts/                 # Operational scripts (start, stop, watchdogs)
├── tests/                   # Test suites (API, UI, offline mode)
├── kernels/                 # WiFi driver modules + kernel docs
├── simulation/              # Dry-run mock server
├── docs/                    # Architecture, GPU setup, features
├── logs/                    # Runtime data (gitignored)
└── models/                  # Model files (gitignored)

The agent uses a simple but effective loop:

  1. Pick a target — weighted random selection (70% hosts with known ports, 30% new discovery)
  2. Build context — inject host memory, network observations, phase guidance into prompt
  3. Ask the LLM — model produces REASONING: ... COMMAND: ...
  4. Validate — scope proxy checks the command is in-scope and not destructive
  5. Execute — command runs via Kali MCP server
  6. Learn — output parser extracts findings, updates host memory
  7. Reset context — clear conversation, keep persistent memory, repeat

The 1.2B model has a ~50% command success rate (inherent to its size). The agent compensates with:

  • Garbage detection — 5-streak reset with varied few-shot examples
  • Duplicate detection — forces tool/target diversification
  • Time-based stuck detection — 5-minute backstop forces context reset
  • Direct playbook execution — multi-step attacks bypass the LLM entirely

The dashboard at :8888 provides real-time monitoring and control:

  • Live feed — every command, finding, and agent decision
  • Host cards — clickable cards showing ports, services, vulnerabilities
  • Network map — interactive force-directed graph (drag, zoom, pan)
  • Vulnerability details — CVE tags, exploit chains, remediation steps
  • C2 controls — star/blacklist hosts, force phase, pause/resume, inject commands
  • Offline mode — Pwnagotchi-inspired WiFi attack UI with animated face

The dashboard is stealth-filtered: it spoofs nginx headers and returns empty 404s to connections from the target network.

From 72+ hours of autonomous operation across multiple networks:

  • 30+ hosts discovered per network
  • 2,000+ commands executed autonomously
  • 10+ vulnerabilities found across multiple services
  • 6+ playbooks executed via direct execution
  • Agent memory stable at 35-50MB throughout (no leaks)

Contributions are welcome! See CONTRIBUTING.md for guidelines.

Areas where help is needed

  • Model fine-tuning — improving command format compliance from ~50% to 85%+
  • New playbooks — adding exploit chains for more services
  • CVE database — expanding coverage beyond the current 24,956 entries
  • Adapter support — testing with more USB WiFi chipsets
  • Documentation — tutorials, setup guides for different phones
  • Testing — more test coverage, especially for edge cases
# Clone the repo
git clone https://github.com/garagehq/nightcrawler.git
cd nightcrawler

# Dry-run mode (no real commands, no hardware needed)
NC_DRY_RUN=1 python3 main.py

# Run tests
python3 -m pytest tests/

This tool is for authorized penetration testing only. You must have written permission (Rules of Engagement) from the network owner before deploying Nightcrawler. Unauthorized use against networks you don't own or have permission to test is illegal.

MIT — see LICENSE for details.

If you enjoy this project, you can buy me a coffee ☕:

Buy Me A Coffee

buymeacoffee.com/cyrilengmann

联系我们 contact @ memedata.com