Skip to content
BulletdevPublic

About

AI 自主渗透测试系统(Go 后端 + Next.js 前端)

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

463 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARTEX

AI-powered autonomous penetration testing system (Go backend + Next.js frontend)

Middleware

https://github.com/bulletdev/Artex-middleware


Screenshots

See the Online Demo for the full interactive experience.

Dashboard (Overview / Token Usage / Activity Feed) Task List
Dashboard Tasks
Task · Execution Process (Sessions / Tool Calls) Exploration Chain
Execution Process Exploration Chain
Findings Assets
Findings Assets
Asset Coverage Graph (Force-Directed Layout · Tested Assets Highlighted · Expandable and Collapsible Nodes)
Asset Coverage Graph
Traffic Recording Human-in-the-Loop Conversation
Traffic Conversation
Agent Management LLM Configuration
Agent LLM
Interception Approval Backend Logs
Interception Logs

Approval Record Details

The global "Approval Records", task-level "Interception Approval", and approval cards in conversations can all be expanded to view details. The display structure is based on AegisHook's approval details component, using ARTEX's existing components and theme:

Asset Synchronization (ScopeSentry)

Asset data can be synchronized directly from ScopeSentry, eliminating redundant collection:

  • On the "Asset Synchronization" page, enter the ScopeSentry address and API Key to connect the data source;
  • Select the targets and asset types to synchronize (domains / subdomains / IPs / ports / sites / endpoints…) by project or task;
  • Import with one click and consolidate by company asset scope, directly populating the ARTEX asset graph for agent exploration.

Installation

Requires a PostgreSQL database; exploration requires LLM configuration (ANTHROPIC_API_KEY or OPENAI_API_KEY, which can also be configured in the UI).

Method 1: One-Click Installation Script (Recommended)

git clone https://github.com/Bulletdev/ARTEX.git
cd ARTEX
./install.sh

The script detects / automatically installs Docker → lets you choose ① All Docker or ② Local Build and Run:

  • ① All Docker: Enter a Postgres password (press Enter to generate one randomly) → automatically write .env → docker compose up -d.
  • ② Local Run: Choose a database (connect to an existing one / start one with Docker) → generate config.json → compile a single embedded binary with go → start.

After installation, open http://localhost:8787 (visit /setup on first access to set the administrator password).

Method 2: Docker Compose (Manual)

git clone https://github.com/Bulletdev/ARTEX.git
cd ARTEX
cp .env.example .env          # Set POSTGRES_PASSWORD and optionally ANTHROPIC_API_KEY
docker compose up -d          # Pull the michaelbullet/artex image + postgres
# → http://localhost:8787

The image includes commonly used tools (ripgrep/curl/vim/npm/nmap…); ./skills and ./data are persisted through bind mounts.

For remote MCP, select http (Streamable HTTP) or sse (legacy SSE) in system settings. Legacy SSE services typically use GET /sse to establish an event stream, then receive JSON-RPC requests through the returned /message?sessionId=... endpoint; when configuring, set the URL to /sse and specify the request header as Authorization=Bearer <token>.

Method 3: Download Precompiled Binaries (Releases)

Download the zip for your platform from Releases. Extract it to obtain artex + start.sh (start.bat on Windows) + skills/ + config.example.json:

cp config.example.json config.json   # Configure the database connection
./start.sh                           # → http://localhost:8787

Start with start.sh / start.bat instead of running ./artex directly. This is a supervisor script: when the program exits, it determines whether to restart it based on the exit code, and the UI's one-click update relies on it to replace the binary. When running ./artex directly, the program will not restart after an update. Keep running in the background: nohup ./start.sh >artex.log 2>&1 &.

Method 4: Compile a Single Binary from Source

# 1) Export the static frontend
cd web && npm ci && npm run build:static && cd ..
# 2) Copy into the embedded directory
cp -r web/out server/webui/dist
# 3) Compile (-tags embedui is required to embed the frontend)
CGO_ENABLED=0 go build -tags embedui -o artex ./cmd/artex
./start.sh

Method 5: Build Cross-Platform Release Archives

