Documentation
¶
Overview ¶
Package discovery provides API discovery mechanisms.
Package discovery provides API discovery mechanisms.
Index ¶
- Variables
- type ActiveDiscovery
- func (a *ActiveDiscovery) Clear()
- func (a *ActiveDiscovery) Count() int
- func (a *ActiveDiscovery) Disable()
- func (a *ActiveDiscovery) Enable()
- func (a *ActiveDiscovery) GetEndpoints() []Endpoint
- func (a *ActiveDiscovery) Probe(ctx context.Context, baseURL string) []Endpoint
- func (a *ActiveDiscovery) ProbeGraphQL(ctx context.Context, baseURL string) *Endpoint
- func (a *ActiveDiscovery) ProbeMethods(ctx context.Context, urlStr string) []Endpoint
- func (a *ActiveDiscovery) ProbeSwagger(ctx context.Context, baseURL string) (string, error)
- type DiscoveredEndpoint
- type Endpoint
- type Parameter
- type PassiveDiscovery
- func (p *PassiveDiscovery) Clear()
- func (p *PassiveDiscovery) Count() int
- func (p *PassiveDiscovery) Disable()
- func (p *PassiveDiscovery) Enable()
- func (p *PassiveDiscovery) GetEndpoints() []Endpoint
- func (p *PassiveDiscovery) ProcessRequests(requests []browser.NetworkRequest, sourceURL string) []Endpoint
- type ProbeResult
Constants ¶
This section is empty.
Variables ¶
var CommonAPIPaths = []string{
"/api",
"/api/v1",
"/api/v2",
"/api/v3",
"/v1",
"/v2",
"/v3",
"/rest",
"/rest/api",
"/graphql",
"/graphiql",
"/swagger",
"/swagger-ui",
"/swagger.json",
"/swagger/v1/swagger.json",
"/openapi",
"/openapi.json",
"/api-docs",
"/api/docs",
"/docs",
"/doc",
"/documentation",
"/health",
"/healthz",
"/healthcheck",
"/status",
"/ping",
"/info",
"/version",
"/metrics",
"/.well-known/openid-configuration",
"/oauth/token",
"/auth/token",
"/token",
"/login",
"/signin",
"/signup",
"/register",
"/logout",
"/users",
"/user",
"/me",
"/profile",
"/account",
"/admin",
"/dashboard",
"/config",
"/settings",
"/search",
"/query",
"/debug",
"/trace",
"/actuator",
"/actuator/health",
"/actuator/info",
"/actuator/env",
"/env",
"/console",
"/admin/console",
"/ws",
"/websocket",
"/socket.io",
}
CommonAPIPaths contains common API paths to probe.
Functions ¶
This section is empty.
Types ¶
type ActiveDiscovery ¶
type ActiveDiscovery struct {
// contains filtered or unexported fields
}
ActiveDiscovery probes for API endpoints.
func NewActiveDiscovery ¶
func NewActiveDiscovery(userAgent string, headers map[string]string) *ActiveDiscovery
NewActiveDiscovery creates a new active discovery instance.
func (*ActiveDiscovery) Clear ¶
func (a *ActiveDiscovery) Clear()
Clear clears all discovered endpoints.
func (*ActiveDiscovery) Count ¶
func (a *ActiveDiscovery) Count() int
Count returns the number of discovered endpoints.
func (*ActiveDiscovery) Disable ¶
func (a *ActiveDiscovery) Disable()
Disable disables active discovery.
func (*ActiveDiscovery) Enable ¶
func (a *ActiveDiscovery) Enable()
Enable enables active discovery.
func (*ActiveDiscovery) GetEndpoints ¶
func (a *ActiveDiscovery) GetEndpoints() []Endpoint
GetEndpoints returns all discovered endpoints.
func (*ActiveDiscovery) Probe ¶
func (a *ActiveDiscovery) Probe(ctx context.Context, baseURL string) []Endpoint
Probe probes a base URL for common API endpoints.
func (*ActiveDiscovery) ProbeGraphQL ¶
func (a *ActiveDiscovery) ProbeGraphQL(ctx context.Context, baseURL string) *Endpoint
ProbeGraphQL specifically probes for GraphQL endpoints.
func (*ActiveDiscovery) ProbeMethods ¶
func (a *ActiveDiscovery) ProbeMethods(ctx context.Context, urlStr string) []Endpoint
ProbeMethods probes an endpoint with different HTTP methods.
func (*ActiveDiscovery) ProbeSwagger ¶
ProbeSwagger probes for Swagger/OpenAPI documentation.
type DiscoveredEndpoint ¶
type DiscoveredEndpoint struct {
URL string
Method string
Parameters []Parameter
Headers map[string]string
ContentType string
StatusCode int
DiscoveredAt time.Time
DiscoveredFrom string
HitCount int
}
DiscoveredEndpoint represents a passively discovered endpoint.
type Endpoint ¶
type Endpoint struct {
URL string
Method string
Source string // passive, active, active_method_probe, active_graphql
Parameters []Parameter
Headers map[string]string
DiscoveredFrom string
StatusCode int
ContentType string
Timestamp time.Time
}
Endpoint represents a discovered API endpoint.
type Parameter ¶
type Parameter struct {
Name string
Type string // query, body, header, path, cookie
Example string
}
Parameter represents a request parameter.
type PassiveDiscovery ¶
type PassiveDiscovery struct {
// contains filtered or unexported fields
}
PassiveDiscovery captures API endpoints from network traffic.
func NewPassiveDiscovery ¶
func NewPassiveDiscovery() *PassiveDiscovery
NewPassiveDiscovery creates a new passive discovery instance.
func (*PassiveDiscovery) Clear ¶
func (p *PassiveDiscovery) Clear()
Clear clears all discovered endpoints.
func (*PassiveDiscovery) Count ¶
func (p *PassiveDiscovery) Count() int
Count returns the number of discovered endpoints.
func (*PassiveDiscovery) Disable ¶
func (p *PassiveDiscovery) Disable()
Disable disables passive discovery.
func (*PassiveDiscovery) Enable ¶
func (p *PassiveDiscovery) Enable()
Enable enables passive discovery.
func (*PassiveDiscovery) GetEndpoints ¶
func (p *PassiveDiscovery) GetEndpoints() []Endpoint
GetEndpoints returns all discovered endpoints.
func (*PassiveDiscovery) ProcessRequests ¶
func (p *PassiveDiscovery) ProcessRequests(requests []browser.NetworkRequest, sourceURL string) []Endpoint
ProcessRequests processes intercepted network requests.