Skip to main content

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 host network 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 included docker-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
Host Mode (Linux only)
  • Direct access to host network
  • No port mapping needed
  • Use for: Network scanning, testing local services, comprehensive recon
Host mode is only available on Linux. On macOS/Windows, use bridge mode or configure port forwarding.

Capabilities

These capabilities allow:
  • Port scanning with nmap
  • Packet capture with tcpdump
  • Raw socket operations

Security Options

Unconfined seccomp allows unrestricted syscall access, needed for low-level network operations.
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)

How it works:
  • 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
Use when:
  • Testing external web applications
  • Running on macOS or Windows
  • You want network isolation
Example: Testing https://staging.example.com

Host Mode (Linux Only)

How it works:
  • Container uses the host’s network stack directly
  • No network isolation
  • Container can access localhost, LAN devices, etc.
Use when:
  • Scanning local network (192.168.x.x)
  • Testing localhost services
  • Comprehensive network reconnaissance
  • Need raw socket access
On Linux hosts, consider using network_mode: host for comprehensive network scanning.
Example: Scanning your local network

Custom Bridge Networks

For multi-container setups:
Now Apex can test vulnerable-app by hostname:

Environment Variables

The .env file is automatically loaded inside the container:
The Dockerfile automatically exports these variables in the shell:

Volume Mounts

Source Code Mount

The ../:/home/pentest/app mount allows whitebox testing:

Workspace Mount

The workspace/ 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: Missing NET_RAW capability. Solution: Ensure cap_add includes NET_RAW in docker-compose.yml:

Container exits immediately

Cause: Missing tty: 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:
  1. Use host mode (Linux only): network_mode: "host"
  2. Use host.docker.internal instead of localhost:
  3. 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:
  1. Ensure container/.env exists:
  2. Verify env_file: - .env is in docker-compose.yml
  3. Restart container:
  4. Test inside container:

Advanced Configuration

Custom Dockerfile

Add additional tools:

GPU Access for Hashcat

Multiple Containers for Parallel Testing

Run parallel pentests:

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