runner

package
v2.3.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package runner implements the mechanism to drive the subdomain enumeration process

Index

Constants

View Source
const Version = `2.3.1`

Version is the current version of subfinder

Variables

This section is empty.

Functions

func CheckConfigExists

func CheckConfigExists(configPath string) bool

CheckConfigExists checks if the config file exists in the given path

func GetConfigDirectory

func GetConfigDirectory() (string, error)

GetConfigDirectory gets the subfinder config directory for a user

func WriteHostIPOutput

func WriteHostIPOutput(results map[string]string, writer io.Writer) error

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

func WriteHostOutput

func WriteHostOutput(results map[string]struct{}, writer io.Writer) error

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

func WriteHostOutputNoWildcard

func WriteHostOutputNoWildcard(results map[string]string, writer io.Writer) error

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

func WriteJSONOutput

func WriteJSONOutput(results map[string]string, writer io.Writer) error

WriteJSONOutput writes the output list of subdomain in JSON to an io.Writer

Types

type ConfigFile

type ConfigFile struct {
	// Resolvers contains the list of resolvers to use while resolving
	Resolvers []string `yaml:"resolvers,omitempty"`
	// Sources contains a list of sources to use for enumeration
	Sources []string `yaml:"sources,omitempty"`
	// ExcludeSources contains the sources to not include in the enumeration process
	ExcludeSources []string `yaml:"exclude-sources,omitempty"`
	// API keys for different sources
	Binaryedge     []string `yaml:"binaryedge"`
	Censys         []string `yaml:"censys"`
	Certspotter    []string `yaml:"certspotter"`
	PassiveTotal   []string `yaml:"passivetotal"`
	SecurityTrails []string `yaml:"securitytrails"`
	Shodan         []string `yaml:"shodan"`
	URLScan        []string `yaml:"urlscan"`
	Virustotal     []string `yaml:"virustotal"`
}

ConfigFile contains the fields stored in the configuration file

func UnmarshalRead

func UnmarshalRead(file string) (ConfigFile, error)

UnmarshalRead reads the unmarshalled config yaml file from disk

func (ConfigFile) GetKeys

func (c ConfigFile) GetKeys() subscraping.Keys

GetKeys gets the API keys from config file and creates a Keys struct We use random selection of api keys from the list of keys supplied. Keys that require 2 options are separated by colon (:).

func (ConfigFile) MarshalWrite

func (c ConfigFile) MarshalWrite(file string) error

MarshalWrite writes the marshalled yaml config to disk

type JSONResult

type JSONResult struct {
	Host string `json:"host"`
	IP   string `json:"ip"`
}

JSONResult contains the result for a host in JSON format

type Options

type Options struct {
	Verbose            bool   // Verbose flag indicates whether to show verbose output or not
	NoColor            bool   // No-Color disables the colored output
	Threads            int    // Thread 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 mins to wait for enumeration
	Domain             string // Domain is the domain to find subdomains for
	DomainsFile        string // DomainsFile is the file containing list of domains to find subdomains for
	Output             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
	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
	Sources            string // Sources contains a comma-separated list of sources to use for enumeration
	ExcludeSources     string // ExcludeSources contains the comma-separated sources to not include in the enumeration process
	Resolvers          string // 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
	RemoveWildcard     bool   // RemoveWildcard specifies whether to remove potential wildcard or dead subdomains from the results.
	ConfigFile         string // ConfigFile contains the location of the config file
	Stdin              bool   // Stdin specifies whether stdin input was given to the process
	Version            bool   // Version specifies if we should just show version and exit

	YAMLConfig ConfigFile // YAMLConfig contains the unmarshalled yaml config file
}

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

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) error

EnumerateMultipleDomains 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, output string, append bool) error

EnumerateSingleDomain performs subdomain enumeration against a single domain

func (*Runner) RunEnumeration

func (r *Runner) RunEnumeration() error

RunEnumeration 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