Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Capabilities() *server.Capabilities
- func (c *Client) CapabilitiesKnown() bool
- func (c *Client) Close() error
- func (c *Client) FTPFileURL(payloadHost string, file UploadedFile) string
- func (c *Client) FileURL(payloadHost string, file UploadedFile) string
- func (c *Client) SaveSessionTo(filename string) error
- func (c *Client) ServerSupportsIPv6(ctx context.Context) (bool, error)
- func (c *Client) ServerURL() string
- func (c *Client) StartPolling(duration time.Duration, callback InteractionCallback) error
- func (c *Client) StopPolling() error
- func (c *Client) TryGetAsnInfo(interaction *server.Interaction) error
- func (c *Client) URL() string
- func (c *Client) UploadFiles(paths []string) ([]UploadedFile, error)
- type InteractionCallback
- type Options
- type State
- type UploadedFile
Constants ¶
This section is empty.
Variables ¶
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
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.
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 (*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
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 ¶
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 (*Client) ServerSupportsIPv6 ¶ added in v1.4.0
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
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 ¶
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) 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