build.sh first builds and embeds the frontend, then uses the Go linker to strip debugging information and compresses the release files into zip archives. Release mode generates zip archives for Linux amd64/arm64, macOS amd64/arm64, and Windows amd64 by default:

./build.sh --release
# Output: dist/artex-0.3.3-*.zip

UPX self-extracting binaries may be incompatible with some Linux kernels, virtualization environments, or security policies, so UPX is disabled by default. Use ARTEX_TARGETS to customize targets; when the target runtime environment is confirmed to be compatible, explicitly pass --upx to further reduce binary size:

ARTEX_TARGETS=linux/amd64,windows/amd64 ./build.sh --release
./build.sh --target linux/amd64 --upx

Updates and Upgrades

Upgrades replace only the program, not the data: the Postgres data volume pgdata, ./data (jwt.key / SQLite, etc.), and ./skills are all preserved. Database migrations do not need to be run manually — artex idempotently reruns schema.sql on every startup (including ADD COLUMN / CREATE INDEX IF NOT EXISTS), meaning that restarting automatically performs migrations. Backing up ./data and the database before upgrading is still recommended.

Release Update Source

One-click updates from the UI always check for and download versions from Bulletdev/ARTEX Releases. Cloning or updating the source code through Git also uses Bulletdev/ARTEX; the original project's Go module path remains unchanged.

The repository is public, so no token is required to check for updates. If GitHub API rate limits are encountered, set ARTEX_UPDATE_GITHUB_TOKEN (only Contents: read permission is required) to increase the quota. The token is used by the backend to query Releases and download attachments, is not sent to the browser, and should not be committed to Git.

A formal Release that is neither a draft nor a prerelease must first be published in this repository, with artex-<version>-<os>-<arch>.zip and SHA256SUMS attached, before the UI can offer installable updates. Online upgrades are not available when the repository contains only source code. The existing Release workflow generates these attachments for the current repository when a v* tag is pushed.

Method 1: One-Click Update from the UI (Recommended)

In the System Configuration page (sidebar "System Configuration" → /system/settings), the Version and Updates card allows you to check for and install new versions directly, without logging into the server.

After clicking "Update": download the release archive for the current platform → compare against the Release's SHA256SUMS → smoke-test the new binary with -h → stage it as artex.new → the program exits, and start.sh / start.bat restarts it and completes the replacement. The page automatically waits for the new version to come online before refreshing.

  • Failures do not leave a broken program behind: If verification or smoke testing fails, the staged file is discarded and the current version continues running; if the replacement version fails to start 3 consecutive times, it automatically rolls back to artex.old (the failed binary is retained as artex.failed for troubleshooting).
  • Roll back at any time: The previous version is retained as artex.old, and the card offers "Roll Back to Previous Version". Note that the database schema is not rolled back.
  • Updates interrupt running tasks — updating means restarting, so perform updates when idle.
  • Development builds cannot be updated: Updates are disabled when the version is dev or git describe includes a suffix, preventing official releases from overwriting locally debugged binaries.
  • Under Docker, only the program is replaced, not the image: Toolchains such as playwright / nmap inside the image are not upgraded, and recreating the container with docker compose up -d reverts to the version bundled with the image. To upgrade the image as well, use docker compose pull artex && docker compose up -d artex.
  • If accessing GitHub requires a proxy, configure the Global Proxy on the same page, and the update process will use it. Updates are downloaded only from GitHub domains and enforce HTTPS.

Method 2: One-Click Update Script

cd ARTEX
./update.sh

The script optionally runs git pull to retrieve the latest code, then lets you choose ① Docker Update or ② Local Build Update (corresponding to install.sh):

  • ① Docker: Specify the target image tag (press Enter to reuse ARTEX_TAG from .env, defaulting to latest) → docker compose pull → docker compose up -d (restarting with the new image automatically performs migrations).
  • ② Local: Rebuild the static frontend output → recompile ./artex (restart the process afterward for changes to take effect).

Method 3: Docker Compose (Manual)

cd ARTEX
git pull                       # Update compose / scripts (optional)
# Specify a version: set ARTEX_TAG=v0.2.0 in .env; otherwise use latest
docker compose pull artex
docker compose up -d artex     # Restart with the new image → automatically migrate the schema
docker image prune -f          # Clean up old images (optional)

