Overview
For best performance, run Apex in the included Kali Linux container with preconfigured penetration testing tools. This provides:- Pre-installed tools: nmap, gobuster, sqlmap, nikto, hydra, john, hashcat, and more
- Consistent environment: Same tooling across all developers/CI systems
- Isolation: Keep pentest tools separate from your host system
- Network flexibility: Use
hostnetwork mode for comprehensive scanning
The Kali container is recommended for production use but not required. Apex works on any system with Bun installed.
Quick Start
1
Navigate to Container Directory
2
Configure Environment Variables
Copy the example environment file and add your API keys:Edit
.env with your API keys:3
Build and Start Container
4
Exec Into Container
5
Run Apex
Inside the container:
Docker Compose Configuration
The includeddocker-compose.yml provides a complete Kali Linux environment:
Key Configuration Options
Network Mode
Bridge Mode (Default)- Isolated network namespace
- Port mapping required for external access
- Use for: General pentesting, web app testing
- Direct access to host network
- No port mapping needed
- Use for: Network scanning, testing local services, comprehensive recon
Capabilities
- Port scanning with nmap
- Packet capture with tcpdump
- Raw socket operations
Security Options
These elevated permissions are intentional for a pentest environment. Do not use this configuration for production services.
Dockerfile Breakdown
The Kali container is built from the official Kali Rolling image:Installed Tools
The container includes these pentest tools used by Apex:Apex automatically detects which tools are available and adjusts its testing strategy accordingly. Run
pensar doctor to check installed dependencies.Network Modes Explained
Bridge Mode (Default)
- Container gets its own network namespace
- Docker creates a virtual bridge (docker0)
- Container IP is in Docker’s subnet (e.g., 172.17.0.0/16)
- Port mapping required to access services from host
- Testing external web applications
- Running on macOS or Windows
- You want network isolation
https://staging.example.com
Host Mode (Linux Only)
- Container uses the host’s network stack directly
- No network isolation
- Container can access localhost, LAN devices, etc.
- Scanning local network (192.168.x.x)
- Testing localhost services
- Comprehensive network reconnaissance
- Need raw socket access
Custom Bridge Networks
For multi-container setups:vulnerable-app by hostname:
Environment Variables
The.env file is automatically loaded inside the container:
Volume Mounts
Source Code Mount
The../:/home/pentest/app mount allows whitebox testing:
Workspace Mount
Theworkspace/ directory persists across container restarts:
- Session data
- Findings
- Reports
- Screenshots
Common Workflows
Testing a Web Application
Whitebox Testing with Source Code
Network Scanning (Linux)
Troubleshooting
”Permission denied” when running nmap
Cause: MissingNET_RAW capability.
Solution: Ensure cap_add includes NET_RAW in docker-compose.yml:
Container exits immediately
Cause: Missingtty: true and stdin_open: true.
Solution: Verify your docker-compose.yml includes:
“Cannot connect to target” on localhost
Cause: Bridge mode isolates the container network. Solutions:- Use host mode (Linux only):
network_mode: "host" - Use
host.docker.internalinstead oflocalhost: - Use the host’s LAN IP (e.g.,
192.168.1.100)
Tools not found (nmap, gobuster, etc.)
Cause: Container wasn’t rebuilt after Dockerfile changes. Solution: Rebuild with--no-cache:
API key not recognized inside container
Cause:.env file not created or mounted.
Solution:
- Ensure
container/.envexists: - Verify
env_file: - .envis indocker-compose.yml - Restart container:
- Test inside container:
Advanced Configuration
Custom Dockerfile
Add additional tools:GPU Access for Hashcat
Multiple Containers for Parallel Testing
CI/CD Integration
GitHub Actions
GitLab CI
Next Steps
Blackbox Testing
Run external penetration tests from the Kali container
Whitebox Testing
Analyze source code with the —cwd flag
Authentication
Configure credentials for authenticated testing
vLLM Setup
Use local models instead of cloud APIs

