Metadata-Version: 2.4
Name: riciplay-cli
Version: 1.9.6
Summary: Riciplay Security Platform — Autonomous AI-driven bug-bounty CLI
Author: Zaidux
License-Expression: MIT
Project-URL: Homepage, https://riciplay.xyz
Project-URL: Documentation, https://riciplay.xyz/docs
Project-URL: Repository, https://github.com/Zaidux/Riciplay
Project-URL: Issues, https://github.com/Zaidux/Riciplay/issues
Keywords: security,bug-bounty,dast,sast,pentest,vulnerability-scanner,ai-security,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: typer<1,>=0.27.1
Requires-Dist: httpx<1,>=0.28.1
Requires-Dist: rich<16,>=15.0.0
Requires-Dist: keyring<26,>=25.7.0
Requires-Dist: tiktoken<1,>=0.14.0
Requires-Dist: packaging<27,>=26.3
Requires-Dist: prompt-toolkit==3.0.53
Requires-Dist: ricibrowser<0.3,>=0.2.30
Requires-Dist: riciplay-miniproxy<2,>=0.9.8
Requires-Dist: tornado<7,>=6.6
Requires-Dist: riciplay-mitmproxy==12.3.1.1
Provides-Extra: browser
Requires-Dist: ricibrowser<0.3,>=0.2.30; extra == "browser"
Provides-Extra: dev
Requires-Dist: pytest<10,>=9.1.1; extra == "dev"
Requires-Dist: pytest-asyncio<2,>=1.4.0; extra == "dev"
Requires-Dist: pytest-timeout<3,>=2.4.0; extra == "dev"
Requires-Dist: pyte<1,>=0.8.2; extra == "dev"

# riciplay-cli

**Riciplay Security Platform — Command-line Interface**

An autonomous AI-driven bug bounty hunting agent for web applications and
codebases. Runs local investigations with an LLM-in-a-loop leader that
orchestrates specialists, probes endpoints, verifies findings, and chains
vulnerabilities.

## Features

- **Full-screen terminal chat** — An OpenCode-inspired dark layout with a
  pinned composer, scrollable transcript, compact tool blocks and an adaptive
  session sidebar. New and resumed sessions use the same interface.

- **Autonomous DAST (Dynamic Application Security Testing)** — Web app
  vulnerability scanning with automatic attack-surface enumeration, multi-class
  injection probing (XSS / SQLi / IDOR / open-redirect / SSRF), and
  interception-driven recon through miniproxy + headless browser.

- **Autonomous SAST (Static Application Security Testing)** — Code audit with
  semgrep, code search, and AI-guided data-flow tracing. Finds injection sinks,
  hardcoded secrets, weak crypto, and path traversal.

- **Manual-analysis mode** — Human-pentester-style workflow: observe through
  browser, take notebook notes, register accounts, test cross-account, reason
  and iterate.

- **Specialist orchestration** — Parallel execution of domain specialists
  (Recon, Web, API, Auth, Cloud, Business Logic) with shared findings,
  cross-specialist corroboration, and compound attack chaining.

- **Coverage gates** — Deterministic finish-time enforcement ensures every
  discovered endpoint×parameter×attack-class combination is attempted before
  the investigation concludes.

- **Two-identity IDOR testing** — Automatic account registration/login and
  cross-account replay for authorization bypass detection.

- **Phase-separated investigation** — DISCOVER (breadth-first surface mapping
  and probing) followed by REPORT (impact verification, chaining, and quality
  gating).

## Installation

```bash
pip install riciplay-cli
```

Requires Python 3.12+, `mitmdump` (for proxy capture), and optionally Chromium
(via Playwright) for browser-based discoveries.

The 1.9.3 release candidate raises the Python minimum to match the current
mitmproxy line and requires Tornado 6.6+. It depends on MiniProxy 0.9.7+ and
`riciplay-mitmproxy==12.3.1.1`, a temporary maintained distribution based on exact
upstream mitmproxy 12.3.1. Publication remains held until this complete chain is
validated and publicly available; do not bypass resolution with `--no-deps`.

**Do not install upstream `mitmproxy` beside the fork**: they share imports and
console scripts. The npm launcher rejects overlapping distribution metadata and
will not automatically uninstall shared packages. Migrate an existing install
to a fresh Python 3.12+ virtual environment, preserving all session, capture,
CA and credential directories:

```bash
python3.12 -m venv ~/.venvs/riciplay-1.9.3
~/.venvs/riciplay-1.9.3/bin/python -m pip install riciplay-cli==1.9.3
~/.venvs/riciplay-1.9.3/bin/python -m pip check
~/.venvs/riciplay-1.9.3/bin/riciplay launcher-info
export PATH="$HOME/.venvs/riciplay-1.9.3/bin:$PATH"
```

