Metadata-Version: 2.4
Name: exaai-agent
Version: 3.1.1
Summary: ExaAi - Advanced AI Security Agent for Comprehensive Penetration Testing
License: Apache-2.0
License-File: LICENSE
Keywords: cybersecurity,security,vulnerability,scanner,pentest,agent,ai,cli
Author: ExaAi Team
Author-email: mahmedhleli@gmail.com
Requires-Python: >=3.12,<3.14
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Security
Requires-Dist: aiohttp (>=3.14.4)
Requires-Dist: anyio (>=4.14.2)
Requires-Dist: azure-core (>=1.38.0)
Requires-Dist: certifi (>=2026.10.18)
Requires-Dist: chardet (>=5,<8)
Requires-Dist: cryptography (>=50.0.0)
Requires-Dist: dnspython (>=2.9.0)
Requires-Dist: docker (>=7.1.0,<8.0.0)
Requires-Dist: fastapi
Requires-Dist: filelock (>=3.20.3)
Requires-Dist: fsspec (>=2026.6.0)
Requires-Dist: gitpython (>=3.1.59)
Requires-Dist: gql[requests] (>=4.4.0,<5.0.0)
Requires-Dist: graphql-core (>=3.2.12)
Requires-Dist: httpx (>=0.27,<1)
Requires-Dist: idna (>=3.15)
Requires-Dist: ipython (>=9.3.0,<10.0.0)
Requires-Dist: libtmux (>=0.62.0)
Requires-Dist: litellm[proxy] (>=1.101.3,<1.103.0)
Requires-Dist: lxml (>=6.1.0)
Requires-Dist: numpydoc (>=1.8.0,<2.0.0)
Requires-Dist: oauthlib (>=4.0.1)
Requires-Dist: openai (>=2.20.0,<4.0.0)
Requires-Dist: openhands-aci (>=0.3.3,<0.4.0)
Requires-Dist: pdfminer-six (>=20251230)
Requires-Dist: pillow (>=13.0.0)
Requires-Dist: playwright (>=1.48.0,<2.0.0)
Requires-Dist: pydantic[email] (>=2.11.3,<3.0.0)
Requires-Dist: pygments (>=2.20.0)
Requires-Dist: pypdf (>=6.21.4)
Requires-Dist: pyte (>=0.8.1,<0.9.0)
Requires-Dist: python-dotenv (>=1.2.2)
Requires-Dist: python-multipart (>=0.0.31)
Requires-Dist: requests (>=2.33.0,<3.0.0)
Requires-Dist: restrictedpython (>=8.4)
Requires-Dist: rich
Requires-Dist: setuptools (>=84.1.0)
Requires-Dist: soupsieve (>=2.9.0)
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
Requires-Dist: textual (>=4,<7)
Requires-Dist: urllib3 (>=2.8.0)
Requires-Dist: uvicorn
Requires-Dist: websockets (>=13.1)
Requires-Dist: xmltodict (>=0.13,<1.1)
Description-Content-Type: text/markdown

<p align="center">
  <img src=".github/logo.png" width="150" alt="ExaAiAgent Logo">
</p>

<h1 align="center">ExaAiAgent</h1>

<h2 align="center">Advanced AI-Powered Cybersecurity Agent for Comprehensive Penetration Testing</h2>

<div align="center">

