runner

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 38 Imported by: 38

Documentation

Overview

Package runner implements the mechanism to drive the subdomain enumeration process

Index

Constants

View Source
const ToolName = `subfinder`

Name

Variables

This section is empty.

Functions

func GetUpdateCallback

func GetUpdateCallback() func()

GetUpdateCallback returns a callback function that updates subfinder

func UnmarshalFrom

func UnmarshalFrom(file string) error

UnmarshalFrom writes the marshaled yaml config to disk

Types

type OnResultCallback

type OnResultCallback func(result *resolve.HostEntry)

OnResultCallback (hostResult)

type Options

type Options struct {
	Verbose            bool                // Verbose flag indicates whether to show verbose output or not
	NoColor            bool                // NoColor disables the colored output
	JSON               bool                // JSON specifies whether to use json for output format or text file
	HostIP             bool                // HostIP specifies whether to write subdomains in host:ip format
	Silent             bool                // Silent suppresses any extra text and only writes subdomains to screen
	ListSources        bool                // ListSources specifies whether to list all available sources
	RemoveWildcard     bool                // RemoveWildcard specifies whether to remove potential wildcard or dead subdomains from the results.
	CaptureSources     bool                // CaptureSources specifies whether to save all sources that returned a specific domains or just the first source
	Stdin              bool                // Stdin specifies whether stdin input was given to the process
	Version            bool                // Version specifies if we should just show version and exit
	OnlyRecursive      bool                // Recursive specifies whether to use only recursive subdomain enumeration sources
	All                bool                // All specifies whether to use all (slow) sources.
	Statistics         bool                // Statistics specifies whether to report source statistics
	Threads            int                 // Threads controls the number of threads to use for active enumerations
	Timeout            int                 // Timeout is the seconds to wait for sources to respond
	MaxEnumerationTime int                 // MaxEnumerationTime is the maximum amount of time in minutes to wait for enumeration
	Domain             goflags.StringSlice // Domain is the domain to find subdomains for
	DomainsFile        string              // DomainsFile is the file containing list of domains to find subdomains for
	Output             io.Writer
	OutputFile         string               // Output is the file to write found subdomains to.
	OutputDirectory    string               // OutputDirectory is the directory to write results to in case list of domains is given
	Sources            goflags.StringSlice  `yaml:"sources,omitempty"`         // Sources contains a comma-separated list of sources to use for enumeration
	ExcludeSources     goflags.StringSlice  `yaml:"exclude-sources,omitempty"` // ExcludeSources contains the comma-separated sources to not include in the enumeration process
	Resolvers          goflags.StringSlice  `yaml:"resolvers,omitempty"`       // Resolvers is the comma-separated resolvers to use for enumeration
	ResolverList       string               // ResolverList is a text file containing list of resolvers to use for enumeration
	Config             string               // Config contains the location of the config file
	ProviderConfig     string               // ProviderConfig contains the location of the provider config file
	Proxy              string               // HTTP proxy
	RateLimit          int                  // Global maximum number of HTTP requests to send per second
	RateLimits         goflags.RateLimitMap // Maximum number of HTTP requests to send per second
	ExcludeIps         bool
	Match              goflags.StringSlice
	Filter             goflags.StringSlice

	ResultCallback     OnResultCallback // OnResult callback
	DisableUpdateCheck bool             // DisableUpdateCheck disable update checking
	// contains filtered or unexported fields
}

Options contains the configuration options for tuning the subdomain enumeration process.

func ParseOptions

func ParseOptions() *Options

ParseOptions parses the command line flags provided by a user

func (*Options) ConfigureOutput

func (options *Options) ConfigureOutput()

ConfigureOutput configures the output on the screen

type OutputWriter

type OutputWriter struct {
	JSON bool
}

OutputWriter outputs content to writers.

func NewOutputWriter

func NewOutputWriter(json bool) *OutputWriter

NewOutputWriter creates a new OutputWriter

func (*OutputWriter) WriteHost

func (o *OutputWriter) WriteHost(input string, results map[string]resolve.HostEntry, writer io.Writer) error

WriteHost writes the output list of subdomain to an io.Writer

func (*OutputWriter) WriteHostIP

func (o *OutputWriter) WriteHostIP(input string, results map[string]resolve.Result, writer io.Writer) error

WriteHostIP writes the output list of subdomain to an io.Writer

func (*OutputWriter) WriteHostNoWildcard

func (o *OutputWriter) WriteHostNoWildcard(input string, results map[string]resolve.Result, writer io.Writer) error

WriteHostNoWildcard writes the output list of subdomain with nW flag to an io.Writer

func (*OutputWriter) WriteSourceHost

func (o *OutputWriter) WriteSourceHost(input string, sourceMap map[string]map[string]struct{}, writer io.Writer) error

WriteSourceHost writes the output list of subdomain to an io.Writer

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner is an instance of the subdomain enumeration client used to orchestrate the whole process.

func NewRunner

func NewRunner(options *Options) (*Runner, error)

NewRunner creates a new runner struct instance by parsing the configuration options, configuring sources, reading lists and setting up loggers, etc.

func (*Runner) EnumerateMultipleDomains

func (r *Runner) EnumerateMultipleDomains(reader io.Reader, writers []io.Writer) error

EnumerateMultipleDomains wraps EnumerateMultipleDomainsWithCtx with an empty context

func (*Runner) EnumerateMultipleDomainsWithCtx

func (r *Runner) EnumerateMultipleDomainsWithCtx(ctx context.Context, reader io.Reader, writers []io.Writer) error

EnumerateMultipleDomainsWithCtx enumerates subdomains for multiple domains We keep enumerating subdomains for a given domain until we reach an error

func (*Runner) EnumerateSingleDomain

func (r *Runner) EnumerateSingleDomain(domain string, writers []io.Writer) (map[string]map[string]struct{}, error)

EnumerateSingleDomain wraps EnumerateSingleDomainWithCtx with an empty context

func (*Runner) EnumerateSingleDomainWithCtx

func (r *Runner) EnumerateSingleDomainWithCtx(ctx context.Context, domain string, writers []io.Writer) (map[string]map[string]struct{}, error)

EnumerateSingleDomainWithCtx performs subdomain enumeration against a single domain

func (*Runner) GetStatistics

func (r *Runner) GetStatistics() map[string]subscraping.Statistics

func (*Runner) RunEnumeration

func (r *Runner) RunEnumeration() error

RunEnumeration wraps RunEnumerationWithCtx with an empty context

func (*Runner) RunEnumerationWithCtx

func (r *Runner) RunEnumerationWithCtx(ctx context.Context) error

RunEnumerationWithCtx runs the subdomain enumeration flow on the targets specified

Jump to

Keyboard shortcuts

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