N0b1e6/Ncode
About
授权渗透测试 agent:人机协同、强门禁、证据闭环。TSecBench / XBOW / Cybench 六榜前列。
Security & PrivacyMeasured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.en.md
OriginalNcode
Authorized penetration testing — human-in-the-loop, gated by design, receipts included.
Planning and execution are separated; every finding carries evidence. claude backend by
default (stronger capability), switchable to pi (native toolchain, fewer tokens).
简体中文 · English
Quick start · Benchmarks · How it works · Install · Configuration · Assets layout
Ncode is an authorized penetration-testing agent that runs on your machine: you set the goal and the authorization boundary, the main agent registers a typed asset ledger, dispatches one-shot workers per asset and records results to the database, reviewing and re-dispatching until first compromise. It is not an unattended auto-pentest pipeline — scope expansion, pacing and final acceptance stay with the operator. Built on pi and compiled into a single binary; knowledge base, scope gate, audit trail and local WebUI are built in.
- Human in the loop: you set goal and boundary; the agent loops autonomously inside them. Step in any time from the main session or the WebUI coach channel; boundary changes and sign-off require a human decision.
- Strong gates: hard lines (gov.cn / edu.cn / mil) and blocked entries are denied in every mode; out-of-scope targets require interactive confirmation — when unattended the main agent denies by default while workers proceed with a full audit trail.
- Two memories:
ncode.dbholds assets/findings/creds/audit; briefs hold process detail and failed attempts, inherited across workers. - Evidence loop: findings carry verification detail; the full tool-call audit replays every call per asset.
Benchmarks
| Benchmark | Score | Top | vs top | Rank | Run date |
|---|---|---|---|---|---|
| TSecBench v1 | 99.46 | 100 (full score) | 99.5% | 18 | 2026-10-29 |
| tsecbench v2 | 75.15 | 95.86 | 78.4% | 11 | 2026-11-25 |
| XBOW Validation Benchmarks | 95.09 | 96.11 | 98.9% | 3 | 2026-11-25 |
| Cybench | 100 | 100 | 100% | 11 | 2026-11-12 |
| T-Vuls | 100 | 100 | 100% | 3 | 2026-11-25 |
| bctf-2026 | 79.92 | 89.77 | 89.0% | 13 | 2026-11-24 |
The radar plots score ÷ leaderboard top (dashed ring = parity); TSecBench v1 is an older-season run no longer on the current board, normalized against 100. Data from official TSecBench APIs (2026-11-27); scores are not comparable across benchmarks and are single-run observations.
Quick start
npm install && (cd pi && npm install) && (cd pi/packages/tui && npm run build)
python scripts/build_all.py # compile both platforms and package the release zip (assets must already be in knowledge/ and tools/)
# unzip and run the bundled pi(.exe)
First run: LLM credentials live in pi (~/.pi/agent/, or replace the bundled agent/models.json
gateway template); put scope.json in your project (template bin/scope.json); add
ncode.config.json for recon APIs / proxy / backend (template ncode.config.example.json).
The WebUI starts at http://127.0.0.1:7654.
How it works
asset ledger (discovered→queued→in_progress→breached/exhausted/failed/superseded)
│ worker_next claim → subagent_dispatch one-shot worker
▼
worker executes: findings_add / creds_add / brief_write → exits per round
│
▼
subagent_wait review/coach → state machine converges → report (evidence only)
- Context compaction becomes a deterministic checkpoint (asset states + findings + queue).
- Full audit: every tool call (input + output) from the main agent, claude workers and nested Workflow subagents is recorded and streamable per asset in the WebUI.
- Gates: fail-closed;
blocked(incl. CIDRs) and hard lines denied outright; v4-mapped and similar encodings normalized before matching.
Features
- Native tools (main agent and pi-backend workers; claude-backed workers do not register
them):
bashhttpportscandirscanjsinfotcppivot(Neo-reGeorg)sshftpmysqlpostgresocrdictgenkb_queryghsearch, plusfofa/hunter/quakerecon (planner only); scheduling toolsworker_next/subagent_*/assets_*/findings_*/creds_*/report. - Worker backends:
claudeby default (Claude Code Agent SDK, stronger capability; credentials via env > project config > pi derivation);pi --mode rpcfor fewer tokens with the native toolchain. - Knowledge base: rg full-text search across kinds (POC / nday / fingerprints / tips / script archive).
- Reports:
reportrenders deterministically from the db — asset overview, findings, and the scope-decision audit.
Installation
- Build from source: see Quick start; requires Node >= 22.18, Bun (compile), Python 3 (packaging).
- Container image:
python scripts/build_hosted_image.py(knowledge/tools baked in; entrypoint injects LLM credentials).
Configuration
LLM configuration stays in pi (~/.pi/agent/). Ncode config is project-level:
<project>/ncode.config.json (template ncode.config.example.json) plus scope
<project>/scope.json; both are gitignored, secrets never enter the repository.
{
"apis": {
"fofa": { "email": "[email protected]", "key": "xxx" },
"hunter": { "key": "xxx" },
"quake": { "key": "xxx" }
},
"prompt_profile": "benchmark",
"workers": { "backend": "claude" },
"proxy": "http://127.0.0.1:10888"
}
Prompt system (scenario separation)
Prompts are three layers, with everything scenario-specific externalized and swappable as a
package: built-in prompts (system sections, tool descriptions and error messages in code —
generic workflow only, bound to no platform) + AGENTS.md (project_context behaviour rules; a
worker may override with AGENTS-worker.md) + tool error hints (gate and validation feedback).
Two profiles ship: benchmark (scoring-platform contract, default) and real (engagement
authorization boundary and discipline):
prompts/
├─ common/ # methods / red-lines / main-tools / worker-tools, composed via include
├─ benchmark/ # main.md + worker.md (platform contract)
└─ real/ # main.md + worker.md + AGENTS.md (engagement flow)
Switch with prompt_profile in ncode.config.json (or NCODE_PROMPT_PROFILE); replace the whole
package via prompt_dir (or NCODE_PROMPTS_DIR). Files support {{include:../common/methods.md}};
a custom profile only needs <profile>/main.md and <profile>/worker.md.
Release assets and layout
The source repo keeps the full directory skeleton (README + examples per directory); bulk assets are gitignored — drop them into the same directories and they are picked up.
ncode/
├─ pi.exe (or pi) # prebuilt binary
├─ knowledge/ # poc/ nday/ md-docs/ api-wordlist/ cyberspace/ tips/ scripts/ fingerprint/ …
├─ tools/ # dict/ java/ dotnet/ android/ php/ sidecar/(fd,rg) …
├─ agent/ # settings.json / models.json
├─ claude/ # claude worker sidecar
├─ .claude/skills/ # worker skills (deployed at packaging)
├─ AGENTS.md # agent instructions (bundled)
└─ scope.json
Place assets at repository-root knowledge/ and tools/, run python scripts/package_clean.py
to assemble; engagements can also use <project>/knowledge/, <project>/tools/dict/, or point
ncode.config.json anywhere.
Resolution order (from code):
| Asset | Order |
|---|---|
| Knowledge (main-agent tools) | knowledge_dirs[kind] → <cwd>/knowledge/<kind> → <exeDir>/knowledge/<kind> |
Knowledge (worker skill ncode-kb) |
NCODE_KB_DIRS → container /app/knowledge → <cwd>/knowledge |
| Dictionaries | dict_dir → <cwd>/tools/dict → <exeDir>/tools/dict |
| Toolset | /app/tools in the container; PATH on the host |
Development and testing
npm test # node --test (102 cases)
npm run check # tsc --noEmit
The pi monorepo lives in pi/ (MIT, full history); the ncode extension source is at
pi/packages/coding-agent/src/extensions/ncode/, extension/ is the standalone mirror synced via
node scripts/sync-extension.mjs. Benchmark radar data sits at the top of
scripts/gen-benchmark-radar.mjs; re-run it to regenerate the SVG.
Security and authorized use
- For authorized penetration testing only; scope comes from the project
scope.json; gov.cn / edu.cn / .mil are permanently denied. - Gates are enforced in code: hard lines and blocked entries are denied outright, and every out-of-scope attempt is audited; bypassing the gate is unsupported.
Acknowledgments
This project stands on a large body of open-source work:
- pi — Mario Zechner (badlogic) and the earendil-works team, MIT License. Full source and
history in
pi/(LICENSE retained). Ncode builds on pi as an extension with minor core patches. - Knowledge base sources: Awesome-POC, wy876/POC (wpoc), Vulnerability-Wiki, nuclei-templates fscan, EHole, metasploit-framework, and a 2026 public PoC collection (GitHub-scanned); dictionaries from SecLists. Per-entry sources in the knowledge base's
scripts/INDEX.md. All content remains copyrighted by its original authors; Ncode only integrates a search layer and does not redistribute it with this repository. - Toolset: ysoserial, JNDIExploit, jadx, apktool, dex2jar, Frida, dnSpyEx, de4dot, ysoserial.net, PHPGGC, php-closure, fd, ripgrep, Neo-reGeorg, OpenJDK 8, photon. Each follows its original license; Ncode does not redistribute these with the repository.
License
MIT. The vendored pi/ tree is MIT-licensed, copyright its original authors (see
pi/LICENSE).
Explore related projects
Loading…