Skip to main content

Overview

The AgentType class is the base class for implementing custom agents in Havoc. It defines the agent’s metadata, build configuration, command handlers, and communication protocol.

Class Definition

Required Attributes

string
required
The display name of your agent shown in the Havoc client interface.
string
required
Author identifier (typically a handle or username).
string
required
Version string for your agent implementation.
string
required
Brief description of the agent’s purpose and capabilities.
int
required
Unique identifier (hex value) used to distinguish your agent’s traffic from other agents.Example: 0x12345678

Required Methods

buildconfig()

Defines the build configuration options for your agent. These settings are displayed in the Havoc client when generating an agent payload. Returns: dict - Configuration key-value pairs
  • Sleep: Default sleep interval in seconds between check-ins
  • Jitter: Randomization percentage applied to sleep interval
  • Host: Callback host address
  • Port: Callback port number
  • UserAgent: HTTP User-Agent string (for HTTP/HTTPS agents)
  • KillDate: Date when agent should terminate itself

response()

Handles incoming responses from the agent. This method is called when the agent checks in with data. Parameters:
dict
required
Dictionary containing the agent’s response data, including:
  • AgentHeader: Metadata about the agent
  • Encrypted payload data

Communication Methods

console_message()

Sends output to the agent’s console in the Havoc client.
string
required
The message content to display
string
Message type classification (e.g., “good”, “error”, “info”, "")

decrypt_response()

Decrypts an encrypted agent response using your agent’s encryption scheme.

Complete Example

Helper Classes

Parser

Utility class for parsing binary data received from agents.
Methods:
  • parse_int() - Parse a 4-byte integer
  • parse_str() - Parse a length-prefixed string
  • parse_data() - Parse length-prefixed binary data

HavocService

Connect your agent to the Teamserver

Commands

Define custom commands for your agent