callback

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package callback provides callback/out-of-band detection capabilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackEvent

type CallbackEvent struct {
	Token     string            `json:"token"`
	Type      string            `json:"type"` // http, dns
	SourceIP  string            `json:"source_ip"`
	Timestamp time.Time         `json:"timestamp"`
	Data      map[string]string `json:"data"`
	Method    string            `json:"method,omitempty"`
	Path      string            `json:"path,omitempty"`
	Headers   map[string]string `json:"headers,omitempty"`
	Body      string            `json:"body,omitempty"`
	DNSQuery  string            `json:"dns_query,omitempty"`
	QueryType string            `json:"query_type,omitempty"`
}

CallbackEvent represents a received callback

type CallbackServer

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

CallbackServer handles HTTP and DNS callbacks for OOB detection

func NewCallbackServer

func NewCallbackServer(settings CallbackSettings) *CallbackServer

NewCallbackServer creates a new callback server

func (*CallbackServer) CheckCallback

func (cs *CallbackServer) CheckCallback(token string) (*PendingCallback, bool)

CheckCallback checks if a callback was received for a token

func (*CallbackServer) GetDNSCallback

func (cs *CallbackServer) GetDNSCallback(token string) string

GetDNSCallback returns the DNS callback domain for a token

func (*CallbackServer) GetHTTPCallback

func (cs *CallbackServer) GetHTTPCallback(token string) string

GetHTTPCallback returns the HTTP callback URL for a token

func (*CallbackServer) GetPendingCallbacks

func (cs *CallbackServer) GetPendingCallbacks() []*PendingCallback

GetPendingCallbacks returns all pending callbacks

func (*CallbackServer) GetReceivedCallbacks

func (cs *CallbackServer) GetReceivedCallbacks() []*PendingCallback

GetReceivedCallbacks returns callbacks that were received

func (*CallbackServer) GetStatus

func (cs *CallbackServer) GetStatus() ([]byte, error)

GetStatus returns the server status as JSON

func (*CallbackServer) RegisterCallback

func (cs *CallbackServer) RegisterCallback(requestID, attackType string, endpoint types.Endpoint, payload string) string

RegisterCallback registers a pending callback

func (*CallbackServer) Start

func (cs *CallbackServer) Start(ctx context.Context) error

Start starts the callback servers

func (*CallbackServer) Stop

func (cs *CallbackServer) Stop() error

Stop stops the callback servers

func (*CallbackServer) WaitForCallback

func (cs *CallbackServer) WaitForCallback(ctx context.Context, token string) (*CallbackEvent, error)

WaitForCallback waits for a callback with the given token

type CallbackSettings

type CallbackSettings struct {
	HTTPPort    int           `yaml:"http_port" json:"http_port"`
	DNSPort     int           `yaml:"dns_port" json:"dns_port"`
	ExternalURL string        `yaml:"external_url" json:"external_url"`
	DNSDomain   string        `yaml:"dns_domain" json:"dns_domain"`
	Timeout     time.Duration `yaml:"timeout" json:"timeout"`
}

CallbackSettings holds callback server configuration

type PendingCallback

type PendingCallback struct {
	ID         string         `json:"id"`
	Token      string         `json:"token"`
	RequestID  string         `json:"request_id"`
	AttackType string         `json:"attack_type"`
	Endpoint   types.Endpoint `json:"endpoint"`
	Payload    string         `json:"payload"`
	CreatedAt  time.Time      `json:"created_at"`
	ExpiresAt  time.Time      `json:"expires_at"`
	Received   bool           `json:"received"`
	ReceivedAt time.Time      `json:"received_at,omitempty"`
}

PendingCallback represents a callback we're waiting for

func (*PendingCallback) ToFinding

func (cb *PendingCallback) ToFinding() types.Finding

ToFinding converts a received callback to a Finding

Jump to

Keyboard shortcuts

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