Skip to main content
The pensar swarm command orchestrates parallel pentests across multiple targets, enabling efficient large-scale security testing.

Synopsis

Description

Swarm mode allows you to:
  • Test multiple targets simultaneously
  • Scale security testing across infrastructure
  • Compare security posture across services
  • Efficiently audit microservice architectures
Swarm mode runs pentests in parallel. Ensure you have adequate API rate limits and system resources.

Arguments

string
required
JSON string or path to JSON file containing target list.As JSON string:
As file path:

Targets File Format

Create a JSON file with target configurations:
targets.json
Or simple string array:
targets-simple.json

Options

string
default:"claude-sonnet-4-5"
AI model to use for all pentests.
All targets will use the same model.
string
default:"default"
Header mode for requests.Values:
  • none - No custom headers
  • default - Add User-Agent: pensar-apex
  • custom - Use custom headers defined with --header
string
Add custom header to all requests (requires --headers custom).
Can be specified multiple times.

Examples

Basic Swarm Test

Test multiple microservices:

Using Targets File

Create targets.json:
Run swarm:

Custom Headers

Test with authentication:

No Custom Headers

Disable all custom headers:

Use Cases

Test all services in a microservice architecture:
microservices.json

Performance Considerations

Parallelization

Swarm runs pentests in parallel:
  • 3 targets = ~3x faster than sequential
  • 10 targets = ~10x faster than sequential
Parallel execution is limited by:
  • AI provider rate limits
  • System CPU/memory
  • Network bandwidth

Rate Limiting

If you hit rate limits:
  1. Reduce target count - Test fewer targets per swarm
  2. Upgrade API plan - Increase rate limits with provider
  3. Use multiple API keys - Distribute across keys (requires code modification)
  4. Batch targets - Run multiple smaller swarms instead of one large one

Resource Usage

Each parallel pentest consumes:
  • Memory: ~500MB per target
  • CPU: ~25% per target
  • Network: ~10-20 MB/s per target
Testing 20+ targets simultaneously may require significant system resources.

Output Structure

Swarm creates a session per target:

Troubleshooting

Reduce parallel load:
Or upgrade your AI provider plan for higher rate limits.
Verify JSON format:
Common issues:
  • Missing quotes around strings
  • Trailing commas
  • Unescaped quotes in URLs
Reduce target count:
Check individual logs:
Common causes:
  • Target unreachable
  • Authentication required
  • Rate limiting from target

Best Practices

Group related services:
Test 2-3 targets first to validate:
Add metadata to targets:
Makes results easier to triage.

Next Steps

Single Pentest

Run comprehensive test on one target

Quicktest

Rapid testing with specific objectives

CI/CD Integration

Automate swarm in pipelines

Sessions

Manage and review swarm results