[![Python](https://img.shields.io/pypi/pyversions/exaai-agent?color=3776AB)](https://pypi.org/project/exaai-agent/)
[![PyPI](https://img.shields.io/pypi/v/exaai-agent?color=10b981)](https://pypi.org/project/exaai-agent/)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
[![Version](https://img.shields.io/badge/version-3.1.1-00d4ff.svg)]()

</div>

<br>

> [!TIP]
> **v3.1.1 - latest.** `exaai mcp` plugs ExaAiAgent into any MCP client (Claude, Cursor) with one command; dashboard v2 streams live events over WebSocket; `exaai contributors` grants GitHub-verified badges to contributors.
>
> **Connect Your Agent:** Point another AI agent at the repository skill:
> ```
> Read https://raw.githubusercontent.com/hleliofficiel/ExaAiAgent/main/SKILL.md and follow the instructions to operate ExaAiAgent
> ```

---

## v3.1.1 at a glance

| | What's new |
|---|---|
| **MCP server** | `exaai mcp` · `ExaAiAgent mcp` · `exaaiagent mcp` — any works; plug into any MCP client (Claude, Cursor) in one command |
| **Dashboard v2** | Live WebSocket events; STOP scan; AI providers; Export All (.zip) |
| **Contributors** | `exaai contributors` — GitHub-verified achievement badges |
| **Security** | Zero-CVE litellm; CI gate: pip-audit + bandit; hardened container |
| **CVE intel** | Evidence-required findings; EPSS + CISA KEV + OSV + GitHub advisories |
| **Safety** | TargetScope enforced; command guard; token/tool/spawn budgets + circuit breaker |

### Previous versions (brief history)

| Version | Summary |
|---|---|
| v3.0.0 | Anti-hallucination grounding (`evidence_id` + EvidenceStore), pinned CVE KB, sandbox hardening, attack-graph planning, conf-v1 validation, reporting v3 (SARIF/CSV/HTML), single-sourced version. |
| v2.3.2 | K8s scanner tool registration fix, run persistence (`exaai_runs/<run>/`), lint pass. |
| v2.2.5 | CI on PRs, import-safe tool server, multi-tool LLM responses, prompt-module merging, TUI target queue. |
| v2.2.2 - v2.0 | Recon modules (subdomain / port / fingerprint), K8s / Azure / GCP modules, React2Shell CVE detection, auto-discovery, install.sh. |

Details: see docs/CHANGELOG.md, docs/MIGRATION-v3.md, docs/MIGRATION-v3.1.md, SECURITY.md, and docs/.

---

## Overview

ExaAiAgent is an AI-powered security testing framework that runs like a penetration tester: it executes code dynamically, finds vulnerabilities, and validates them with proof-of-concepts before reporting. It is built for developers and security teams who need fast, accurate testing with evidence behind every claim.

**Key capabilities:**

- Full security toolkit out of the box, across web, API, cloud, container, and LLM targets
- Teams of specialized agents that collaborate and share discoveries
- Real validation with PoCs, not ungrounded claims
- Developer-first CLI with actionable, reproducible reports
- Multi-LLM support through LiteLLM: OpenAI, Anthropic, Gemini, OpenRouter, Ollama, and any compatible provider
- Smart module loading that auto-detects GraphQL, WebSocket, OAuth, recon, and other attack surfaces

**Use cases:** application security testing, rapid penetration testing, bug-bounty research, CI/CD gating, API security testing (REST, GraphQL, gRPC), and cloud configuration review.

---

## Quick Start

**Prerequisites:** Docker (running), Python 3.12+, and an LLM provider (OpenAI, Anthropic, OpenRouter, Ollama, or any compatible provider).

```bash
pip install exaai-agent
# or: pipx install exaai-agent

# Configure your AI provider (choose one)
export EXAAI_LLM="openai/gpt-5"
export LLM_API_KEY="your-openai-key"

# Option: Anthropic
# export EXAAI_LLM="anthropic/claude-sonnet-4-5"
# Option: OpenRouter
# export EXAAI_LLM="openrouter/openai/gpt-5"
# export LLM_API_KEY="your-openrouter-key"
# export LLM_API_BASE="https://openrouter.ai/api/v1"
# Option: Ollama (local models)
# export EXAAI_LLM="ollama/llama3"
# export LLM_API_BASE="http://localhost:11434"

# Run your first assessment (prompt modules auto-detected)
exaai --target https://your-app.com
```

The first run pulls the sandbox Docker image automatically. Results are saved to `exaai_runs/<run-name>`.

---

## Troubleshooting

### LLM connection failed / model not found

Modern models require a recent `litellm`. Update it:

```bash
pip install -U litellm
```

On externally-managed Linux environments, use a virtual environment:

```bash
python3 -m venv venv && source venv/bin/activate
```

or install with `--user`:

```bash
pip install -U litellm --user --break-system-packages
```

### `exaai: command not found` after install

Your shell has not picked up the new PATH entry. Open a fresh terminal, or reload your shell config:

```bash
source ~/.bashrc
```

For zsh or fish:

```bash
source ~/.zshrc
```

```fish
fish_add_path ~/.local/bin
```

If you installed with `pipx`, run once and reopen the terminal:

```bash
pipx ensurepath
```

### `docker: command not found` or the sandbox fails to start

ExaAiAgent runs tools inside a Docker sandbox. Install Docker Desktop (macOS/Windows) or Docker Engine (Linux), start the daemon, and verify:

```bash
docker info
```

On Linux, if your user gets permission errors, add it to the `docker` group:

```bash
sudo usermod -aG docker $USER
```

Then re-login.

### `LLM_API_KEY` missing / 401 / 403 from the provider

Export the required variables in the same shell you run `exaai`:

```bash
export EXAAI_LLM="your-model"               # required
export LLM_API_KEY="your-api-key"           # required for hosted providers
```

Verify the value has no trailing newline, and confirm the model id matches your provider (e.g. `openai/gpt-6-astra`, `anthropic/claude-opus-5-5`, `google/gemini-4-carbon` etc...). For OpenRouter also set:

```bash
export LLM_API_BASE="https://openrouter.ai/api/v1"
```

### Scan starts but tools return nothing / sandbox exits immediately

Check available disk space and RAM, and verify the sandbox image pulls:

```bash
docker pull ghcr.io/hleliofficiel/exaai-sandbox:1.0
```

Look at `exaai_runs/<run>/run_metadata.json` for the failing tool and `exaai_runs/<run>/report.md` for what ran.

### Dashboard not reachable

Since v3.1.1 the dashboard binds `127.0.0.1:8000` by default. Open:

```
http://127.0.0.1:8000
```

To expose it on your LAN, pass `host="0.0.0.0"` or set `EXAAI_DASHBOARD_TOKEN` and authenticate with `Authorization: Bearer <token>`.

### `MODULE_DENY` / `TOOL_BLOCKED` at scan time

The security manifest blocked that tool or module for your invocation. Check your `--prompt-modules` list and the tool's license and usage policy in `docs/tools.md` — some wrappers are invoke-only and require explicit `--allow-tools` or equivalent configuration.

### `pip` dependency conflicts on upgrade

The v3.1.x line requires `openai>=2.20,<4` and `python>=3.12,<3.14`. If your environment pins older versions, recreate it:

```bash
pipx install --force git+https://github.com/hleliofficiel/ExaAiAgent.git
```

---

## Usage

```bash
# Local codebase
exaai --target ./app-directory

# GitHub repository review
exaai --target https://github.com/org/repo

# Black-box web assessment
exaai --target https://your-app.com

# Multi-target
exaai -t https://github.com/org/app -t https://your-app.com

# Explicit modules (overrides auto-detection)
exaai --target https://api.example.com --prompt-modules graphql_security,waf_bypass

# Grey-box authenticated testing
exaai --target https://your-app.com --instruction "Perform authenticated testing using provided credentials and identify authorization flaws"

# Headless / CI mode
exaai -n --target https://your-app.com

# Interactive TUI
exaai tui
```

Smart auto-loading resolves modules from the target when `--prompt-modules` is not set, for example GraphQL endpoints, WebSocket endpoints, OAuth/OIDC flows, and subdomain enumeration.

### Configuration

```bash
export EXAAI_LLM="openai/gpt-5"        # required
export LLM_API_KEY="your-api-key"      # required for hosted providers
export LLM_API_BASE="your-api-base"    # for local / compatible endpoints
export EXAAI_LIGHTWEIGHT_MODE=true     # reduced token consumption
export EXAAI_MAX_SCAN_TOKENS=2000000   # per-scan token budget
export EXAAI_TOOL_TIMEOUT=120          # per-tool timeout (seconds)
export EXAAI_TARGETS="https://your-app.com"  # enforced target scope
```

Recommended models: OpenAI GPT-5 (`openai/gpt-5`), Anthropic Claude Sonnet 4.5 (`anthropic/claude-sonnet-4-5`), Google Gemini (`gemini/gemini-2.0-flash`).

### CI/CD (GitHub Actions)

```yaml
name: exaai-security-test
on:
  pull_request:
jobs:
  security-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install ExaAiAgent
        run: curl -sSL https://raw.githubusercontent.com/hleliofficiel/ExaAiAgent/main/install.sh | bash
      - name: Run ExaAiAgent
        env:
          EXAAI_LLM: ${{ secrets.EXAAI_LLM }}
          LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
        run: exaai -n -t ./
```

---

## Security modules

| Module | Description |
|---|---|
| `sql_injection` | SQL / NoSQL injection |
| `xss` | Cross-site scripting |
| `ssrf` | Server-side request forgery |
| `xxe` | XML external entity |
| `rce` | Remote code execution |
| `idor` | Insecure direct object reference |
| `authentication_jwt` | Auth and JWT flaws |
| `business_logic` | Business-logic flaws |
| `csrf` | Cross-site request forgery |
| `race_condition` | Race-condition exploits |
| `graphql_security` | GraphQL-specific attacks |
| `websocket_security` | WebSocket vulnerabilities |
| `oauth_oidc` | OAuth2 / OIDC flaws |
| `waf_bypass` | WAF bypass techniques |
| `subdomain_takeover` | Subdomain takeover |
| `prompt_injection` | AI / LLM prompt injection |
| `kubernetes_security` | K8s RBAC and pod-security auditing |
| `subdomain_enumeration` | OSINT subdomain discovery |
| `port_scanning` | Service discovery and port auditing |
| `technology_fingerprinting` | Web technology identification |

Full vulnerability coverage also includes NoSQL and command injection, GraphQL injection, deserialization flaws, prototype pollution, DOM vulnerabilities, workflow manipulation, session management, CSWSH and WebSocket message injection, subdomain takeover, and misconfigurations. See docs/ for module details.

---

## Architecture

ExaAiAgent combines a multi-agent orchestration engine, a LiteLLM provider abstraction, a Docker sandbox runtime, browser automation, proxy traffic capture, a tool server and registry, security scanners, and CLI/TUI interfaces in the main `exaaiagnt/` package.

Key packages: `agents/` (supervisor, scan modes, shared memory), `grounding/` (EvidenceStore), `knowledge/` (pinned CVE KB), `intelligence/` (EPSS/KEV/OSV feeds), `verification/` (pipeline + hardening), `safety/` (TargetScope, command guard, blocklist), `coordination/` (RunState), `planning/` (attack graph), `validation/` (conf-v1), `reporting/` (SARIF/CSV/HTML), `tools/` (78 registered tools + wrappers), `prompts/` (64 modules), and `benchmark/` (Juice Shop / DVWA / WebGoat smoke tasks).

---


---

## Changelog

Full history is in docs/CHANGELOG.md. Latest release: v3.1.1 (see the v3.1.1 table above).

## Contributing

See CONTRIBUTING.md.

## Acknowledgements

ExaAiAgent builds on the following open-source projects:

- [LiteLLM](https://github.com/BerriAI/litellm) — multi-provider LLM abstraction (MIT)
- [Caido](https://caido.io/) — interactive web-proxy traffic capture for the sandbox
- [ProjectDiscovery](https://github.com/projectdiscovery) — scanner tooling used by wrapper modules (nuclei, httpx, katana)
- [Playwright](https://github.com/microsoft/playwright) — browser automation (Apache-2.0)
- [Textual](https://github.com/Textualize/textual) — TUI framework (MIT)
- [OpenHands ACI](https://github.com/OpenHands/ACI) — agent-computer interface primitives

Security research and prompt-engineering work is informed by the wider open-source security community. ExaAiAgent itself is open source under the Apache License 2.0 — see LICENSE.

> [!WARNING]
> Only test applications you own or have permission to test. You are responsible for using ExaAiAgent ethically and legally.

