discover

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package discover actively probes targets for exposed Swagger/OpenAPI endpoints using the flagship wordlist, content matchers, and random-path false-positive suppression (technique from brinhosa/apidetector).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProbeURLs added in v1.0.2

func ProbeURLs(ctx context.Context, client *httpclient.Client, urls []string, concurrency int, onHit func(Hit), progress func(done, total int))

ProbeURLs direct-probes a set of candidate spec/UI URLs (e.g. harvested from the Wayback Machine or SwaggerHub OSINT), invoking onHit for each confirmed Swagger/OpenAPI resource. Unlike Run, it GETs each URL exactly as given rather than appending the wordlist — these are already specific URLs, not hosts. Progress, if set, is called once per URL completed.

func Run

func Run(ctx context.Context, client *httpclient.Client, targets []string, cfg Config, onHit func(Hit))

Run probes all targets and invokes onHit for each confirmed endpoint.

Types

type Config

type Config struct {
	Concurrency int
	Mixed       bool     // try http and https
	Paths       []string // override wordlist
	FirstOnly   bool     // stop after first hit per host
	// Progress, if set, is called once per target after it is fully probed,
	// with the number of targets completed so far and the total. Safe to call
	// from multiple goroutines (callers should keep it cheap / lock if needed).
	Progress func(done, total int)
}

Config controls a discovery run.

type Hit

type Hit struct {
	Target  string    `json:"target"`
	URL     string    `json:"url"`
	Status  int       `json:"status"`
	IsSpec  bool      `json:"is_spec"`
	Kind    spec.Kind `json:"kind,omitempty"`
	Version string    `json:"version,omitempty"`
	Title   string    `json:"title,omitempty"`
	Marker  string    `json:"marker,omitempty"`
}

Hit is a confirmed discovery.

Jump to

Keyboard shortcuts

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