Skip to main content
The pentest command executes a complete penetration test workflow, including attack surface discovery and targeted vulnerability assessment.

Syntax

Description

This command runs a comprehensive two-phase pentest:
  1. Attack Surface Discovery: Identifies all testable endpoints, parameters, and attack vectors
  2. Targeted Exploitation: Spawns specialized agents to test each discovered target
Supports both blackbox (external testing) and whitebox (source code analysis) modes.

Required Options

string
required
Target URL, domain, or IP address to testExamples:
  • https://example.com
  • http://192.168.1.100:8080
  • example.com (assumes HTTPS)

Optional Parameters

string
Path to source code directory for whitebox testingWhen provided, Pensar analyzes the source code to build a comprehensive attack surface map, enabling deeper vulnerability discovery.Default: None (blackbox mode)Example:
string
Pentest mode configurationSupported values:
  • exfil - Exfiltration mode with pivoting and flag extraction
Default: Standard pentest modeExample:
Exfiltration mode is designed for CTF-style challenges and authorized red team exercises where the goal is to extract specific flags or data.
string
AI model to use for security analysisDefault: claude-sonnet-4-5Supported models:
  • claude-sonnet-4-5 (recommended)
  • claude-opus-4-0
  • gpt-4o
  • gpt-4-turbo
  • Custom models via OpenRouter or local vLLM
Example:

Examples

Basic Blackbox Pentest

Test a web application without source code access:
Output:

Whitebox Pentest with Source Code

Analyze source code for comprehensive vulnerability discovery:
Output:

Exfiltration Mode (CTF/Red Team)

Run pentest with pivoting and flag extraction:
Output:

Custom Model Selection

Use a different AI model:

CI/CD Integration

Run automated security testing in CI/CD pipelines:

Output Files

The pentest command generates structured output in the session directory:

findings.json

JSON file containing all discovered vulnerabilities:

pocs/

Directory containing proof-of-concept exploit scripts:
Each POC is a runnable script demonstrating the vulnerability.

report.md

Human-readable markdown report:

Use Cases

Test web applications for common vulnerabilities:
Discovers:
  • SQL injection
  • XSS vulnerabilities
  • Authentication bypasses
  • Authorization flaws
  • API security issues

Pentest Workflow

The pentest command follows a structured workflow:

Environment Variables

string
API key for Claude models (recommended for best results)
string
API key for GPT models
string
API key for OpenRouter multi-model access

Troubleshooting

No Vulnerabilities Found

If the pentest completes with no findings:
  1. Verify target is accessible:
  2. Try whitebox mode if you have source code:
  3. Check session logs for errors:

Authentication Required

For targets requiring authentication:
  1. Launch the TUI and use the authentication wizard:
  2. Or use targeted-pentest with manual session setup

Rate Limiting

If you encounter rate limiting:
  • targeted-pentest - Focused testing with specific objectives
  • pensar - Interactive TUI with manual control
  • doctor - Verify system configuration

Next Steps

Interpreting Results

Learn how to analyze pentest findings

Writing POCs

Customize and validate proof-of-concept exploits