httpclient

package
v1.5.34 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed                             = errors.New("http session closed")
	ErrStatusCodeUnexpected               = errors.New("unexpected http response code")
	TimeDelta               time.Duration = 0
)

Functions

This section is empty.

Types

type HTTPDriver

type HTTPDriver interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPDriver - The interface to send/recv HTTP data

func GetHTTPDriver

func GetHTTPDriver(origin string, secure bool, opts *HTTPOptions) (HTTPDriver, error)

GetHTTPDriver - Get an instance of the specified HTTP driver

func GoHTTPDriver

func GoHTTPDriver(origin string, secure bool, opts *HTTPOptions) (HTTPDriver, error)

GoHTTPDriver - Pure Go HTTP driver

type HTTPOptions

type HTTPOptions struct {
	Driver               string
	NetTimeout           time.Duration
	TlsTimeout           time.Duration
	PollTimeout          time.Duration
	MaxErrors            int
	ForceHTTP            bool
	DisableAcceptHeader  bool
	DisableUpgradeHeader bool
	HostHeader           string

	ProxyConfig   string
	ProxyUsername string
	ProxyPassword string
	AskProxyCreds bool
}

HTTPOptions - c2 specific configuration options

func ParseHTTPOptions

func ParseHTTPOptions(c2URI *url.URL) *HTTPOptions

ParseHTTPOptions - Parse c2 specific configuration options

type Jar

type Jar struct {
	// contains filtered or unexported fields
}

Jar - CookieJar implementation that ignores domains/origins

func NewJar

func NewJar() *Jar

NewJar - Get a new instance of a cookie jar

func (*Jar) Cookies

func (jar *Jar) Cookies(u *url.URL) []*http.Cookie

Cookies returns the cookies to send in a request for the given URL. It is up to the implementation to honor the standard cookie use restrictions such as in RFC 6265 (which we do not).

func (*Jar) SetCookies

func (jar *Jar) SetCookies(u *url.URL, cookies []*http.Cookie)

SetCookies handles the receipt of the cookies in a reply for the given URL (which is ignored).

type SliverHTTPClient

type SliverHTTPClient struct {
	Origin     string
	PathPrefix string

	ProxyURL   string
	SessionCtx *cryptography.CipherContext
	SessionID  string

	Closed bool

	Options *HTTPOptions
	// contains filtered or unexported fields
}

SliverHTTPClient - Helper struct to keep everything together

func HTTPStartSession

func HTTPStartSession(address string, pathPrefix string, opts *HTTPOptions) (*SliverHTTPClient, error)

HTTPStartSession - Attempts to start a session with a given address

func (*SliverHTTPClient) CloseSession

func (s *SliverHTTPClient) CloseSession() error

func (*SliverHTTPClient) DoPoll

func (s *SliverHTTPClient) DoPoll(req *http.Request) (*http.Response, []byte, error)

Do - Wraps http.Client.Do with a context

func (*SliverHTTPClient) NonceQueryArgument

func (s *SliverHTTPClient) NonceQueryArgument(uri *url.URL, value int) *url.URL

NonceQueryArgument - Adds a nonce query argument to the URL

func (*SliverHTTPClient) OTPQueryArgument

func (s *SliverHTTPClient) OTPQueryArgument(uri *url.URL, value string) *url.URL

OTPQueryArgument - Adds an OTP query argument to the URL

func (*SliverHTTPClient) ReadEnvelope

func (s *SliverHTTPClient) ReadEnvelope() (*pb.Envelope, error)

ReadEnvelope - Perform an HTTP GET request

func (*SliverHTTPClient) SessionInit

func (s *SliverHTTPClient) SessionInit() error

SessionInit - Initialize the session

func (*SliverHTTPClient) WriteEnvelope

func (s *SliverHTTPClient) WriteEnvelope(envelope *pb.Envelope) error

WriteEnvelope - Perform an HTTP POST request

Directories

Path Synopsis
drivers
win/wininet
Code generated by tools/defines.go; DO NOT EDIT.
Code generated by tools/defines.go; DO NOT EDIT.

Jump to

Keyboard shortcuts

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