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
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 headersdefault- AddUser-Agent: pensar-apexcustom- Use custom headers defined with--header
string
Add custom header to all requests (requires Can be specified multiple times.
--headers custom).Examples
Basic Swarm Test
Test multiple microservices:Example Output
Example Output
Using Targets File
Createtargets.json:
Custom Headers
Test with authentication:No Custom Headers
Disable all custom headers:Use Cases
- Microservices
- Multi-Tenant
- Staging Environments
- Bug Bounty
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:- Reduce target count - Test fewer targets per swarm
- Upgrade API plan - Increase rate limits with provider
- Use multiple API keys - Distribute across keys (requires code modification)
- 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
Output Structure
Swarm creates a session per target:Troubleshooting
Rate limit errors
Rate limit errors
Reduce parallel load:Or upgrade your AI provider plan for higher rate limits.
JSON parsing error
JSON parsing error
Verify JSON format:Common issues:
- Missing quotes around strings
- Trailing commas
- Unescaped quotes in URLs
Out of memory
Out of memory
Reduce target count:
Some targets fail
Some targets fail
Check individual logs:Common causes:
- Target unreachable
- Authentication required
- Rate limiting from target
Best Practices
Organize targets logically
Organize targets logically
Group related services:
Start with small batches
Start with small batches
Test 2-3 targets first to validate:
Use descriptive target names
Use descriptive target names
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

