Skip to main content
The targeted-pentest command runs a focused security assessment against specific testing objectives, ideal for investigating particular vulnerability classes or security concerns.

Syntax

Description

Unlike the full pentest command which performs comprehensive attack surface discovery, targeted-pentest focuses exclusively on your specified objectives. This makes it ideal for:
  • Testing specific vulnerability hypotheses
  • Focused security audits
  • Regression testing after security fixes
  • Investigating specific attack vectors

Required Options

string
required
Target URL, domain, or IP address to testExamples:
  • https://example.com
  • http://192.168.1.100:8080
  • api.example.com
string
required
Testing objective or security goal (repeatable)Define what you want to test. You can specify multiple objectives by using the flag multiple times.Examples:
  • "Test for SQL injection in login form"
  • "Check authentication bypass vulnerabilities"
  • "Verify session management security"
  • "Test file upload restrictions"
At least one --objective is required. You can specify multiple objectives to test several attack vectors in a single run.

Optional Parameters

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

Single Objective Testing

Test for SQL injection vulnerabilities:
Output:

Multiple Objectives

Test several security aspects in one run:
Output:

API Security Testing

Focus on REST API vulnerabilities:

Custom Model Selection

Use a specific model for testing:

Regression Testing

Verify that a security fix works:
Output:

File Upload Security

Test file upload functionality:

Output Files

The targeted-pentest command generates output files in the session directory:

findings.json

JSON file with discovered vulnerabilities:

pocs/

Proof-of-concept exploit scripts:

Use Cases

Test a specific vulnerability theory:
Perfect for:
  • Security research
  • Validating suspicions
  • Focused investigations

Objective Writing Tips

Be Specific

Include Context

Reference Standards

Comparison with Full Pentest

Use pentest for initial security assessments and targeted-pentest for focused investigations or regression testing.

Environment Variables

string
API key for Claude models (recommended)
string
API key for GPT models
string
API key for OpenRouter

Troubleshooting

Objective Not Being Tested

If your objective isn’t being addressed:
  1. Make it more specific:
  2. Break down complex objectives:

No Findings

If the test completes with no findings:
  1. The target may be secure for the tested objectives ✅
  2. Try rephrasing your objectives
  3. Use the full pentest command for broader testing
  4. Check logs: ~/.pensar/sessions/*/agent.log

Authentication Required

For authenticated testing:
  • pentest - Comprehensive automated pentest
  • pensar - Interactive TUI with manual control
  • doctor - Check system configuration

Next Steps

Writing Objectives

Learn to write effective security testing objectives

Interpreting Results

Understand and act on pentest findings