Overview
The HTTP transport layer provides secure beacon communication over HTTPS with certificate pinning and host validation. All requests use a TLS-pinned session and validate against an allowlist of approved servers. Module:transport.http_transport
Functions
send_beacon()
Sends an encrypted beacon payload to the C2 server via HTTPS POST request.Parameters
Full HTTPS URL of the C2 beacon endpoint. Hostname must be in
ALLOWED_HOSTS configuration.Example: https://192.168.100.10:8443/beaconEncrypted beacon data to send to the server. Should be pre-encrypted by the encryption layer.
Returns
Raw response body from the server, limited to
MAX_RESPONSE_BYTES (65536 bytes)Raises
TransportError
Raised when:
- Endpoint hostname is not in
ALLOWED_HOSTS - Endpoint URL is malformed or missing hostname
- Connection fails or times out
- Server returns HTTP status >= 400
- Request times out after
REQUEST_TIMEOUT_S(10 seconds)
Security Features
- Host Validation: Only connects to servers in the
ALLOWED_HOSTSconfiguration - TLS Certificate Pinning: Uses a specific certificate via
TLSAdapter - Request Timeout: Hard 10-second timeout prevents hanging connections
- Response Size Limit: Caps response at 65536 bytes to prevent memory exhaustion
- Traffic Profiling: Automatically applies evasion profile headers
Usage Examples
Basic Beacon Send
With Error Handling
Checking HTTP Status Codes
Configuration
The transport layer relies on several configuration values:Constants
Hard timeout in seconds for all outbound HTTP requests
Maximum response size to prevent oversized server responses (64 KB)
TLSAdapter Class
Internal adapter that forces the requests library to use a specific SSL context.Internal Functions
_build_session()
Creates arequests.Session with TLS certificate pinning.
TransportError if certificate file not found at TLS_CERT_PATH
_validate_host()
Validates that the endpoint hostname is in the allowed hosts list.TransportError if hostname is missing, invalid, or not in ALLOWED_HOSTS
Logging
The transport layer logs key events:Related APIs
- TLS Wrapper - Certificate pinning and SSL context creation
- Traffic Profile - Evasion profiles for header randomization
- Encryption API - Payload encryption before transport