How mythicagents/hannibal works
Hannibal is a modular, position-independent Windows Mythic stage-one agent. An operator issues commands through Mythic; the Python translator encodes task messages, the agent’s HTTP profile receives and queues them, and command handlers perform host actions and return results. The profile also handles check-in and chunked file transfer. The repository documents optional HBIN execution, Ekko sleep, and a replaceable HTTP profile. Excerpts establish the task-queue and profile responsibilities, but do not show all runtime dispatch calls; unsampled links are omitted or marked unverified.
Main entry points: profile_mythic_http.c HTTP profile · hannibal_tasking.h Task queues · utility_encryption_AES.c Encryption and hashing · hannibal.c Agent entry
Components 20
Mythic integration
- Command definitions
Payload_Type/hannibal/hannibal/mythic/agent_functions - Message translator
Payload_Type/python_services/translator/translator.py
Agent runtime
- Agent entry
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/hannibal.c - HTTP profile
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/profile_mythic_http.c - Task queues
Payload_Type/hannibal/hannibal/agent_code/Hannibal/include/hannibal_tasking.h - File transfer
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/profile_mythic_http.c
Host capabilities
- File commands
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src - Process commands
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src - Host information
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src - HBIN execution
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/cmd_execute_hbin.c
Runtime internals
- Ekko sleep
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_sleep_ekko.c - Encryption and hashing
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_encryption_AES.c - Serialization
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_serialization.c - WinINet transport
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_http_wininet.c - API resolution
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/hannibal_resolve_pointers.c - AES implementation
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_encryption_AES.c - SHA-256 implementation
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_hashing_sha256.c - HMAC implementation
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_hashing_sha256_hmac.c
Other components
- Operator
- Mythic server
Connections 20
- Operator → Mythic server: issues tasks
- Mythic server → Command definitions: selects command
- Mythic server → Message translator: sends task data
- Message translator → HTTP profile: encodes task messages
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/profile_mythic_http.c - HTTP profile → Task queues: enqueues tasks
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/profile_mythic_http.c - Agent entry → HTTP profile: uses profile
- HTTP profile → Mythic server: polls and posts
- HTTP profile → File transfer: handles transfers
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/profile_mythic_http.c - Task queues → File commands: dispatches
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/cmd_ps.c - Task queues → Process commands: dispatches
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/cmd_ps.c - Task queues → Host information: dispatches
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/cmd_ps.c - Task queues → HBIN execution: dispatches
- Agent entry → Ekko sleep: sleeps with
- HTTP profile → Encryption and hashing: encrypts messages
- HTTP profile → Serialization: serializes messages
- HTTP profile → WinINet transport: uses transport
- API resolution → Agent entry: resolves APIs
- Encryption and hashing → AES implementation: uses AES
Payload_Type/hannibal/hannibal/agent_code/Hannibal/src/utility_encryption_AES.c - Encryption and hashing → SHA-256 implementation: uses SHA-256
- Encryption and hashing → HMAC implementation: uses HMAC