Documentation ¶
Overview ¶
Package tcp contains a configurable client used for TCP-based peer-to-peer Agent communications
Index ¶
- Constants
- type Client
- func (client *Client) Authenticate(msg messages.Base) (err error)
- func (client *Client) Connect() (err error)
- func (client *Client) Construct(msg messages.Base) (data []byte, err error)
- func (client *Client) Deconstruct(data []byte) (messages.Base, error)
- func (client *Client) Get(key string) (value string)
- func (client *Client) Initial() (err error)
- func (client *Client) Listen() (returnMessages []messages.Base, err error)
- func (client *Client) Send(m messages.Base) (returnMessages []messages.Base, err error)
- func (client *Client) SendAndWait(m messages.Base) (returnMessages []messages.Base, err error)
- func (client *Client) Set(key string, value string) (err error)
- func (client *Client) String() string
- func (client *Client) Synchronous() bool
- type Config
Constants ¶
const ( BIND = 0 REVERSE = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { sync.Mutex // used to lock the Client when changes are being made by one function or routine // contains filtered or unexported fields }
Client is a type of MerlinClient that is used to send and receive Merlin messages from the Merlin server
func (*Client) Authenticate ¶
Authenticate is the top-level function used to authenticate an agent to server using a specific authentication protocol The function must take in a Base message for when the C2 server requests re-authentication through a message
func (*Client) Connect ¶
Connect establish a connection with the remote host depending on the Client's type (e.g., BIND or REVERSE)
func (*Client) Construct ¶
Construct takes in a messages.Base structure that is ready to be sent to the server and runs all the configured transforms on it to encode and encrypt it.
func (*Client) Deconstruct ¶
Deconstruct takes in data returned from the server and runs all the Agent's transforms on it until a messages.Base structure is returned. The key is used for decryption transforms
func (*Client) Get ¶
Get is a generic function that is used to retrieve the value of a Client's field
func (*Client) Initial ¶
Initial executes the specific steps required to establish a connection with the C2 server and checkin or register an agent
func (*Client) Listen ¶
Listen waits for incoming data on an established TCP connection, deconstructs the data into a Base messages, and returns them
func (*Client) Send ¶
Send takes in a Merlin message structure, performs any encoding or encryption, converts it to a delegate and writes it to the output stream. This function DOES not wait or listen for response messages.
func (*Client) SendAndWait ¶
SendAndWait takes in a Merlin message, encodes/encrypts it, and writes it to the output stream and then waits for response messages and returns them
func (*Client) Synchronous ¶
Synchronous identifies if the client connection is synchronous or asynchronous, used to determine how and when messages can be sent/received.
type Config ¶
type Config struct { Address []string // Address the interface and port the agent will bind to AgentID uuid.UUID // AgentID the Agent's UUID AuthPackage string // AuthPackage the type of authentication the agent should use when communicating with the server ListenerID uuid.UUID // ListenerID the UUID of the listener that this Agent is configured to communicate with Padding string // Padding the max amount of data that will be randomly selected and appended to every message PSK string // PSK the Pre-Shared Key secret the agent will use to start authentication Transformers string // Transformers is an ordered comma seperated list of transforms (encoding/encryption) to apply when constructing a message Mode string // Mode the type of client or communication mode (e.g., BIND or REVERSE) }
Config is a structure that is used to pass in all necessary information to instantiate a new Client