Method 4: Precompiled Binaries (Releases)

Download the new version's zip from Releases, stop the old process, overwrite artex and skills/ (preserving your config.json and data/), and restart:

cp -r <extracted-directory>/skills ./ && cp <extracted-directory>/artex ./
./start.sh

Method 5: Compile from Source

git pull
cd web && npm ci && npm run build:static && cd ..
cp -r web/out server/webui/dist
CGO_ENABLED=0 go build -tags embedui -o artex ./cmd/artex
# Restart ./start.sh

Configuration

Database (config.json, or override with the ARTEX_PG_DSN environment variable):

{
  "database": {
    "host": "127.0.0.1", "port": 5432,
    "user": "artex", "password": "yourpass",
    "dbname": "artex", "sslmode": "disable"
  }
}

LLM: export ANTHROPIC_API_KEY=sk-... (or OPENAI_API_KEY), which can also be entered on the "LLM Configuration" page in the UI. Optional: ARTEX_LLM_PROVIDER / ARTEX_LLM_MODEL / ARTEX_LLM_BASE_URL / ARTEX_LLM_PROXY.

Concurrency: The number of worker agents per task is configured in "System Settings" (default: 3).

Common Arguments: ./start.sh -addr :8787 -proxy :8788 (-addr frontend + API, -proxy traffic recording proxy). The startup script passes arguments through to artex unchanged.

Reverse Proxy Deployment (HTTPS / Expose Only Port 443)

The frontend and API/SSE are served through the same backend port (default :8787), and the real-time activity feed uses a same-origin address by default. Therefore, there is no need to configure NEXT_PUBLIC_SSE_BASE; simply expose port 443 publicly and keep port 8787 on the internal network.

SSE uses a long-lived connection + continuous streaming, so the reverse proxy must disable buffering; otherwise, the browser may connect without receiving events (the activity feed keeps spinning). Nginx example:

server {
    listen 443 ssl;
    server_name your.domain.com;
    # ssl_certificate / ssl_certificate_key ...

    location / {
        proxy_pass http://127.0.0.1:8787;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Key SSE settings: disable buffering, long timeout, HTTP/1.1
        proxy_buffering off;
        proxy_cache off;
        proxy_read_timeout 3600s;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    }
}

Set NEXT_PUBLIC_SSE_BASE at build time only when SSE needs to use a different origin from the page (such as a separate subdomain). This variable is baked into the static bundle during next build; setting it at container runtime has no effect.


Development

Manual Vulnerability Retesting

The "Retest" tab in task details allows you to browse the task's vulnerabilities with pagination, view previous conclusions and evidence, and manually initiate retests. After starting, the current tab remains selected and displays a spinner and "Retesting"; once a fix is confirmed, the vulnerability status is updated accordingly.

Click "Retest" in the action area of each vulnerability list row, or click "Start Retest" in the "Vulnerability Retesting" section of the vulnerability details, and optionally specify the fixed version, testing conditions, or restrictions. The system creates an independent retesting Agent session and remains on the current page after starting. The flat list, task-grouped list, and asset view all support this entry point; while a retest is running, a spinner and "Retesting" are displayed. Click to enter the corresponding session when you need to inspect it; after completion, the action returns to "Retest". Retesting does not require restarting the original scanning task. Conclusions are classified as "Still Reproducible", "Fixed", or "Unable to Confirm". Each conclusion, evidence, and session link is saved in the vulnerability details.

On first startup, the new backend provisions an editable "Vulnerability Retesting" (retester) Agent whose prompts, LLM, execution budget, and tools can be configured in Agent Management. By default, it uses its assigned LLM; if none is assigned, it uses the globally active configuration. When a retest session completes successfully with a "Fixed" conclusion, the system automatically changes the vulnerability remediation status to "Fixed"; running, failed, stopped, or other conclusions preserve the original status. Original evidence and reports are always retained. "Fixed" can also be selected manually from the status dropdown. If a retest is already running for the same vulnerability, the existing session is reused; a new retest can be initiated after a stop, failure, or service restart.