Keep the old environment until capture/readback checks pass; these commands do
not delete investigation data. If both distributions already coexist, migrate
rather than assuming uninstalling one repairs shared files. The maintained
[fork policy](https://github.com/Zaidux/mitmproxy/blob/releases/riciplay-12.3.1.1/RICIPLAY_FORK.md)
defines provenance, security maintenance and retirement once an official safe
upstream release passes the same compatibility/audit gates.

Proxy startup validates that imports and `mitmdump` belong to the fork in the
active environment; an unrelated custom executable is not accepted based on a
version banner. The updater also refuses upstream-to-fork mutation and verifies
dependencies after installation. It passes `--break-system-packages` only when
the operator explicitly requests that OS-protection override.

Proxy shutdown also verifies the persisted process creation identity and its
owned process group. Legacy proxy state without that identity is not enough to
authorize a kill (even with `force`); retire a verified legacy process manually
before starting the candidate in its fresh environment. Captures are preserved.

## Quick Start

```bash
# Authenticate against the Riciplay backend
riciplay auth set-key <your-api-key>

# Run a DAST investigation against a target
riciplay scan investigate https://example.com --budget 12

# SAST code audit — point it at a path and name a focus skill
riciplay scan investigate ./my-project --focus sast-audit --budget 8

# Headless: natural-language instruction, JSON to stdout
riciplay scan investigate https://example.com --prompt "find IDOR in /api/orders" --budget 15

# Named session so an interrupted run can be resumed
riciplay scan investigate https://example.com --session audit-1 --budget 12
```

Options: `--budget/-b` · `--focus/-f` · `--prompt/-p` · `--authorized/-a`
(lab/CTF, skips prompts) · `--session/-s` · `--output/-o` · `--plan-mode`.
There is no `--mode` flag — DAST and SAST are the same command pointed at a URL
or a path.

## Configuration

- `riciplay auth status` — Check authentication and tier
- `riciplay auth whoami` — Show current account info
- `riciplay review <path>` — Code review with markdown output
- `riciplay --help` — Full command reference

## Interactive chat

```bash
riciplay chat                   # Work in the current directory
riciplay chat -w ./project      # Work in an explicitly selected directory
riciplay resume <session-id>    # Navigate to the saved directory, then restore
riciplay chat --inline          # Traditional terminal scrollback
```

- **Ctrl+P** searches commands. A selection fills the composer; submit it to
  use normal command dispatch. Dismissing the palette preserves your draft.
- **/sessions** searches sessions in the current directory. **Ctrl+A inside the
  picker** toggles all directories. Switching saves the current investigation
  first and navigates to the selected session's saved directory; missing
  directories or failed local saves never silently start a different session.
- `riciplay sessions` is directory-local too; `riciplay sessions --all` lists all
  directories. Ctrl+A retains normal editing behavior outside the session picker.
- **PageUp / PageDown** scroll the transcript; **End** with an empty composer
  returns to the latest output. The composer stays visible after a resize.
- **Shift+Tab** cycles Hunt / Plan / Triage; **Ctrl+S** opens specialists;
  **Ctrl+K** opens investigation workflows; **Ctrl+E** opens the external editor.
- **Ctrl+O** opens session tool logs; **Ctrl+T** opens the operator terminal;
  **Ctrl+\\** toggles the contextual sidebar (automatically hidden in small panes).
- During a turn, **Esc** stops cooperatively and typed follow-ups remain queued.
  **/** or **Ctrl+P** opens the same searchable command registry in the existing
  renderer. Rows say whether they run now, wait, or stop then run; commands that
  mutate state, perform I/O, spend or approve still use normal idle dispatch.
- **Ctrl+X** opens the live, scrollable Agents view both idle and during a turn.
  It shows foreground specialists, this session's background jobs and two-way
  messages. Closing the view preserves your draft; viewing notes does not
  acknowledge delivery to an agent.

The redesign does not grant permissions. Each sensitive disclosure and active
action still goes through the existing scope and approval checks. Working
directory and authorization workspace remain separate and are labeled separately.
Non-TTY output and `TERM=dumb` use the inline path. Display-only history is
bounded for long sessions; stored history is not shortened by the UI.

### Site and infrastructure maps

Open `/maps` (or `/maps site`, `/maps infrastructure`) to inspect saved recon
facts and structured session tool results. **Tab** switches tabs; typing searches
labels and evidence; **Enter** expands a branch or opens a fact's details;
**PageUp/PageDown** scroll details; **Esc** returns/closes. On wide terminals the
source/evidence pane sits beside the tree; narrow panes open details in place.
Mouse/tap navigation also works when the terminal forwards those events.

Site branches group URL paths; infrastructure branches group DNS/IP/service/WAF/
cloud observations. They are an **observed inventory, not a guaranteed complete
topology**. Query values are omitted from URL identities. Opening the modal does
not crawl, scan, run tools, save files, or spend credits.

The agent can use `maps` to view/search and manage these same records. Add/update
require source and evidence; uncertain relationships must be labeled inferred or
unverified. Edits require exact record IDs and the latest map revision. Remove
hides one record and restore unhides it; original recon/session evidence and
`RULES.md` authorization remain unchanged. Managed maps are project-scoped and
survive resume. `/maps` itself remains a read-only operator viewer.

### Project directory versus internal storage

Use `/cd <directory>` (or the existing `cd <directory>`) to navigate. Absolute,
home (`~`), relative and quoted space-containing paths are supported. The agent
also has a `cd` tool that changes the session's working directory for subsequent
local tools. Navigation is saved for resume, but never changes existing target
authorization. A `cd` inside Bash affects only that Bash invocation.

The directory where you launch chat is the working directory and the initial
`RULES.md` authorization root. Local reads and writes there are permitted;
out-of-directory access, sensitive disclosure and active-target checks remain
separate gates. `cd` changes cwd but cannot widen the existing `RULES.md` scope.

Riciplay's notebooks, ledgers, caches and runtime bookkeeping use private,
directory-keyed storage beneath the configured workspace storage root (normally
`~/.riciplay/workspaces`). That root is not the default place where the agent
works. Existing data is not deleted or relocated. Slow session transitions show
a green loading disc against a blank backdrop; it is display-only and does not
grant permissions or replace saved history.

### Readable Markdown and explicit privacy controls

Long evidence tables are shown as labeled records when columns would be cramped,
including tables with inline code or escaped pipes. Short comparisons remain
tables on roomy screens. This affects presentation only, not stored messages.

`/redact on`, `/redact lax`, and `/redact off` control model context and **new
session history/notebook content**, including later resume/review. `lax` masks
explicit credentials without guessing that every opaque identifier is a secret.
Switching off through `/redact` or settings requires a warning and explicit
confirmation: unmasked content may be saved locally, synced to Riciplay, and sent
to AI providers under their retention policies. You are responsible for what you
choose to save/send. Re-enabling cannot recall data already sent, and old masked
placeholders cannot be reconstructed. Diagnostic logs, worker coordination and
internal ownership capabilities remain protected independently.

### Background work and agent coordination

- `bash(background=true, ...)` returns a task handle immediately after the normal
  per-call approval and scope checks. At most eight shell jobs run concurrently;
  each has a bounded output tail and a timeout (300 seconds by default, 600 max).
  Shell jobs belong to the current CLI and stop on exit. Redacted partial output
  and exit status remain available after cancellation or timeout.
- `sub_agent(background=true, ...)` or `background_task(action='start', ...)`
  launches independent specialist work in a detached worker that survives CLI
  exit. Other generic tools are still synchronous. Use background work only
  when the parent can continue without its result.
- Every foreground or detached specialist requires its own target-bound approval,
  including green/red modes. Blanket approval does not authorize specialist spending.
- `/background <new instruction>` copies the current context into a separately owned
  child session. It never removes completed tool results or replays the previous
  request. Bare `/background` shows guidance; use `/background list` to monitor.
  Resume the child after completion; foreground saves cannot overwrite a live worker.

### Durable same-session continuation

- `/durable start <instruction>` continues the current session in one detached,
  authoritative worker. `/detach` closes only the UI. `riciplay resume <id>`
  reattaches read-only while the worker owns writes; natural text and
  `/durable followup <message>` queue safe-boundary follow-ups.
- `/durable status`, `/durable decide <exact option>`, `/durable recover`, and
  `/durable stop` expose explicit lifecycle controls. Completed tool results are
  not rerun during recovery. Ambiguous external actions or paid requests require
  operator reconciliation.
- Host-restart recovery is callable with `riciplay recover-agent <id>` or
  `riciplay recover-pending-agents`; Riciplay does not install a boot service.
- `background_task` supports `list`, `status`, `result` and `cancel`. Cancelling
  a specialist retains its local metadata and partial report. It stops the local
  worker, **not necessarily an in-flight backend request or remote spending**.
  `/background remove` is a separate, explicit metadata-removal operation.
- Failed browser retirement retains the child writer and task. The owning worker
  retries cleanup at exit; `/background list` also reconciles recorded groups and
  profiles after worker exit. Ownership is released only when every recorded
  resource is confirmed gone. Legacy tasks without verification anchors stay held.
- Proxy capture and manual interception share the canonical `RULES.md` matcher:
  bare hosts are exact, `*.host` admits subdomains, and URL scheme/port/path and
  exclusions remain enforced. Explicit `scope_hosts` can narrow but never widen
  declared scope; malformed scope fails closed instead of disabling the guard.
- `agent_message(action='post', recipient=task_id, kind='question', message=...)`
  sends coordination notes; `agent_message(action='read')` collects the parent's
  inbox in bounded batches. Session/sender identities are runtime-assigned.
  Private transactional local inboxes bridge to authenticated, per-user backend
  channels with retry-safe delivery and acknowledgments. Delivery failures appear
  on the board and in specialist results rather than silently losing notes.
- A completion/message notice contains metadata only. Message bodies enter the
  model as ordinary tool results or user-role coordination data. They do not
  grant scope, credentials, permissions, approval or spending authority. Sensitive
  capture-derived asynchronous results still require individual disclosure consent.

Chat closes owned browser runtimes before executor shutdown, including error and
exhausted-credit exits; interpreter shutdown no longer schedules browser cleanup
on an already-shut-down executor.
