Overview
The configuration module defines all framework-wide settings including network parameters, cryptography keys, logging configuration, and security controls. File:common/config_example.py (actual common/config.py not committed to repository)
Network Configuration
List of allowed hostnames/IPs for the C2 server. Used for host header validation.
C2 server hostname or IP address
Server port for HTTPS connections
Backend port when running behind a reverse proxy
TLS Configuration
Path to TLS certificate file for HTTPS
Beacon Timing
Base beacon interval in seconds. Agents check in at this frequency (before jitter).
Jitter percentage (0-100) applied to beacon interval. Adds randomness to avoid pattern detection.Formula:
actual_interval = BEACON_INTERVAL_S * (1 ± JITTER_PCT/100)Traffic Padding
Minimum padding to add to messages in bytes
Maximum padding to add to messages in bytes. Random amount between min and max is added to each message.
Cryptography
32-byte pre-shared key for session key derivationDefault:
b'REPLACE_WITH_REAL_32_BYTE_KEY!!!'Logging Configuration
Logging level. Valid values:
'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'Directory path for log files. Created automatically if it doesn’t exist.
Maximum size of each log file in bytes before rotation (default: 5 MB)
Number of rotated log files to keep
Security Controls
List of command patterns that are blocked for security. Tasks containing these strings will be rejected.Default blocked commands:
'reg'- Registry modifications'schtasks'- Scheduled tasks'at'- Legacy task scheduler'sc'- Service control'net use'- Network shares'arp'- ARP manipulation'nmap'- Network scanning'whoami /priv'- Privilege enumeration'net localgroup'- Local group enumeration
These blocks are for lab safety. In a red team scenario, you would customize this list based on scope and rules of engagement.
Lab Environment
Environment variable name to check for lab mode
Required value for lab mode environment variable
Set to
True when running behind nginx reverse proxy. Read from BEHIND_NGINX environment variable.Configuration Example
Here’s a complete example configuration:Usage
Import configuration variables anywhere in the codebase:Security Best Practices
Pre-Shared Key Management
Pre-Shared Key Management
Network Configuration
Network Configuration
- Use
ALLOWED_HOSTSto prevent host header attacks - Configure TLS with valid certificates
- Use non-standard ports if appropriate for OPSEC
Logging
Logging
- Never log sensitive data (keys, passwords, PII)
- Rotate logs to prevent disk exhaustion
- Secure log files with appropriate permissions
Command Blocking
Command Blocking
- Customize
BLOCKED_COMMANDSfor your environment - Consider allowlisting instead of blocklisting for stricter control
- Document any changes to security controls
Environment Variables
Some settings can be overridden with environment variables:| Variable | Purpose | Example |
|---|---|---|
LAB_MODE | Enable lab mode | export LAB_MODE=1 |
BEHIND_NGINX | Running behind reverse proxy | export BEHIND_NGINX=1 |
See Also
- Cryptography - Uses
PRE_SHARED_KEYfor key derivation - Logger - Uses logging configuration
- Traffic Profile - Uses beacon timing and padding settings