http

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2023 License: GPL-3.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	clients.MerlinClient
	Client   *http.Client // Client to send messages with
	Protocol string
	URL      []string          // A slice of URLs to send messages to (e.g., https://127.0.0.1:443/test.php)
	Host     string            // HTTP Host header value
	Proxy    string            // Proxy string
	JWT      string            // JSON Web Token for authorization
	Headers  map[string]string // Additional HTTP headers to add to the request

	UserAgent  string // HTTP User-Agent value
	PaddingMax int    // PaddingMax is the maximum size allowed for a randomly selected message padding length
	JA3        string // JA3 is a string that represent how the TLS client should be configured, if applicable
	Parrot     string // Parrot is a feature of the github.com/refraction-networking/utls to mimic a specific browser

	AgentID uuid.UUID // TODO can this be recovered through reflection since client is embedded into agent?
	// 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 New

func New(config Config) (*Client, error)

New instantiates and returns a Client that is constructed from the passed in Config

func (*Client) Auth

func (client *Client) Auth(auth string, register bool) (messages.Base, error)

Auth is the top-level function used to authenticate an agent to server using a specific authentication protocol register is specific to OPAQUE where the agent must register with the server before it can authenticate

func (*Client) Get

func (client *Client) Get(key string) string

Get is a generic function that is used to retrieve the value of a Client's field

func (*Client) Initial

func (client *Client) Initial(agent messages.AgentInfo) (messages.Base, error)

Initial executes the specific steps required to establish a connection with the C2 server and checkin or register an agent

func (*Client) Send added in v1.3.1

func (client *Client) Send(m messages.Base) (returnMessages []messages.Base, err error)

Send takes in a Merlin message structure, performs any encoding or encryption, and sends it to the server The function also decodes and decrypts response messages and return a Merlin message structure. This is where the client's logic is for communicating with the server.

func (*Client) Set

func (client *Client) Set(key string, value string) error

Set is a generic function that is used to modify a Client's field values

type Config

type Config struct {
	AgentID     uuid.UUID // The Agent's UUID
	Protocol    string    // Proto contains the transportation protocol the agent is using (i.e. http2 or http3)
	Host        string    // Host is used with the HTTP Host header for Domain Fronting activities
	Headers     string    // Headers is a new-line separated string of additional HTTP headers to add to client requests
	URL         []string  // URL is the protocol, domain, and page that the agent will communicate with (e.g., https://google.com/test.aspx)
	Proxy       string    // Proxy is the URL of the proxy that all traffic needs to go through, if applicable
	UserAgent   string    // UserAgent is the HTTP User-Agent header string that Agent will use while sending traffic
	PSK         string    // PSK is the Pre-Shared Key secret the agent will use to start authentication
	JA3         string    // JA3 is a string that represent how the TLS client should be configured, if applicable
	Parrot      string    // Parrot is a feature of the github.com/refraction-networking/utls to mimic a specific browser
	Padding     string    // Padding is the max amount of data that will be randomly selected and appended to every message
	AuthPackage string    // AuthPackage is the type of authentication the agent should use when communicating with the server
	Opaque      []byte    // Opaque is the byte representation of the EnvU object used with the OPAQUE protocol (future use)
}

Config is a structure that is used to pass in all necessary information to instantiate a new Client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL