Web application for performing penetration tests on SaaS services using remote Kali Linux and generating professional HTML reports with AI analysis.
Prerequisites:
- Docker Engine 20.10+
- Docker Compose 2.0+
Steps:
- Configure environment variables:
# Copy example file
cp env.example .env
# Edit .env and configure SECRET_KEY and other variables- Start all services:
docker-compose up -dThis will start:
- PostgreSQL: Database
- Redis: Cache and message broker
- Web: Django application
- Celery: Worker for asynchronous tasks
- Kali (optional): Kali Linux in Docker
- Create superuser (first time):
docker-compose exec web python manage.py createsuperuserNote: Default credentials are automatically created: admin / admin
- Access the application:
- Open: http://localhost:7000
- Login with superuser credentials
Useful commands:
# Windows - Start everything
run.bat
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild images
docker-compose build --no-cache
# Execute Django commands
docker-compose exec web python manage.py <command>Prerequisites:
- Python 3.8+
- PostgreSQL or SQLite
- Redis
Steps:
- Install dependencies:
pip install -r requirements.txt- Configure database:
python manage.py makemigrations
python manage.py migrate- Create administrator user:
python manage.py createsuperuser- Start Redis:
# Windows/Linux/Mac
docker run -d -p 6379:6379 redis:alpine- Start web server:
# Windows
run.bat
# Linux/Mac
daphne -p 7000 pentest_web.asgi:application- Access the application:
- Open: http://localhost:7000
- Login with superuser credentials
- Configure Environment Variables
Copy the example file and configure the variables:
cp env.example .envEdit the .env file and configure:
SECRET_KEY: Django secret key (generate a new one for production)DB_PASSWORD: PostgreSQL database passwordALLOWED_HOSTS: Allowed hosts (add domain in production)
View Logs:
# All services
docker-compose logs -f
# Web only
docker-compose logs -f web
# Celery only
docker-compose logs -f celery
# Kali only
docker-compose logs -f kaliStop Services:
# Stop without removing volumes
docker-compose stop
# Stop and remove containers (keeps volumes)
docker-compose down
# Stop and remove everything (including volumes)
docker-compose down -vRebuild Images:
# Rebuild without cache
docker-compose build --no-cache
# Rebuild and restart
docker-compose up -d --buildExecute Django Commands:
# Migrations
docker-compose exec web python manage.py migrate
# Create migrations
docker-compose exec web python manage.py makemigrations
# Django shell
docker-compose exec web python manage.py shell
# Collect static files
docker-compose exec web python manage.py collectstaticAccess Database:
# PostgreSQL shell
docker-compose exec db psql -U pentest_user -d pentest_db
# Redis CLI
docker-compose exec redis redis-cliThe following volumes are created for persistence:
postgres_data: PostgreSQL database datastatic_volume: Collected static filesmedia_volume: Media filesreports_volume: Generated reportslogs_volume: Log fileskali_data: Kali root user datakali_tools: Custom Kali tools
For development with hot-reload, use volumes:
# docker-compose.override.yml (create this file)
version: '3.8'
services:
web:
volumes:
- .:/app
environment:
- DEBUG=TrueFor production, consider:
- Change SECRET_KEY in
.env - Configure ALLOWED_HOSTS with the real domain
- Use HTTPS (configure nginx as reverse proxy)
- Regular backup of volumes
- Monitor logs and resources
- Disable DEBUG (
DEBUG=False)
Container doesn't start:
# View detailed logs
docker-compose logs web
# Check if ports are free
netstat -an | grep 7000
netstat -an | grep 5432
netstat -an | grep 6379Database connection error:
# Check if PostgreSQL is running
docker-compose ps db
# View PostgreSQL logs
docker-compose logs dbPermission error:
# Adjust permissions (Linux/Mac)
sudo chown -R $USER:$USER .Clean everything and restart:
# Stop and remove everything
docker-compose down -v
# Remove images
docker-compose rm -f
# Rebuild from scratch
docker-compose build --no-cache
docker-compose up -dThis project supports running Kali Linux in Docker, facilitating setup and isolation of the pentesting environment.
# Build and start Kali container
docker-compose build kali
docker-compose up -d kali
# View logs
docker-compose logs -f kaliThe Kali container is configured with:
- Host:
kali(service name in docker-compose) orlocalhost(if accessing externally) - Port:
22(internal) or2222(external) - Username:
root - Password:
kali(β οΈ CHANGE IN PRODUCTION!)
Change Root Password:
# Enter container
docker-compose exec kali bash
# Change password
passwd root
# Or via single command
docker-compose exec kali bash -c "echo 'root:YOUR_NEW_PASSWORD' | chpasswd"- Access application: http://localhost:7000
- Go to Settings
- Configure SSH Connection:
- Host:
kali(if in same docker-compose) orlocalhost(if accessing externally) - Port:
22(internal) or2222(external) - Username:
root - Password:
kali(or the password you set) - Key File: (optional) leave empty or use
~/.ssh/id_rsa
- Host:
Note: SSH connection is automatically configured with Docker Kali defaults when the superuser is created.
# Enter container interactively
docker-compose exec kali bash
# Execute commands
docker-compose exec kali nmap --version
docker-compose exec kali nikto -Version# Enter container
docker-compose exec kali bash
# Install specific tools
apt-get update
apt-get install -y <tool-name>
# Example: install additional tools
apt-get install -y aircrack-ng burpsuiteSSH doesn't connect:
# Check if SSH is running
docker-compose exec kali service ssh status
# Restart SSH
docker-compose exec kali service ssh restart
# View container logs
docker-compose logs kaliTools not found:
# Check installation
docker-compose exec kali which nmap
docker-compose exec kali which nikto
# Reinstall tools
docker-compose exec kali apt-get update
docker-compose exec kali apt-get install -y kali-linux-headlessRebuild Kali image:
# Rebuild with cache
docker-compose build kali
# Rebuild without cache
docker-compose build --no-cache kali
# Restart
docker-compose up -d kali- The Kali container uses default password
kali- CHANGE IN PRODUCTION! - Configure SSH key authentication instead of password
- Do not expose SSH port publicly
- Use only in isolated/development environments
Configure SSH Key:
# Generate SSH key (on host)
ssh-keygen -t rsa -b 4096 -f ~/.ssh/kali_docker_key
# Copy key to container
docker cp ~/.ssh/kali_docker_key.pub pentest_kali:/root/.ssh/authorized_keys
# Configure permissions
docker-compose exec kali chmod 600 /root/.ssh/authorized_keys
docker-compose exec kali chmod 700 /root/.ssh
# Disable password authentication
docker-compose exec kali sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
docker-compose exec kali service ssh restartIf you prefer to use an external Kali Linux (not in Docker), simply don't start the kali service:
# Don't start Kali
docker-compose up -d db redis web celery
# Configure in application with external Kali IP/hostname-
Configure SSH (Kali Linux):
- Go to Settings
- Fill in SSH connection data:
- Host: Kali Linux IP or
kali(if using Docker) - Port: 22 (default) or 2222 (if using Docker externally)
- Username: kali or root
- Password: (Kali password)
- Host: Kali Linux IP or
- Save
-
Configure Company:
- In Settings, fill in "Company" field
- This appears in generated reports
-
Create Scan:
- Click "New Scan"
- Enter Target (URL or IP):
https://example.com - Select Scanners (check the ones you want to execute)
- Choose Execution Mode:
- Sequential: One at a time
- Parallel: All at the same time
- Hybrid: Intelligent (recommended)
- Click "Create Scan"
-
Start Scan:
- On the scan page, click "
βΆοΈ Start Scan" - View real-time progress
- Wait for completion
- On the scan page, click "
-
View Results:
- Click "View Results"
- View details of each scanner
- Click on scanner to see full output
-
Generate Report:
- On results page, click "Generate Report"
- Wait for generation (may take time)
- Click "π₯ Download Report" to download HTML
If a scan gets stuck in "Running":
- Click "
β οΈ Reset & Restart" - Confirm reset
- Click "
βΆοΈ Start Scan" again
If a scan fails:
- The button changes to "π Restart Scan"
- Click to restart automatically
- Python 3.8+
- PostgreSQL (or SQLite for development)
- Redis (via Docker recommended)
- Kali Linux accessible via SSH (can be Docker or external)
- Tools installed on Kali:
- nmap, nikto, sqlmap, dirb, gobuster
- OWASP ZAP, WPScan, SSLyze, WhatWeb, Metasploit
Note: For WhatWeb, use GitHub installation in /opt/whatweb/ instead of apt package.
| Scanner | Function |
|---|---|
| Nmap | Port and service scanning |
| Nikto | Web vulnerability scanning |
| SQLMap | SQL injection testing |
| Dirb | Directory brute force |
| Gobuster | Directory brute force (Go) |
| OWASP ZAP | Web security scanner |
| WPScan | WordPress scanning |
| SSLyze | SSL/TLS analysis |
| WhatWeb | Web technology identification |
| Metasploit | Penetration testing framework |
Executes one scanner at a time, in the selected order.
Executes all scanners simultaneously.
- Respects dependencies (e.g., nmap before others)
- Groups scanners for parallel execution
- Optimizes time while maintaining correct order
Reports include:
- Executive Summary with AI analysis
- Risk Assessment (HIGH/MEDIUM/LOW/MINIMAL)
- Detailed Results from each scanner
- Remediation Plan with priority actions
- Execution Statistics
- Check if Redis is running
- Check SSH connection in Settings
- Check if scanners are installed on Kali
- Refresh the page (F5)
- Check if you are authenticated
- Click "
β οΈ Reset & Restart" - Restart the scan
- Check if Redis is running
- Check server logs
CF_PenTestIQ/
βββ manage.py # Django management script
βββ Dockerfile # Docker image
βββ Dockerfile.kali # Docker image for Kali
βββ docker-compose.yml # Docker orchestration
βββ docker-entrypoint.sh # Initialization script
βββ env.example # Environment variables example
βββ pentest_web/ # Project configuration
βββ apps/
β βββ accounts/ # Authentication
β βββ core/ # Main application
βββ modules/ # Existing modules
β βββ scanners/ # Scanner modules
β βββ ssh_client.py # SSH client
β βββ ai_analyzer.py # AI analysis
βββ templates/ # HTML templates
βββ static/ # Static files
βββ reports/ # Generated reports
βββ logs/ # Log files
βββ data/ # Application data
Security Recommendations:
- Change default passwords in production
- Use SSH key authentication
- Do not expose SSH ports publicly
- Use HTTPS in production
- Regular data backups
- Keep dependencies updated
See env.example for all available variables.
Main variables:
SECRET_KEY: Django secret key (required)DEBUG: Debug mode (True/False)ALLOWED_HOSTS: Allowed hosts (comma-separated)DB_*: Database configurationREDIS_HOST,REDIS_PORT: Redis configurationCELERY_*: Celery configuration
For problems or questions:
- Check server logs
- Check SSH connection
- Check if Redis is running
- Check if scanners are installed on Kali Linux
- Consult Troubleshooting section above
Version: 1.4.0
Last update: December 2025