scan

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 29 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func ExtractHosts(body []byte, root string, exclude []string) ([]string, map[string]string)

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

func ExtractSameHostAssets(body []byte, pageURL string, limit int) []string

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

func FetchAssetHosts(ctx context.Context, urls []string, o ProbeOpts) map[string]map[string]string

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

func InScope(h, root string, exclude []string) bool

InScope checks whether a host belongs to the target domain, is not excluded, and is not malformed.

func IsMalformedHost added in v1.4.0

func IsMalformedHost(h, root string) bool

IsMalformedHost reports whether h has invalid DNS syntax or concatenation artifacts under root.

func LabelDepth

func LabelDepth(h, root string) int

LabelDepth returns how many labels a host has beyond root: a.com=0, x.a.com=1, y.x.a.com=2.

func Normalize

func Normalize(h string) string

Normalize sanitizes and standardizes a domain name.

func Probe

func Probe(ctx context.Context, hosts []string, o ProbeOpts, onResult func(host string, p types.Probe)) error

Probe runs httpx over hosts; onResult is called for each host that answered HTTP(S).

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 EnumFunc

type EnumFunc func(ctx context.Context, domain string) (map[string][]string, error)

EnumFunc returns subdomains of domain mapped to the sources that reported them.

func NewSubfinder

func NewSubfinder(timeout, maxMinutes int, providerConfig string) (EnumFunc, error)

NewSubfinder initializes subfinder enumeration runner.

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.

type ResolveOpts added in v1.3.0

type ResolveOpts struct {
	Threads        int
	Rate           int
	Timeout        int
	Retries        int
	Resolvers      string // comma-separated resolver addresses or path to a resolvers file
	WildcardFilter bool
}

ResolveOpts configures concurrent DNS resolution and wildcard filtering via dnsx.

Jump to

Keyboard shortcuts

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