In this version, historical records are accessible through vulnerability details and sessions; they are not yet included in vulnerability report exports or task archives, and traffic captures are not automatically associated. Demo mode generates only explicitly labeled simulated records and does not send requests to real targets.

Local Development and Testing

./dev.sh    # Backend (:8787) + traffic proxy (:8788) + frontend next dev (:5173) → http://localhost:5173
  • Backend: go run ./cmd/artex (without -tags embedui, the frontend is not embedded)
  • Frontend: cd web && npm run dev (/api is reverse-proxied to the backend, with hot reloading)
  • Tests: go test ./...
  • Mock preview (no backend): cd web && NEXT_PUBLIC_MOCK=1 npm run dev

System Architecture

ARTEX is an autonomous penetration testing system driven by multiple LLM agents: a monolithic Go backend (with an embedded Next.js frontend) + PostgreSQL, with agent capabilities provided by the norma SDK (agentcore / tool / permission / harness / memory / transcript). At its core is a dual-graph architecture and two supporting autonomy mechanisms: process-level information exchange between workers and a shared planner todolist across rounds for stable attack chains.

Overall Architecture Layers

flowchart TB
  subgraph FE["Next.js Frontend (go:embed in a single binary)"]
    UI["Dashboard · Tasks · Assets · Coverage Graph · Traffic · Workspace · System Configuration"]
  end
  subgraph SRV["server (Go net/http)"]
    API["REST /api/* JWT Authentication SSE"]
    ENG["engine Scheduling Loop"]
    MGR["Manager Task/Engine/Store Lifecycle"]
  end
  subgraph AG["agent (norma SDK)"]
    GO["goals Goal Decomposition + Scope Extraction"]
    PL["planner Planner (Sole Intent Generator)"]
    WK["worker Executor ×N"]
    MA["mainagent Human-in-the-Loop"]
  end
  subgraph DB["PostgreSQL"]
    AGRAPH["Asset Graph assets / companies / task_scope"]
    EGRAPH["Exploration Graph exploration_nodes / anchors / activity"]
  end
  subgraph SUB["Supporting Subsystems"]
    PROXY["Traffic Recording Proxy MITM + CA Audit Trail"]
    GUARD["guard / intercept Tool Approval Gate"]
    ENR["enrich Asynchronous DNS / HTTP Enrichment"]
    EXT["MCP · skills · memory · report"]
  end

  UI -->|HTTP| API
  API --> MGR --> ENG
  ENG --> PL
  ENG --> WK
  API --> MA
  API --> GO
  PL --> DB
  WK --> DB
  MA --> DB
  GO --> DB
  WK -->|"Bash / HTTP Full Audit Trail"| PROXY
  WK --> GUARD
  WK --> ENR
  PL -.-> EXT
  WK -.-> EXT
  MA -.-> EXT
Loading
Layer Responsibilities
Frontend Next.js static export, embedded into a single binary with go:embed; visualizes tasks/assets/exploration chains/coverage graphs, with human-in-the-loop conversations
server net/http routing + JWT authentication + SSE; Manager manages the lifecycle of tasks, engines, and DB stores
engine One plannerLoop + N worker goroutines per task; intent claiming, timeout/pause/drain
agent goals / planner / worker / mainagent, with ToolSet exposing both graphs as LLM tools
db PostgreSQL persistence for both graphs (pgx); the schema is embedded with go:embed and tables are created idempotently on each startup
Support Recording MITM proxy, approval gates, asynchronous enrichment, MCP/skills/memory/reports

Dual-Graph Architecture: Exploration Graph + Asset Graph

The system separates "what the target is" and "how far testing has progressed" into two independent graphs connected by anchors:

  • Asset Graph (Globally Shared): A single source of truth for assets across tasks. Nodes are root_domain / subdomain / ip / service / app / endpoint, belonging to companies; the domain → subdomain → service → endpoint parent-child relationships and deduplication keys are all calculated by the program, while agents submit only raw information.
  • Exploration Graph (Independent per Task): The reasoning and progression process of a task. Nodes are goal (Goal) / intent (Intent) / fact (Fact) / finding (Vulnerability) / hint (Hint), connected by edges such as spawns / derived_from / yields / proves into a lineage chain, answering which facts a direction was derived from and what it produced.
  • Both graphs are connected through anchors: exploration_anchors(node_id, asset_id) anchors intents/facts/vulnerabilities to specific assets — making it possible to see which assets an exploration direction targets, or to look up which intents tested a particular asset in the current task and which facts were obtained. This also supports asset testing coverage and the asset coverage graph (in-scope assets + tested assets highlighted).
