service

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
const (
	WorkflowModeNone       = protocol.WorkflowModeNone
	WorkflowModeExplore    = protocol.WorkflowModeExplore
	WorkflowModeTestReport = protocol.WorkflowModeTestReport
	WorkflowModeCLI        = protocol.WorkflowModeCLI // undocumented, for CLI client use only
)

Workflow mode constants

View Source
const (
	SourceProxy  = "proxy"
	SourceReplay = "replay"
	SourceCrawl  = "crawl"
)

Flow source constants for display and sorting.

View Source
const (
	OutputModeFlows   = "flows"
	OutputModeSummary = "summary"
	OutputModeForms   = "forms"
	OutputModeErrors  = "errors"
)

Output mode constants for poll tools.

View Source
const DefaultMCPPort = 9119
View Source
const MaxOastEventsPerSession = 2000

MaxOastEventsPerSession is the maximum number of events stored per session. Oldest events are dropped when this limit is exceeded.

Variables

View Source
var ErrConfigEditDisabled = errors.New("config editing disabled")

ErrConfigEditDisabled is returned when a write operation fails because config editing is not enabled.

View Source
var ErrLabelExists = errors.New("label already exists")

ErrLabelExists is returned when label conflicts with an existing entry (rule or OAST).

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a requested resource (rule, session, etc.) doesn't exist.

Functions

func BuildCaptureFilter added in v0.1.6

func BuildCaptureFilter(cfg config.ProxyConfig) (proxy.CaptureFilter, error)

BuildCaptureFilter compiles proxy exclusion patterns from config into a CaptureFilter.

func IsTimeoutError

func IsTimeoutError(err error) bool

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

func ConnectBurpBackend(ctx context.Context, url string, opts ...mcp.Option) (*BurpBackend, error)

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) Connect

func (b *BurpBackend) Connect(ctx context.Context) 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) ListRules

func (b *BurpBackend) ListRules(ctx context.Context, websocket bool) ([]protocol.RuleEntry, 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) AddSeeds

func (b *CollyBackend) AddSeeds(ctx context.Context, sessionID string, seeds []CrawlSeed) error

func (*CollyBackend) Close

func (b *CollyBackend) Close() error

func (*CollyBackend) CreateSession

func (b *CollyBackend) CreateSession(ctx context.Context, opts CrawlOptions) (*CrawlSessionInfo, error)

func (*CollyBackend) GetFlow

func (b *CollyBackend) GetFlow(ctx context.Context, flowID string) (*CrawlFlow, 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

func (b *InteractshBackend) PollSession(ctx context.Context, idOrDomain string, since string, eventType string, wait time.Duration, limit int) (*OastPollResultInfo, error)

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"
	Notes        bool   // enable notes/findings tools (experimental)
}

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 (*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) ListRules

func (b *NativeProxyBackend) ListRules(ctx context.Context, websocket bool) ([]protocol.RuleEntry, error)

func (*NativeProxyBackend) SendRequest

func (*NativeProxyBackend) Serve

func (b *NativeProxyBackend) Serve() error

Serve starts the proxy server. Call in a goroutine.

func (*NativeProxyBackend) SetCaptureFilter added in v0.1.6

func (b *NativeProxyBackend) SetCaptureFilter(f proxy.CaptureFilter)

SetCaptureFilter configures the proxy to skip storing entries that the filter rejects. Filtered requests are still proxied normally.

func (*NativeProxyBackend) WaitReady

func (b *NativeProxyBackend) WaitReady(ctx context.Context) error

WaitReady blocks until Serve() has entered its accept loop.

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 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

type SendRequestResult struct {
	Headers  []byte
	Body     []byte
	Duration time.Duration
}

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) Run

func (s *Server) Run(ctx context.Context) error

Run starts the MCP server and blocks until 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.

type Target

type Target = proxy.Target

Target specifies the destination for a request. Type alias for proxy.Target to enable unified target handling across packages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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