Skip to content
ADscan Docs

🤖 AI Assistant (`ask`)

Configure and use ADscan AI assistant with API providers or ChatGPT Plus/Pro via Codex subscription.

ADscan includes an AI assistant command: ask.

It supports two backend families:

  • API providers: openai, anthropic, gemini, ollama, openai_compatible
  • ChatGPT subscription mode: codex_cli (ChatGPT Plus/Pro sign-in flow)

Quick Start

adscan start
# 1) Configure backend
ask setup

# 2) Validate backend readiness
ask doctor

# 3) Run a prompt
ask "summarize current workspace context"

ask Command Reference

CommandDescription
ask helpShow quick usage
ask setupConfigure provider/backend
ask statusShow safe backend config (masked secrets)
ask doctorValidate runtime prerequisites
ask login codexStart Codex sign-in flow (subscription mode)
ask auth-status codexCheck Codex auth status
ask logout codexSign out from Codex
`ask usage [dayweek
ask usage budget [show|daily USD|weekly USD|clear]Manage local AI budget thresholds
ask clearClear conversation history
ask "<prompt>"Run a single prompt
askStart interactive prompt loop

API Provider Mode

Use this mode when you want direct API-key based control.

  1. Run ask setup
  2. Select one of: openai, anthropic, gemini, ollama, openai_compatible
  3. Provide model/API key/base URL when prompted
  4. Run ask doctor

Example:

ask setup
ask doctor
ask "what domains and credentials are currently loaded?"

ChatGPT Plus/Pro Mode (Codex)

Use this mode when you want to authenticate with your ChatGPT subscription instead of setting an API key.

  1. Run ask setup
  2. Select provider codex_cli
  3. Run ask login codex
  4. Complete sign-in in browser
  5. Run ask auth-status codex
  6. Run ask doctor

Example:

ask setup
ask login codex
ask auth-status codex
ask doctor
ask "show me the highest-value next step from current findings"

Container Runtime Note

If ADscan runs in Docker mode, Codex CLI must be installed in the ADscan image.
Authentication state is persisted via mounted ADscan directories.

Security Model

The AI assistant is orchestration UX, not arbitrary shell execution.

  • AI actions are restricted to allowlisted ADscan CLI commands (do_* mapped as command names).
  • system, ask, and CLI control commands are blocked from AI execution.
  • Every AI-triggered CLI command requires explicit user confirmation.
  • Audit logging captures AI-triggered action attempts and outcomes.

Command Selection Behavior

When AI is allowed to execute a CLI action, ADscan sends a command catalog to the model and expects a structured action payload:

{
  "adscan_action": {
    "command": "start_auth",
    "arguments": "",
    "reason": "Start authenticated scan workflow"
  }
}

Current behavior:

  • ADscan sends the full allowlisted command catalog (not a small top-N shortlist).
  • Command descriptions are derived from CLI command docstrings.
  • The model picks one command; ADscan enforces policy and asks for confirmation before execution.
  • The selection reason is logged in debug output (not shown in confirmation prompt text).

Debugging and Cost Visibility

Use verbose/debug logs to inspect prompt-level behavior:

  • catalog stats: total_allowlist, sent_to_model
  • selected command + arguments + reason
  • prompt usage summary:
    • prompt_chars
    • prompt_est_tokens (estimated)
    • input_tokens/output_tokens/total_tokens (when backend returns usage)
    • cost_usd (when provider returns cost, typically API-key backends)

For Codex subscription mode (codex_cli), prompt token counts are shown as estimates; direct per-prompt USD cost is generally not available.

Troubleshooting

codex not found in PATH

ask doctor may show:

CLI executable 'codex' not found in PATH.

Action:

  • Rebuild/update your ADscan Docker image with Codex CLI installed.

Codex auth check fails

Action:

ask login codex
ask auth-status codex

Provider requires API key

For openai, anthropic, or gemini, configure API keys via:

ask setup
Find this useful?
Pass it to the next pentester running an AD engagement
Running 2+ AD engagements/year?
Get PRO free — beta access·Free in exchange for feedback
Automated PDF reports. Save ≥1 day per engagement.

ADscan — AD pentest automation for security consultants

🤖 AI Assistant (`ask`) | ADscan