flowchart LR
  subgraph EG["Exploration Graph (Independent per Task · Progression Chain)"]
    direction TB
    G["goal Goal"]
    I1["intent Intent A"]
    F1["fact Fact"]
    I2["intent Intent B"]
    FD["finding Vulnerability"]
    G -->|spawns| I1
    I1 -->|yields| F1
    F1 -->|derived_from| I2
    I2 -->|proves| FD
  end
  subgraph AG["Asset Graph (Globally Shared · Source of Truth)"]
    direction TB
    RD["root_domain"]
    SD["subdomain"]
    SV["service"]
    EP["endpoint"]
    RD --> SD --> SV --> EP
  end
  I1 -. anchor .-> SD
  F1 -. anchor .-> SV
  I2 -. anchor .-> EP
  FD -. anchor .-> EP
Loading

Division of responsibilities: The planner reads the exploration graph's state, evaluates goals, and dispatches intents into the frontier only when there are new, uncovered directions; a worker claims one intent, executes it using real tools, writes new assets/facts/vulnerabilities back to both graphs, and then stops. The asset graph represents shared facts, while the exploration graph represents each task's progression chain.

Engine and Intent Lifecycle (Closed-Loop Exploration)

The engine is an event-driven closed loop: a graph change wakes the planner, the planner dispatches intents, workers claim and execute intents and write back results, and those writes trigger the next round — until the goal is proven (prove_goal).

sequenceDiagram
  autonumber
  participant EV as Graph Change Debounce
  participant P as planner
  participant FR as frontier Intent Queue
  participant W as worker
  participant PX as Recording Proxy
  participant DB as Dual Graphs + activity

  EV-->>P: Wake Up
  P->>DB: Read state (graph_overview prefetch + coverage/scope)
  P->>FR: Dispatch 0..N intents (with asset_ids)
  Note over P,FR: Most wake-ups dispatch 0 intents — stop if there is no new direction
  W->>FR: claimNext claims one intent
  W->>DB: Retrieve raw assets from the intent's asset_ids as initial information
  W->>PX: Execute real tools (Kali / Bash / HTTP)
  PX-->>W: Response (full audit trail + CA verification)
  W->>DB: Write back fact / asset / finding + activity for each step
  DB-->>EV: Graph Change
  EV-->>P: Wake Up Again (Closed Loop)
Loading

Process-Level Information Exchange Between Workers

