Documentation
¶
Index ¶
- Constants
- Variables
- func IsTimeoutError(err error) bool
- func ModifyJSONBodyMap(body []byte, setJSON map[string]interface{}, removeJSON []string) ([]byte, error)
- type BurpBackend
- func (b *BurpBackend) AddRule(ctx context.Context, input ProxyRuleInput) (*protocol.RuleEntry, error)
- func (b *BurpBackend) Close() error
- func (b *BurpBackend) Connect(ctx context.Context) error
- func (b *BurpBackend) DeleteRule(ctx context.Context, idOrLabel string) error
- func (b *BurpBackend) GetProxyHistory(ctx context.Context, count int, offset uint32) ([]ProxyEntry, error)
- func (b *BurpBackend) GetProxyHistoryMeta(ctx context.Context, count int, offset uint32) ([]ProxyEntryMeta, error)
- func (b *BurpBackend) ListRules(ctx context.Context, websocket bool) ([]protocol.RuleEntry, error)
- func (b *BurpBackend) SendRequest(ctx context.Context, name string, req SendRequestInput) (*SendRequestResult, error)
- func (b *BurpBackend) SetInterceptState(ctx context.Context, intercepting bool) error
- type CollyBackend
- func (b *CollyBackend) AddSeeds(ctx context.Context, sessionID string, seeds []CrawlSeed) error
- func (b *CollyBackend) Close() error
- func (b *CollyBackend) CreateSession(ctx context.Context, opts CrawlOptions) (*CrawlSessionInfo, error)
- func (b *CollyBackend) GetFlow(ctx context.Context, flowID string) (*CrawlFlow, error)
- func (b *CollyBackend) GetStatus(ctx context.Context, sessionID string) (*CrawlStatus, error)
- func (b *CollyBackend) ListErrors(ctx context.Context, sessionID string, limit int) ([]CrawlError, error)
- func (b *CollyBackend) ListFlows(ctx context.Context, sessionID string, opts CrawlListOptions) ([]CrawlFlow, error)
- func (b *CollyBackend) ListForms(ctx context.Context, sessionID string, limit int) ([]DiscoveredForm, error)
- func (b *CollyBackend) ListSessions(ctx context.Context, limit int) ([]CrawlSessionInfo, error)
- func (b *CollyBackend) StopSession(ctx context.Context, sessionID string) error
- type CrawlError
- type CrawlFlow
- type CrawlListOptions
- type CrawlOptions
- type CrawlSeed
- type CrawlSessionInfo
- type CrawlStatus
- type CrawlStopResponse
- type CrawlerBackend
- type DiscoveredForm
- type ExportResult
- type FormInput
- type HealthMetricProvider
- type HttpBackend
- type InteractshBackend
- func (b *InteractshBackend) Close() error
- func (b *InteractshBackend) CreateSession(ctx context.Context, label string) (*OastSessionInfo, error)
- func (b *InteractshBackend) DeleteSession(ctx context.Context, idOrDomain string) error
- func (b *InteractshBackend) GetEvent(ctx context.Context, idOrDomain string, eventID string) (*OastEventInfo, error)
- func (b *InteractshBackend) ListSessions(ctx context.Context) ([]OastSessionInfo, error)
- func (b *InteractshBackend) PollSession(ctx context.Context, idOrDomain string, since string, eventType string, ...) (*OastPollResultInfo, error)
- type MCPServerFlags
- type NativeProxyBackend
- func (b *NativeProxyBackend) AddRule(ctx context.Context, input ProxyRuleInput) (*protocol.RuleEntry, error)
- func (b *NativeProxyBackend) Addr() string
- func (b *NativeProxyBackend) ApplyRequestBodyOnlyRules(body []byte, headers proxy.Headers) ([]byte, error)
- func (b *NativeProxyBackend) ApplyRequestRules(req *proxy.RawHTTP1Request) *proxy.RawHTTP1Request
- func (b *NativeProxyBackend) ApplyResponseBodyOnlyRules(body []byte, headers proxy.Headers) []byte
- func (b *NativeProxyBackend) ApplyResponseRules(resp *proxy.RawHTTP1Response) *proxy.RawHTTP1Response
- func (b *NativeProxyBackend) ApplyWSRules(payload []byte, direction string) []byte
- func (b *NativeProxyBackend) CACert() *x509.Certificate
- func (b *NativeProxyBackend) Close() error
- func (b *NativeProxyBackend) DeleteRule(ctx context.Context, idOrLabel string) error
- func (b *NativeProxyBackend) GetProxyHistory(ctx context.Context, count int, offset uint32) ([]ProxyEntry, error)
- func (b *NativeProxyBackend) GetProxyHistoryMeta(ctx context.Context, count int, offset uint32) ([]ProxyEntryMeta, error)
- func (b *NativeProxyBackend) HasBodyRules(isRequest bool) bool
- func (b *NativeProxyBackend) ListRules(ctx context.Context, websocket bool) ([]protocol.RuleEntry, error)
- func (b *NativeProxyBackend) SendRequest(ctx context.Context, name string, req SendRequestInput) (*SendRequestResult, error)
- func (b *NativeProxyBackend) Serve() error
- func (b *NativeProxyBackend) WaitReady(ctx context.Context) error
- type OastBackend
- type OastDeleteResponse
- type OastEventInfo
- type OastPollResultInfo
- type OastSessionInfo
- type PathQueryOpts
- type ProxyEntry
- type ProxyEntryMeta
- type ProxyListRequest
- type ProxyRuleInput
- type ReplaySendRequest
- type RequestSender
- type RuleDeleteResponse
- type SendRequestInput
- type SendRequestResult
- type Server
- type StatusCodeFilter
- type Target
Constants ¶
const ( RuleTypeRequestHeader = "request_header" RuleTypeRequestBody = "request_body" RuleTypeResponseHeader = "response_header" RuleTypeResponseBody = "response_body" RuleTypeWSToServer = "ws:to-server" RuleTypeWSToClient = "ws:to-client" RuleTypeWSBoth = "ws:both" )
Rule type constants for match/replace rules.
const ( WorkflowModeNone = protocol.WorkflowModeNone WorkflowModeExplore = protocol.WorkflowModeExplore WorkflowModeTestReport = protocol.WorkflowModeTestReport WorkflowModeCLI = protocol.WorkflowModeCLI // undocumented, for CLI client use only )
Workflow mode constants
const ( SourceProxy = "proxy" SourceReplay = "replay" )
Flow source constants for display and sorting.
const ( OutputModeFlows = "flows" OutputModeSummary = "summary" OutputModeForms = "forms" OutputModeErrors = "errors" )
Output mode constants for poll tools.
const DefaultMCPPort = 9119
const MaxOastEventsPerSession = 2000
MaxOastEventsPerSession is the maximum number of events stored per session. Oldest events are dropped when this limit is exceeded.
Variables ¶
var ErrLabelExists = errors.New("label already exists")
ErrLabelExists is returned when label conflicts with an existing entry (rule or OAST).
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a requested resource (rule, session, etc.) doesn't exist.
Functions ¶
func IsTimeoutError ¶
IsTimeoutError returns true if the error is a timeout.
func ModifyJSONBodyMap ¶
func ModifyJSONBodyMap(body []byte, setJSON map[string]interface{}, removeJSON []string) ([]byte, error)
ModifyJSONBodyMap applies JSON modifications to the body using map format. This is the format used by MCP: {"key": value, "nested.key": value}.
Exported for CLI parity when sending requests from bundles/files.
Types ¶
type BurpBackend ¶
type BurpBackend struct {
// contains filtered or unexported fields
}
BurpBackend implements HttpBackend using Burp Suite via MCP.
func ConnectBurpBackend ¶
ConnectBurpBackend creates a new Burp HttpBackend with the given MCP URL.
func NewBurpBackend ¶
func NewBurpBackend(client *mcp.BurpClient) *BurpBackend
NewBurpBackend creates a new Burp HttpBackend with the given MCP client.
func (*BurpBackend) AddRule ¶
func (b *BurpBackend) AddRule(ctx context.Context, input ProxyRuleInput) (*protocol.RuleEntry, error)
func (*BurpBackend) Close ¶
func (b *BurpBackend) Close() error
func (*BurpBackend) DeleteRule ¶
func (b *BurpBackend) DeleteRule(ctx context.Context, idOrLabel string) error
func (*BurpBackend) GetProxyHistory ¶
func (b *BurpBackend) GetProxyHistory(ctx context.Context, count int, offset uint32) ([]ProxyEntry, error)
func (*BurpBackend) GetProxyHistoryMeta ¶
func (b *BurpBackend) GetProxyHistoryMeta(ctx context.Context, count int, offset uint32) ([]ProxyEntryMeta, error)
func (*BurpBackend) SendRequest ¶
func (b *BurpBackend) SendRequest(ctx context.Context, name string, req SendRequestInput) (*SendRequestResult, error)
func (*BurpBackend) SetInterceptState ¶
func (b *BurpBackend) SetInterceptState(ctx context.Context, intercepting bool) error
SetInterceptState exposes Burp-specific intercept control. This is not part of the HttpBackend interface as it's Burp-specific.
type CollyBackend ¶
type CollyBackend struct {
// contains filtered or unexported fields
}
CollyBackend implements CrawlerBackend using the Colly library.
func NewCollyBackend ¶
func NewCollyBackend(cfg *config.Config, proxyIndex *store.ProxyIndex, httpBackend HttpBackend) *CollyBackend
NewCollyBackend creates a new Colly-backed CrawlerBackend.
func (*CollyBackend) Close ¶
func (b *CollyBackend) Close() error
func (*CollyBackend) CreateSession ¶
func (b *CollyBackend) CreateSession(ctx context.Context, opts CrawlOptions) (*CrawlSessionInfo, error)
func (*CollyBackend) GetStatus ¶
func (b *CollyBackend) GetStatus(ctx context.Context, sessionID string) (*CrawlStatus, error)
func (*CollyBackend) ListErrors ¶
func (b *CollyBackend) ListErrors(ctx context.Context, sessionID string, limit int) ([]CrawlError, error)
func (*CollyBackend) ListFlows ¶
func (b *CollyBackend) ListFlows(ctx context.Context, sessionID string, opts CrawlListOptions) ([]CrawlFlow, error)
func (*CollyBackend) ListForms ¶
func (b *CollyBackend) ListForms(ctx context.Context, sessionID string, limit int) ([]DiscoveredForm, error)
func (*CollyBackend) ListSessions ¶
func (b *CollyBackend) ListSessions(ctx context.Context, limit int) ([]CrawlSessionInfo, error)
func (*CollyBackend) StopSession ¶
func (b *CollyBackend) StopSession(ctx context.Context, sessionID string) error
type CrawlError ¶
type CrawlError struct {
FlowID string // May be empty if request never sent
URL string // URL that caused the error
Error string // Error message
Status int // HTTP status if available
}
CrawlError represents an error encountered during crawling.
type CrawlFlow ¶
type CrawlFlow struct {
ID string // Short sectool ID
SessionID string // Parent session ID
URL string // Full URL visited
Host string // Hostname (extracted from URL)
Path string // Path with query string (extracted from URL)
Method string // HTTP method
FoundOn string // Parent URL where discovered
Depth int // Crawl depth from seed
StatusCode int // HTTP response status
ContentType string // Response content type
ResponseLength int // Response body length in bytes
Request []byte // Wire-format bytes from httputil.DumpRequestOut
Response []byte // Wire-format bytes from httputil.DumpResponse
Truncated bool // True if response exceeded max_response_body_bytes
Duration time.Duration // Request/response round-trip time
DiscoveredAt time.Time // When this flow was captured
}
CrawlFlow represents a single captured request/response from crawling.
type CrawlListOptions ¶
type CrawlListOptions struct {
Host string // Glob pattern for host
PathPattern string // Glob pattern for path
StatusCodes *StatusCodeFilter // Filter by status codes (supports ranges like 2XX)
Methods []string // Filter by HTTP methods
ExcludeHost string // Exclude hosts matching glob
ExcludePath string // Exclude paths matching glob
Since string // Only flows after this flow_id, or "last" for new flows
Limit int // Max results (0 = no limit)
Offset int // Skip first N results
// Search regexes for header/body content matching.
// Applied during filtering so the since=last cursor only advances
// to the last flow that matches all filters including search.
SearchHeaderRe *regexp.Regexp
SearchBodyRe *regexp.Regexp
}
CrawlListOptions contains filters for listing crawl flows. Mirrors ProxyListRequest filters for consistency.
type CrawlOptions ¶
type CrawlOptions struct {
Label string // Optional unique label for the session
Seeds []CrawlSeed // Initial seeds (URLs and/or flow IDs)
ExplicitDomains []string // User-specified via --domain
AllowedPaths []string // Glob patterns (default: all)
DisallowedPaths []string // Glob patterns (default from config)
MaxDepth int // 0 = unlimited
MaxRequests int // 0 = unlimited
Delay time.Duration // Default: 200ms
RandomDelay time.Duration // Additional random jitter
Parallelism int // Default: 2
IgnoreRobotsTxt bool // Default: false
SubmitForms bool // Default: false
ExtractForms *bool // Default: true (from config)
Headers map[string]string // Custom headers
}
CrawlOptions contains parameters for creating a crawl session.
type CrawlSeed ¶
type CrawlSeed struct {
URL string // Direct URL seed
FlowID string // Or proxy flow ID - extracts URL and ALL headers
}
CrawlSeed represents a seed for starting a crawl.
type CrawlSessionInfo ¶
type CrawlSessionInfo struct {
ID string // Short sectool ID
Label string // Optional user-provided label
CreatedAt time.Time // When the session was created
State string // "running", "stopped", "completed", "error"
}
CrawlSessionInfo represents metadata about a crawl session.
type CrawlStatus ¶
type CrawlStatus struct {
State string // "running", "stopped", "completed", "error"
URLsQueued int // URLs waiting to be visited
URLsVisited int // URLs successfully visited
URLsErrored int // URLs that resulted in errors
FormsDiscovered int // Forms found during crawl
Duration time.Duration // Time since session started
LastActivity time.Time // When last request was made
ErrorMessage string // Error details if State is "error"
}
CrawlStatus contains progress metrics for a crawl session.
type CrawlStopResponse ¶
type CrawlStopResponse struct {
Stopped bool `json:"stopped"`
}
CrawlStopResponse is the response for crawl_stop.
type CrawlerBackend ¶
type CrawlerBackend interface {
// CreateSession starts a new crawl session. Returns immediately; crawling is async.
// Returns error if max concurrent sessions reached or no valid seeds/domains.
CreateSession(ctx context.Context, opts CrawlOptions) (*CrawlSessionInfo, error)
// AddSeeds adds URLs to an existing session (can be called while running).
// sessionID can be the ID or label. Returns error if session is not running.
AddSeeds(ctx context.Context, sessionID string, seeds []CrawlSeed) error
// GetStatus returns session progress metrics.
// sessionID can be the ID or label. Returns ErrNotFound if session doesn't exist.
GetStatus(ctx context.Context, sessionID string) (*CrawlStatus, error)
// ListFlows returns flows matching filters.
// sessionID can be the ID or label.
ListFlows(ctx context.Context, sessionID string, opts CrawlListOptions) ([]CrawlFlow, error)
// ListForms returns forms discovered in a session.
// sessionID can be the ID or label.
ListForms(ctx context.Context, sessionID string, limit int) ([]DiscoveredForm, error)
// ListErrors returns errors encountered in a session.
// sessionID can be the ID or label.
ListErrors(ctx context.Context, sessionID string, limit int) ([]CrawlError, error)
// GetFlow returns a flow by ID. Returns ErrNotFound if flow doesn't exist.
GetFlow(ctx context.Context, flowID string) (*CrawlFlow, error)
// StopSession immediately stops a running crawl. In-flight requests are abandoned.
// sessionID can be the ID or label.
StopSession(ctx context.Context, sessionID string) error
// ListSessions returns all sessions (active and completed), most recent first.
// limit=0 means no limit.
ListSessions(ctx context.Context, limit int) ([]CrawlSessionInfo, error)
// Close cleans up all sessions (called on service shutdown).
Close() error
}
CrawlerBackend defines the interface for web crawling operations.
type DiscoveredForm ¶
type DiscoveredForm struct {
ID string // Short sectool ID
SessionID string // Parent session ID
URL string // Page containing the form
Action string // Form action URL (resolved to absolute)
Method string // GET/POST
Inputs []FormInput // Form fields
HasCSRF bool // Detected CSRF token field
}
DiscoveredForm represents a form found during crawling.
type ExportResult ¶
type ExportResult struct {
BundleID string // Bundle identifier (equals flow_id)
BundlePath string // Full path to bundle directory
Files []string // List of created files
}
ExportResult contains information about an exported flow bundle. BundleID equals FlowID for simpler mental model - one ID per request. Re-exporting the same flow overwrites the bundle, restoring original state.
type FormInput ¶
type FormInput struct {
Name string // Field name attribute
Type string // text, password, hidden, select, textarea, etc.
Value string // Default/current value
Required bool // Has required attribute
}
FormInput represents a single form field.
type HealthMetricProvider ¶
type HealthMetricProvider func() string
HealthMetricProvider is a function that returns a metric value for a given key.
type HttpBackend ¶
type HttpBackend interface {
// Close shuts down the HttpBackend.
Close() error
// GetProxyHistory retrieves proxy HTTP history entries.
// Returns up to count entries starting from offset.
GetProxyHistory(ctx context.Context, count int, offset uint32) ([]ProxyEntry, error)
// GetProxyHistoryMeta retrieves lightweight metadata for proxy history entries.
// Returns up to count entries starting from offset.
GetProxyHistoryMeta(ctx context.Context, count int, offset uint32) ([]ProxyEntryMeta, error)
// SendRequest sends an HTTP request and returns the response.
// The request is raw HTTP bytes. Response is returned as headers and body.
SendRequest(ctx context.Context, name string, req SendRequestInput) (*SendRequestResult, error)
// ListRules returns all enabled match/replace rules managed by sectool.
// websocket=true returns WebSocket rules, false returns HTTP rules.
ListRules(ctx context.Context, websocket bool) ([]protocol.RuleEntry, error)
// AddRule creates a new match/replace rule.
// WebSocket vs HTTP is inferred from rule.Type (ws:* types are WebSocket).
// Returns the created rule with assigned ID.
AddRule(ctx context.Context, rule ProxyRuleInput) (*protocol.RuleEntry, error)
// DeleteRule removes a rule by ID or label.
// Searches both HTTP and WebSocket rules automatically.
DeleteRule(ctx context.Context, idOrLabel string) error
}
HttpBackend defines the interface for proxy history and request sending. This abstraction allows switching between the built-in proxy and Burp MCP.
type InteractshBackend ¶
type InteractshBackend struct {
// contains filtered or unexported fields
}
InteractshBackend implements OastBackend using Interactsh.
func NewInteractshBackend ¶
func NewInteractshBackend(serverURL string) *InteractshBackend
NewInteractshBackend creates a new Interactsh-backed OastBackend.
func (*InteractshBackend) Close ¶
func (b *InteractshBackend) Close() error
func (*InteractshBackend) CreateSession ¶
func (b *InteractshBackend) CreateSession(ctx context.Context, label string) (*OastSessionInfo, error)
func (*InteractshBackend) DeleteSession ¶
func (b *InteractshBackend) DeleteSession(ctx context.Context, idOrDomain string) error
func (*InteractshBackend) GetEvent ¶
func (b *InteractshBackend) GetEvent(ctx context.Context, idOrDomain string, eventID string) (*OastEventInfo, error)
func (*InteractshBackend) ListSessions ¶
func (b *InteractshBackend) ListSessions(ctx context.Context) ([]OastSessionInfo, error)
func (*InteractshBackend) PollSession ¶
type MCPServerFlags ¶
type MCPServerFlags struct {
ConfigPath string
BurpMCPURL string
MCPPort int
ProxyPort int // 0 = not set via CLI
RequireBurp bool // --burp flag: require Burp, error if unavailable
WorkflowMode string // "", "none", "explore", "test-report"
}
MCPServerFlags holds flags for MCP server mode.
func ParseMCPServerFlags ¶
func ParseMCPServerFlags(args []string) (MCPServerFlags, error)
ParseMCPServerFlags parses flags for MCP server mode (sectool mcp).
type NativeProxyBackend ¶
type NativeProxyBackend struct {
// contains filtered or unexported fields
}
NativeProxyBackend implements HttpBackend using the native proxy. This backend provides wire-level fidelity for security testing including HTTP/1.1 and HTTP/2 support with header order preservation.
func NewNativeProxyBackend ¶
func NewNativeProxyBackend(port int, configDir string, maxBodyBytes int, historyStorage store.Storage, ruleStorage store.Storage, timeouts proxy.TimeoutConfig) (*NativeProxyBackend, error)
NewNativeProxyBackend creates a new native proxy backend. Does NOT start serving - call Serve() separately (typically in a goroutine). historyStorage is the storage backend for proxy history entries. ruleStorage is the storage backend for persisting match/replace rules.
func (*NativeProxyBackend) AddRule ¶
func (b *NativeProxyBackend) AddRule(ctx context.Context, input ProxyRuleInput) (*protocol.RuleEntry, error)
func (*NativeProxyBackend) Addr ¶
func (b *NativeProxyBackend) Addr() string
Addr returns the proxy listen address.
func (*NativeProxyBackend) ApplyRequestBodyOnlyRules ¶
func (b *NativeProxyBackend) ApplyRequestBodyOnlyRules(body []byte, headers proxy.Headers) ([]byte, error)
ApplyRequestBodyOnlyRules applies only body rules to a request body. Used by HTTP/2 where headers are sent separately before body. If recompression fails, returns error so caller can reset the stream.
func (*NativeProxyBackend) ApplyRequestRules ¶
func (b *NativeProxyBackend) ApplyRequestRules(req *proxy.RawHTTP1Request) *proxy.RawHTTP1Request
ApplyRequestRules applies request header and body rules. Rules are applied in the order they were added.
func (*NativeProxyBackend) ApplyResponseBodyOnlyRules ¶
func (b *NativeProxyBackend) ApplyResponseBodyOnlyRules(body []byte, headers proxy.Headers) []byte
ApplyResponseBodyOnlyRules applies only body rules to a response body. Used by HTTP/2 where headers are sent separately before body. If recompression fails, returns original body to avoid corrupting response.
func (*NativeProxyBackend) ApplyResponseRules ¶
func (b *NativeProxyBackend) ApplyResponseRules(resp *proxy.RawHTTP1Response) *proxy.RawHTTP1Response
ApplyResponseRules applies response header and body rules. Handles decompression/recompression for body rules.
func (*NativeProxyBackend) ApplyWSRules ¶
func (b *NativeProxyBackend) ApplyWSRules(payload []byte, direction string) []byte
ApplyWSRules applies WebSocket rules to frame payload.
func (*NativeProxyBackend) CACert ¶
func (b *NativeProxyBackend) CACert() *x509.Certificate
CACert returns the CA certificate used for MITM TLS interception.
func (*NativeProxyBackend) Close ¶
func (b *NativeProxyBackend) Close() error
func (*NativeProxyBackend) DeleteRule ¶
func (b *NativeProxyBackend) DeleteRule(ctx context.Context, idOrLabel string) error
func (*NativeProxyBackend) GetProxyHistory ¶
func (b *NativeProxyBackend) GetProxyHistory(ctx context.Context, count int, offset uint32) ([]ProxyEntry, error)
func (*NativeProxyBackend) GetProxyHistoryMeta ¶
func (b *NativeProxyBackend) GetProxyHistoryMeta(ctx context.Context, count int, offset uint32) ([]ProxyEntryMeta, error)
func (*NativeProxyBackend) HasBodyRules ¶
func (b *NativeProxyBackend) HasBodyRules(isRequest bool) bool
HasBodyRules returns true if there are body rules for request or response. Used by HTTP/2 handler to decide whether to buffer full bodies.
func (*NativeProxyBackend) SendRequest ¶
func (b *NativeProxyBackend) SendRequest(ctx context.Context, name string, req SendRequestInput) (*SendRequestResult, error)
func (*NativeProxyBackend) Serve ¶
func (b *NativeProxyBackend) Serve() error
Serve starts the proxy server. Call in a goroutine.
type OastBackend ¶
type OastBackend interface {
// CreateSession registers with the OAST provider and starts background polling.
// Returns session with short ID and domain.
// If label is non-empty, it must be unique across all sessions.
CreateSession(ctx context.Context, label string) (*OastSessionInfo, error)
// PollSession returns events for a session.
// idOrDomain accepts either the short ID or the full domain.
// since filters events: empty returns all, "last" returns since last poll, or an event ID.
// eventType filters by protocol: empty returns all, otherwise one of dns, http, smtp, ftp, ldap, smb, responder.
// wait specifies how long to block waiting for events (0 = return immediately).
// limit caps the number of events returned (0 = no limit). When used with "since last",
// the last position is updated to the last returned event (for pagination).
PollSession(ctx context.Context, idOrDomain string, since string, eventType string, wait time.Duration, limit int) (*OastPollResultInfo, error)
// GetEvent retrieves a single event by ID from a session.
// Returns the full event details without truncation.
GetEvent(ctx context.Context, idOrDomain string, eventID string) (*OastEventInfo, error)
// ListSessions returns all active sessions.
ListSessions(ctx context.Context) ([]OastSessionInfo, error)
// DeleteSession stops polling and deregisters from the OAST provider.
// idOrDomain accepts either the short ID or the full domain.
DeleteSession(ctx context.Context, idOrDomain string) error
// Close cleans up all sessions (called on service shutdown).
// Should attempt deregistration with a short timeout.
Close() error
}
OastBackend defines the interface for OAST (Out-of-band Application Security Testing).
type OastDeleteResponse ¶
type OastDeleteResponse struct{}
OastDeleteResponse is the response for oast_delete.
type OastEventInfo ¶
type OastEventInfo struct {
ID string // Short sectool ID
Time time.Time // When the interaction occurred
Type string // "dns", "http", "smtp"
SourceIP string // Remote address of the interaction
Subdomain string // Full subdomain that was accessed
Details map[string]interface{} // Protocol-specific details
}
OastEventInfo represents a captured out-of-band interaction (internal domain type).
type OastPollResultInfo ¶
type OastPollResultInfo struct {
Events []OastEventInfo // Events matching the filter
DroppedCount int // Number of events dropped due to buffer limit
}
OastPollResultInfo contains the result of polling for events.
type OastSessionInfo ¶
type OastSessionInfo struct {
ID string // Short sectool ID (e.g., "a1b2c3")
Domain string // Full Interactsh domain (e.g., "xyz123.oast.fun")
Label string // Optional user-provided label for easier reference
CreatedAt time.Time // When the session was created
}
OastSessionInfo represents an active OAST session (internal domain type).
type PathQueryOpts ¶
type PathQueryOpts struct {
Method string // replace HTTP method
Path string // replace entire path (without query)
Query string // replace entire query string
SetQuery []string // add or replace query params ("key=value")
RemoveQuery []string // remove query params by key
}
PathQueryOpts contains options for modifying the request line.
func (*PathQueryOpts) HasModifications ¶
func (o *PathQueryOpts) HasModifications() bool
HasModifications returns true if any request line modification is specified.
type ProxyEntry ¶
type ProxyEntry struct {
Request string `json:"request"` // Raw HTTP request
Response string `json:"response"` // Raw HTTP response
Notes string `json:"notes"` // User annotations
Protocol string `json:"protocol"` // "http/1.1" or "h2" (empty defaults to http/1.1)
}
ProxyEntry represents a single proxy history entry in HttpBackend-agnostic form.
type ProxyEntryMeta ¶
type ProxyEntryMeta struct {
Method string
Host string
Path string // includes query string
Status int
RespLen int
Protocol string
ContentType string
}
ProxyEntryMeta holds lightweight metadata for a proxy history entry. Used by summary/list paths to avoid deserializing full request/response bodies.
type ProxyListRequest ¶
type ProxyListRequest struct {
Host string `json:"host,omitempty"`
Path string `json:"path,omitempty"`
Method string `json:"method,omitempty"`
Status string `json:"status,omitempty"`
SearchHeader string `json:"search_header,omitempty"`
SearchBody string `json:"search_body,omitempty"`
Since string `json:"since,omitempty"`
ExcludeHost string `json:"exclude_host,omitempty"`
ExcludePath string `json:"exclude_path,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
Source string `json:"source,omitempty"`
}
ProxyListRequest contains filters for proxy list queries.
func (*ProxyListRequest) HasFilters ¶
func (r *ProxyListRequest) HasFilters() bool
HasFilters returns true if any filter is set.
type ProxyRuleInput ¶
type ProxyRuleInput struct {
Label string // Optional label for easier reference
Type string // Required on add
IsRegex *bool
Match string
Replace string
}
ProxyRuleInput contains parameters for creating a rule.
type ReplaySendRequest ¶
type ReplaySendRequest struct {
FlowID string `json:"flow_id,omitempty"`
Target string `json:"target,omitempty"`
AddHeaders []string `json:"add_headers,omitempty"`
RemoveHeaders []string `json:"remove_headers,omitempty"`
Path string `json:"path,omitempty"`
Query string `json:"query,omitempty"`
SetQuery []string `json:"set_query,omitempty"`
RemoveQuery []string `json:"remove_query,omitempty"`
SetJSON []string `json:"set_json,omitempty"`
RemoveJSON []string `json:"remove_json,omitempty"`
FollowRedirects bool `json:"follow_redirects,omitempty"`
Force bool `json:"force,omitempty"`
}
ReplaySendRequest contains options for replay_send.
type RequestSender ¶
type RequestSender func(ctx context.Context, req SendRequestInput, start time.Time) (*SendRequestResult, error)
RequestSender sends a single request and returns the result.
type RuleDeleteResponse ¶
type RuleDeleteResponse struct{}
RuleDeleteResponse is the response for proxy_rule_delete.
type SendRequestInput ¶
type SendRequestInput struct {
RawRequest []byte
Target Target
FollowRedirects bool
Force bool // Skip validation for protocol-level tests
// Protocol from the original history entry ("http/1.1" or "h2")
// Empty defaults to HTTP/1.1
Protocol string
}
SendRequestInput contains all parameters for sending a request.
type SendRequestResult ¶
SendRequestResult contains the response from a sent request.
func FollowRedirects ¶
func FollowRedirects(ctx context.Context, req SendRequestInput, start time.Time, maxRedirects int, sender RequestSender) (*SendRequestResult, error)
FollowRedirects sends a request and follows redirects up to maxRedirects times. Uses sender to perform individual requests, allowing different backend implementations. Used by BurpBackend which doesn't use the wire-fidelity sender.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the sectool MCP server.
func NewServer ¶
func NewServer(flags MCPServerFlags, hb HttpBackend, ob OastBackend, cb CrawlerBackend) (*Server, error)
NewServer creates a new MCP server instance with optional backends. If a backend is nil, Run initializes the default implementation.
func (*Server) RegisterHealthMetric ¶
func (s *Server) RegisterHealthMetric(key string, provider HealthMetricProvider)
RegisterHealthMetric registers a health metric provider for the given key.
func (*Server) RequestShutdown ¶
func (s *Server) RequestShutdown()
RequestShutdown initiates server shutdown.
func (*Server) SetQuietLogging ¶ added in v0.1.4
func (s *Server) SetQuietLogging()
SetQuietLogging suppresses verbose startup output and removes timestamps from log output. Intended for use in tests.
func (*Server) WaitTillStarted ¶
func (s *Server) WaitTillStarted()
WaitTillStarted blocks until the server has started.
type StatusCodeFilter ¶
type StatusCodeFilter struct {
// contains filtered or unexported fields
}
StatusCodeFilter matches status codes by exact value or range (e.g., 2XX).
func (*StatusCodeFilter) Empty ¶
func (f *StatusCodeFilter) Empty() bool
Empty returns true if the filter has no conditions.
func (*StatusCodeFilter) Matches ¶
func (f *StatusCodeFilter) Matches(code int) bool
Matches returns true if the code matches the filter.