The PacketHandler class is responsible for creating, parsing, and processing packets for agent-server communication. This includes encrypting/decrypting packets, extracting metadata, and routing tasking.
Attributes
agent: An instance of the main agent.
key: Encryption key for the current session.
staging_key: Key used during the staging process.
session_id: Unique identifier for the current session.
missedCheckins: Counter for failed check-ins.
language_list: Dictionary linking programming languages to unique IDs.
meta: Defines metadata types for packets.
additional: Empty dictionary, can be populated with additional metadata.
Methods
ChaCha20Poly1305
ChaCha20Poly1305 class that seals/unseals the input data with the given key and nonce.
parse_routing_packet(staging_key, data)
Parses the encrypted agent data from a routing packet, which includes session ID, language, metadata type, and the encrypted data. The function returns a dictionary with session IDs as keys and tuples (language, metadata, additional data, encrypted data) as values.