During an in-depth exploration, many valuable observations (an error, a response, or a hidden parameter) appear during a worker's execution process, but may not be recorded as formal facts. To avoid redundant work and allow workers along the chain to build on each other's findings, workers can search execution traces across work sessions:

  • search_all_worker_traces(q): Search by keyword within the execution traces of other work sessions in the current task (automatically excluding steps from the worker's own intent), with matching results containing intent_id;
  • list_worker_traces / get_worker_trace(intent_id, step_ids=[…]): First inspect which work sessions have run, then retrieve the complete contents of specific steps from a work session for detailed information exchange.

This allows subsequent workers to reuse observations from other workers' execution processes even if the corresponding fact does not yet exist in the exploration graph — information flows between workers at the granularity of execution processes, while boundaries remain unchanged (each worker still handles only its assigned intent).

flowchart LR
  WA["worker A (Intent #12)"] -->|"activity for each step"| ACT[("Exploration Graph · activity Trace Store")]
  WB["worker B (Intent #34)"] -->|"activity for each step"| ACT
  WC["worker C (Intent #56)"] ==>|"1) search_all_worker_traces(q)"| ACT
  ACT ==>|"2) Match steps from A/B (excluding own steps)"| WC
  WC ==>|"3) get_worker_trace(id, step_ids)"| ACT
  ACT ==>|"4) Return complete execution trace contents"| WC
Loading

Planner Shared Todolist Across Rounds → Stable Attack Chains

Real attack chains are often multi-step sequences with dependencies (e.g., discover an injection point → obtain credentials → lateral movement → privilege escalation). Dispatching all these steps in parallel would cause disorder. The planner therefore maintains a planning todolist retained per task and shared across wake-ups:

  • The planner is event-driven — it wakes whenever the graph changes, but each wake-up starts a completely new session; the shared todolist allows it to record a sequential exploitation chain once, then dispatch intents step by step according to dependencies across subsequent rounds, rather than expanding the entire chain upfront in a single round;
  • Each round dispatches intents only for the next step whose prerequisites are complete and whose required facts already exist, updating the list as progress is made (marking steps satisfied by facts as complete).
flowchart TB
  subgraph TODO["Shared Todolist (Retained per Task · Persistent Across Wake-Ups)"]
    direction LR
    T1["1 Injection Point [Completed]"]
    T2["2 Obtain Credentials [In Progress]"]
    T3["3 Lateral Movement [Awaiting Prerequisites]"]
    T4["4 Privilege Escalation [Awaiting Prerequisites]"]
    T1 -.Prerequisites met.-> T2 -.-> T3 -.-> T4
  end
  R1["Round 1 Wake-Up Dispatch Intent ①"] --> T1
  R2["Round 2 (① Produces Fact) Dispatch Intent ②"] --> T2
  R3["Round 3 (② Produces Fact) Dispatch Intent ③"] --> T3
Loading

As a result, attack chains continue to progress reliably, without duplication or out-of-order execution in an event-driven environment with stateless sessions — this is the key to ARTEX autonomously completing multi-step exploitation chains.


Community Group

Scan the QR code to follow the SecSentry WeChat official account, then send a private message to the account to join the discussion group.

SecSentry WeChat Official Account

References

https://github.com/oritera/Cairn

License and Disclaimer

Open-Source License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). For the complete terms, see the LICENSE file in the repository root.

This means that anyone is free to use, modify, and distribute this project, but derivative works must also be open-sourced under AGPL-3.0; in particular, if you modify this project and make it available to users over a network (such as by deploying it as an online service), you must also make the corresponding complete source code available to those users.

⚠️ Important Notice: The open-source license itself does not restrict the purposes for which the software may be used. The following "Usage Restrictions" and "Disclaimer" constitute additional terms and formal declarations from the author to users; please comply with them.

ARTEX is intended solely for personal learning, code research, and local technical validation, and must not be used to conduct actual testing against any online system or website.

Permitted Uses

  • May only be used for reading, learning from, and researching the source code of this project, and for validating technical principles in a local isolated environment;
  • Suitable for non-offensive purposes such as personal learning, academic research, and code review.

Prohibited Uses

  • It is strictly prohibited to use this tool to scan, probe, exploit, or attack any website, online service, or network-connected system (regardless of whether authorization has been obtained or the assets are owned by the user);
  • It is strictly prohibited to use this tool for any actual penetration testing, offensive or defensive exercises, or production environments;
  • It is strictly prohibited to use this tool for unauthorized intrusion, data theft, extortion, denial of service, or any destructive or criminal activity;
  • It is strictly prohibited to use this tool for activities that violate the laws and regulations of the user's country or region.

Compliance Responsibilities

Users must independently comply with all laws and regulations concerning cybersecurity, data protection, and computer crime in their country or region (in mainland China, including but not limited to the Cybersecurity Law, Data Security Law, Personal Information Protection Law, and relevant judicial interpretations). Users bear sole responsibility for all legal liabilities and consequences arising from the use of this tool.

Disclaimer

This project is provided "AS IS", without any express or implied warranties. The author and contributors shall not be liable for any direct or indirect losses, data loss, system damage, or legal disputes arising from the use of this tool (whether used properly or improperly). By downloading, installing, or using this project, you acknowledge that you have read, understood, and agreed to all of the above terms.

About

AI 自主渗透测试系统(Go 后端 + Next.js 前端)

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages