sub

package
v0.23.6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sub utilizes the subfinder utility as a package to perform subdomain enumeration on the provided domains and returns the result in the form of a report that can be used for further analysis

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilRunner  = errors.New("runner is nil")
	ErrNilOptions = errors.New("options are nil")
)
View Source
var (
	ErrOptionsNil = errors.New("options cannot be nil")
)

Functions

func ConvertBufferToSlice

func ConvertBufferToSlice(buffer *bytes.Buffer) []string

ConvertBufferToSlice converts a bytes.Buffer to a slice of strings

func MapToTypesOptions

func MapToTypesOptions(options *Options) *runner.Options

MapToTypesOptions maps Options to types.Options

Types

type ConfigOpts

type ConfigOpts func(*Options)

func WithAll

func WithAll(all bool) ConfigOpts

WithAll sets the all flag for the subfinder tool

func WithCaptureSources

func WithCaptureSources(captureSources bool) ConfigOpts

WithCaptureSources sets the capture sources flag for the subfinder tool

func WithConfigFile

func WithConfigFile(configFile string) ConfigOpts

WithConfigFile sets the configuration file for the subfinder tool

func WithConfigFilePath

func WithConfigFilePath(configFilePath string) ConfigOpts

WithConfigFilePath sets the configuration file path for the subfinder tool

func WithDisableUpdateCheck

func WithDisableUpdateCheck(disableUpdateCheck bool) ConfigOpts

WithDisableUpdateCheck sets the disable update check for the subfinder tool

func WithDomain

func WithDomain(domain string) ConfigOpts

WithDomain sets the domain for the subfinder tool

func WithDomainsFile

func WithDomainsFile(domainsFile string) ConfigOpts

WithDomainsFile sets the domains file for the subfinder tool

func WithExcludeIps

func WithExcludeIps(excludeIps bool) ConfigOpts

WithExcludeIps sets the exclude IPs for the subfinder tool

func WithExcludeSources

func WithExcludeSources(excludeSources goflags.StringSlice) ConfigOpts

WithExcludeSources sets the exclude sources for the subfinder tool

func WithFilter

func WithFilter(filter goflags.StringSlice) ConfigOpts

WithFilter sets the filter regexes for the subfinder tool

func WithFilterRegexes

func WithFilterRegexes(regexes []*regexp.Regexp) ConfigOpts

WithFilterRegexes sets the filter regexes for the subfinder tool

func WithHostIP

func WithHostIP(hostIP bool) ConfigOpts

WithHostIP sets the host IP for the subfinder tool

func WithJSON

func WithJSON(json bool) ConfigOpts

WithJSON sets the JSON flag for the subfinder tool

func WithListSources

func WithListSources(listSources bool) ConfigOpts

WithListSources sets the list sources flag for the subfinder tool

func WithMatch

func WithMatch(match goflags.StringSlice) ConfigOpts

WithMatch sets the match regexes for the subfinder tool

func WithMatchRegexes

func WithMatchRegexes(regexes []*regexp.Regexp) ConfigOpts

WithMatchRegexes sets the match regexes for the subfinder tool

func WithMaxEnumerationTime

func WithMaxEnumerationTime(maxEnumerationTime int) ConfigOpts

WithMaxEnumerationTime sets the maximum enumeration time for the subfinder tool

func WithNoColor

func WithNoColor(noColor bool) ConfigOpts

WithNoColor sets the no color flag for the subfinder tool

func WithOnlyRecursive

func WithOnlyRecursive(onlyRecursive bool) ConfigOpts

WithOnlyRecursive sets the only recursive flag for the subfinder tool

func WithOutput

func WithOutput(output io.Writer) ConfigOpts

WithOutput sets the output writer for the subfinder tool

func WithOutputDirectory

func WithOutputDirectory(outputDirectory string) ConfigOpts

WithOutputDirectory sets the output directory for the subfinder tool

func WithOutputFile

func WithOutputFile(outputFile string) ConfigOpts

WithOutputFile sets the output file for the subfinder tool

func WithProviderConfigFile

func WithProviderConfigFile(providerConfigFile string) ConfigOpts

WithProviderConfigFile sets the provider configuration file for the subfinder tool

func WithProxy

func WithProxy(proxy string) ConfigOpts

WithProxy sets the proxy for the subfinder tool

func WithRateLimit

func WithRateLimit(rateLimit int) ConfigOpts

WithRateLimit sets the rate limit for the subfinder tool

func WithRateLimits

func WithRateLimits(rateLimits goflags.RateLimitMap) ConfigOpts

WithRateLimits sets the rate limits for the subfinder tool

func WithRemoveWildcard

func WithRemoveWildcard(removeWildcard bool) ConfigOpts

WithRemoveWildcard sets the remove wildcard flag for the subfinder tool

func WithResolverList

func WithResolverList(resolverList string) ConfigOpts

WithResolverList sets the resolver list for the subfinder tool

func WithResolvers

func WithResolvers(resolvers goflags.StringSlice) ConfigOpts

WithResolvers sets the resolvers for the subfinder tool

func WithResultCallback

func WithResultCallback(callback runner.OnResultCallback) ConfigOpts

WithResultCallback sets the result callback for the subfinder tool

func WithSilent

func WithSilent(silent bool) ConfigOpts

WithSilent sets the silent mode for the subfinder tool

func WithSources

func WithSources(sources goflags.StringSlice) ConfigOpts

WithSources sets the sources for the subfinder tool

func WithStatistics

func WithStatistics(statistics bool) ConfigOpts

WithStatistics sets the statistics flag for the subfinder tool

func WithStdin

func WithStdin(stdin bool) ConfigOpts

WithStdin sets the stdin flag for the subfinder tool

func WithThreads

func WithThreads(threads int) ConfigOpts

WithThreads sets the number of threads for the subfinder tool

func WithTimeout

func WithTimeout(timeout int) ConfigOpts

WithTimeout sets the timeout for the subfinder tool

func WithVerbose

func WithVerbose(verbose bool) ConfigOpts

WithVerbose sets the verbose flag for the subfinder tool

func WithVersion

func WithVersion(version bool) ConfigOpts

WithVersion sets the version flag for the subfinder tool

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     runner.OnResultCallback // OnResult callback
	DisableUpdateCheck bool                    // DisableUpdateCheck disable update checking
	// contains filtered or unexported fields
}

Options is a struct that contains the options for the subfinder tool

func NewOptions

func NewOptions(opt ...ConfigOpts) *Options

NewOptions creates a new Options struct with default values and allows overrides

type Subfinder

type Subfinder struct {
	Runner *runner.Runner
	// Resolver is the resolver for the subfinder tool
	Resolver *resolve.Resolver
	// Config is the configuration for the subfinder tool
	Options *Options
}

Subfinder is a struct that contains the configuration for the subfinder tool

func NewSubfinder

func NewSubfinder(opt *Options) (*Subfinder, error)

NewSubfinder creates a new Subfinder instance with the given options

func (*Subfinder) Enumerate

func (s *Subfinder) Enumerate() ([]string, error)

Enumerate is a method that runs the subfinder tool to enumerate subdomains for a given domain

type SubfinderOpts

type SubfinderOpts func(*Subfinder)

func WithConfig

func WithConfig(config *Options) SubfinderOpts

WithConfig sets the configuration for the subfinder tool

func WithResolver

func WithResolver(r *resolve.Resolver) SubfinderOpts

WithResolver sets the resolver for the subfinder tool

func WithRunner

func WithRunner(r *runner.Runner) SubfinderOpts

WithRunner sets the runner for the subfinder tool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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