client

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 39 Imported by: 58

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{
	ServerURL:                "oast.pro,oast.live,oast.site,oast.online,oast.fun,oast.me",
	CorrelationIdLength:      settings.CorrelationIdLengthDefault,
	CorrelationIdNonceLength: settings.CorrelationIdNonceLengthDefault,
}

DefaultOptions is the default options for the interact client

View Source
var ErrUploadNotAdvertised = fmt.Errorf("%w: server did not advertise file hosting capabilities", ErrUploadUnsupported)

ErrUploadNotAdvertised is returned when the server advertised no capabilities at all, which means it predates file hosting. The remedy is to upgrade the server rather than to pass it a flag, so it is distinguishable from a server that advertised uploads as switched off.

It wraps ErrUploadUnsupported, so a caller that only asks "can this server host files?" needs no change.

View Source
var ErrUploadUnsupported = errors.New("interactsh server does not support file upload")

ErrUploadUnsupported is returned when the interactsh server does not offer file hosting, either because it was started without -upload or because it predates the feature.

Declared with errors.New rather than errkit.New so that errors.Is stays exact: errkit compares errors by message, which makes a sentinel and anything whose message contains it match in both directions.

Functions

This section is empty.

Types

type Client

type Client struct {
	State atomic.Value

	CorrelationIdNonceLength int
	// contains filtered or unexported fields
}

Client is a client for communicating with interactsh server instance.

func New

func New(options *Options) (*Client, error)

New creates a new client instance based on provided options

func (*Client) Capabilities added in v1.4.0

func (c *Client) Capabilities() *server.Capabilities

Capabilities returns the optional features advertised by the server at registration, or nil if the server did not advertise any.

func (*Client) CapabilitiesKnown added in v1.4.0

func (c *Client) CapabilitiesKnown() bool

CapabilitiesKnown reports whether a registration response has been received, which is what distinguishes a server that advertised no capabilities from a resumed session that never got to ask.

func (*Client) Close

func (c *Client) Close() error

Close closes the collaborator client and deregisters from the collaborator server if not explicitly asked by the user.

func (*Client) FTPFileURL added in v1.4.0

func (c *Client) FTPFileURL(payloadHost string, file UploadedFile) string

FTPFileURL returns the ftp:// URL for a hosted file. FTP has no host-based routing, so the correlation ID travels in the path instead.

Any port on payloadHost is dropped: it belongs to the server's HTTP listener, which says nothing about where the FTP listener is bound, so carrying it over would produce a URL that cannot connect.

func (*Client) FileURL added in v1.4.0

func (c *Client) FileURL(payloadHost string, file UploadedFile) string

FileURL returns the URL a target should fetch to retrieve a hosted file. payloadHost is any host produced by URL(); only its correlation ID prefix is significant to the server, so a single call to URL() serves every file.

func (*Client) SaveSessionTo added in v1.0.3

func (c *Client) SaveSessionTo(filename string) error

func (*Client) ServerSupportsIPv6 added in v1.4.0

func (c *Client) ServerSupportsIPv6(ctx context.Context) (bool, error)

ServerSupportsIPv6 reports whether the interactsh server in use publishes IPv6 (AAAA) records. A false result means interactions reaching the target over IPv6 are silently dropped by the server. The boolean is meaningful only when the returned error is nil.

func (*Client) ServerURL added in v1.4.0

func (c *Client) ServerURL() string

ServerURL returns the interactsh server the client registered to.

func (*Client) StartPolling

func (c *Client) StartPolling(duration time.Duration, callback InteractionCallback) error

StartPolling the server each duration and returns any events that may have been captured by the collaborator server.

func (*Client) StopPolling

func (c *Client) StopPolling() error

StopPolling the interactsh server.

func (*Client) TryGetAsnInfo added in v1.1.1

func (c *Client) TryGetAsnInfo(interaction *server.Interaction) error

TryGetAsnInfo attempts to enrich interaction with asn data

func (*Client) URL

func (c *Client) URL() string

URL returns a new URL that can be used for external interaction requests.

func (*Client) UploadFiles added in v1.4.0

func (c *Client) UploadFiles(paths []string) ([]UploadedFile, error)

UploadFiles uploads local files to the interactsh server this client registered with, to be hosted against its correlation ID.

Only the registered server is targeted. A Client holds a single correlation ID, registered with whichever server answered first, so the other servers in -s have never seen it and would reject the upload. Posting blindly to them would also be actively harmful: a server without -upload has no route for the request, so it falls through to the catch-all handler that records whole requests as interactions, and the file would be stored there anyway.

type InteractionCallback

type InteractionCallback func(*server.Interaction)

InteractionCallback is a callback function for a reported interaction

type Options

type Options struct {
	// ServerURL is the URL for the interactsh server.
	ServerURL string
	// Token if the server requires authentication
	Token string
	// DisableHTTPFallback determines if failed requests over https should not be retried over http
	DisableHTTPFallback bool
	// CorrelationIdLength of the preamble
	CorrelationIdLength int
	// CorrelationIdNonceLengthLength of the nonce
	CorrelationIdNonceLength int
	// HTTPClient use a custom http client
	HTTPClient *retryablehttp.Client
	// SessionInfo to resume an existing session
	SessionInfo *options.SessionInfo
	// keepAliveInterval to renew the session
	KeepAliveInterval time.Duration
}

Options contains configuration options for interactsh client

type State added in v1.1.0

type State uint8
const (
	Idle State = iota
	Polling
	Closed
)

type UploadedFile added in v1.4.0

type UploadedFile struct {
	Name     string `json:"name"`
	Size     int64  `json:"size"`
	SHA256   string `json:"sha256"`
	HTTPPath string `json:"http-path"`
	FTPPath  string `json:"ftp-path"`
}

UploadedFile describes a file hosted by the interactsh server.

Jump to

Keyboard shortcuts

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