Documentation
¶
Index ¶
- func ClassifyAliveHosts(ctx context.Context, hosts []types.Host, threads, timeoutSec, rateLimit int, ...)
- func Crawl(ctx context.Context, root string, o CrawlOpts, enum EnumFunc, ...) error
- func ExtractHosts(body []byte, root string, exclude []string) ([]string, map[string]string)
- func ExtractSameHostAssets(body []byte, pageURL string, limit int) []string
- func FetchAssetHosts(ctx context.Context, urls []string, o ProbeOpts) map[string]map[string]string
- func InScope(h, root string, exclude []string) bool
- func IsMalformedHost(h, root string) bool
- func LabelDepth(h, root string) int
- func Normalize(h string) string
- func Probe(ctx context.Context, hosts []string, o ProbeOpts, ...) error
- type AuthClassifier
- type CrawlOpts
- type EnumFunc
- type ProbeOpts
- type ResolveFunc
- type ResolveOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClassifyAliveHosts ¶ added in v1.1.0
func ClassifyAliveHosts(ctx context.Context, hosts []types.Host, threads, timeoutSec, rateLimit int, onResult func(host string, authType, authURL string))
ClassifyAliveHosts runs concurrent rate-limited classification on a slice of alive hosts.
func Crawl ¶
func Crawl(ctx context.Context, root string, o CrawlOpts, enum EnumFunc, onFound func(host string, sources []string)) error
Crawl queries root (or o.Seeds), then newly found subdomains level by level until nothing new appears or a cap is hit. onFound is called once per new host (never for root or initial seeds) and is serialized.
func ExtractHosts ¶ added in v1.2.0
ExtractHosts returns deduplicated, sorted in-scope hostnames referenced in body, along with a short single-line context snippet per host for provenance.
func ExtractSameHostAssets ¶ added in v1.2.0
ExtractSameHostAssets returns up to limit deduplicated HTTP(S) URLs of same-host .js and .json assets referenced in an HTML body relative to pageURL.
func FetchAssetHosts ¶ added in v1.2.0
FetchAssetHosts fetches same-host .js/.json asset URLs within the configured rate/thread budget and extracts in-scope hostnames mapped by referrerHost -> (discoveredHost -> provenance).
func InScope ¶
InScope checks whether a host belongs to the target domain, is not excluded, and is not malformed.
func IsMalformedHost ¶ added in v1.4.0
IsMalformedHost reports whether h has invalid DNS syntax or concatenation artifacts under root.
func LabelDepth ¶
LabelDepth returns how many labels a host has beyond root: a.com=0, x.a.com=1, y.x.a.com=2.
Types ¶
type AuthClassifier ¶ added in v1.1.0
type AuthClassifier struct {
// contains filtered or unexported fields
}
AuthClassifier handles asset classification into register, login_only, or landing.
func NewAuthClassifier ¶ added in v1.1.0
func NewAuthClassifier(timeout time.Duration) *AuthClassifier
NewAuthClassifier creates a configured AuthClassifier.
func NewAuthClassifierWithClient ¶ added in v1.1.0
func NewAuthClassifierWithClient(client *http.Client) *AuthClassifier
NewAuthClassifierWithClient creates an AuthClassifier with a custom http.Client (e.g. for testing).
func (*AuthClassifier) Classify ¶ added in v1.1.0
func (c *AuthClassifier) Classify(ctx context.Context, rawURL string) (authType string, authURL string)
Classify determines whether a target asset allows registration, is login-only, or is a landing page.
func (*AuthClassifier) ClassifyWithRoot ¶ added in v1.3.0
func (c *AuthClassifier) ClassifyWithRoot(ctx context.Context, rawURL, root string) (authType string, authURL string)
ClassifyWithRoot classifies rawURL while restricting followed auth links and redirects to baseHost or root.
type CrawlOpts ¶
type CrawlOpts struct {
Depth int // recursion rounds after the root query (-1 = auto/unlimited until no new hosts, 0 = root only)
MaxHosts int // stop once this many hosts are known
Conc int // domains enumerated in parallel
Exclude []string // hosts or suffixes to drop
Seeds []string // optional starting seeds instead of root for feedback rounds
Seen map[string]bool // optional shared seen-hosts set across rounds
Queried map[string]bool // optional shared queried-domains set across rounds
Malformed map[string]bool // optional shared malformed-hosts set across rounds
OnMalformed func(host string, sources []string) // optional callback invoked once per malformed in-scope host
OnRound func(round int) // optional callback invoked after each completed round
}
CrawlOpts defines options for recursive enumeration crawling.
type ProbeOpts ¶
type ProbeOpts struct {
Threads int
Timeout int
Rate int
Follow bool
ExtractRoot string // when non-empty, extract in-scope hosts from 2xx/3xx responses
Exclude []string // excluded hosts or suffixes for ExtractHosts
ContentAssets int // max same-host .js/.json asset URLs collected per host (0 = off)
TargetAddr string // optional loopback host:port override for offline fixture tests
OnProgress func(completed, total int)
}
ProbeOpts defines options for HTTP probing with httpx.
type ResolveFunc ¶ added in v1.3.0
type ResolveFunc func( ctx context.Context, root string, hosts []string, onProgress func(completed, total int), onResult func(host string, res types.DNSResult), ) error
ResolveFunc resolves a batch of hosts scoped to root, streaming progress and per-host DNS results.
func NewResolver ¶ added in v1.3.0
func NewResolver(o ResolveOpts) (ResolveFunc, error)
NewResolver initializes a reusable dnsx resolver with shared per-root wildcard caches.