helper

package
v0.0.0-...-0e0a122 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Bold      = "\033[1m"
	Underline = "\033[4m"
	Red       = "\033[31;1;4m"
	Cyan      = "\033[36;6;2m"
	Green     = "\033[32;6;3m"
	Yellow    = "\033[0;33m"
	Reset     = "\033[0m"

	Info = "\033[33;1;1m"
	Que  = "\033[34;1;1m"
	Bad  = "\033[31;1;1m"
	Good = "\033[32;1;1m"
	Run  = "\033[97;1;1m"
)

Different Colours for use

Resolver is a global dns_resolver object

Functions

func CheckWildcard

func CheckWildcard(state *State, ips []string) (result bool)

CheckWildcard checks if a ip result contains wildcards

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string)

CreateDirIfNotExist creates config directory if it does not exists

func Exists

func Exists(path string) bool

Exists returns whether the given file or directory exists or not

func ExtractSubdomains

func ExtractSubdomains(text, domain string) (urls []string)

ExtractSubdomains extracts a subdomain from a big blob of text

func GetHTTPCookieResponse

func GetHTTPCookieResponse(urls string, cookies []*http.Cookie, timeout int) (resp *http.Response, cookie []*http.Cookie, err error)

GetHTTPCookieResponse returns a HTTP Response object It needs URL To Visit and a cookie array to send with request. Note, It needs full url with scheme and a timeout value. It returns a HTTP Response object with a cookie array.

func GetHTTPResponse

func GetHTTPResponse(url string, timeout int) (resp *http.Response, err error)

GetHTTPResponse : Returns a HTTP Response object It needs URL To Visit. Note, It needs full url with scheme and a timeout value. It returns a HTTP Response object

func GetHomeDir

func GetHomeDir() string

GetHomeDir gets current user directory

func InitWildcard

func InitWildcard(domain string) (result bool, ips []string)

InitWildcard checks if a host returns wildcard ips and returns status with ips returned

func NewUUID

func NewUUID() (string, error)

NewUUID generates a random UUID according to RFC 4122 Taken from : https://play.golang.org/p/4FkNSiUDMg

Used for bruteforcing and detection of Wildcard Subdomains :-)

func ResolveHost

func ResolveHost(host string) (ips []string, err error)

ResolveHost resolves a host using dns_resolver lib

func SubdomainExists

func SubdomainExists(key string, values []string) bool

SubdomainExists checks if a key exists in an array

func Unique

func Unique(elements []string) []string

Unique Returns unique items in a slice Adapted from http://www.golangprograms.com/remove-duplicate-values-from-slice.html

func Validate

func Validate(domain string, strslice []string) (subdomains []string)

Validate returns valid subdomains found ending with target domain

Types

type Config

type Config struct {
	VirustotalAPIKey string `json:"virustotalApikey"` // Virustotal API Key

	PassivetotalUsername string `json:"passivetotalUsername"` // PassiveTotal Username (Email Address)
	PassivetotalKey      string `json:"passivetotalKey"`      // PassiveTotal api key

	SecurityTrailsKey string `json:"securitytrailsKey"` // SecurityTrails api key

	RiddlerEmail    string `json:"riddlerEmail"`    // Riddler Email
	RiddlerPassword string `json:"riddlerPassword"` // Riddler Password

	CensysUsername string `json:"censysUsername"` // Censys Username
	CensysSecret   string `json:"censysSecret"`   // Censys API Key

	ShodanAPIKey string `json:"shodanApiKey"` // Shodan API Key
}

Config contains api keys for different sources

func ReadConfigFile

func ReadConfigFile() (configuration *Config, err error)

ReadConfigFile Reads a config file from disk and returns Configuration structure If not exists, create one and then return

type Domain

type Domain struct {
	IP   string
	Fqdn string
}

Domain structure

type Job

type Job struct {
	F      func(...interface{}) interface{}
	Args   []interface{}
	Result interface{}
	Err    error
	// contains filtered or unexported fields
}

Job holds all the data related to a worker's instance.

type Pool

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

Pool is the main data structure.

func NewPool

func NewPool(workers int) (pool *Pool)

NewPool creates a new Pool

func (*Pool) Add

func (pool *Pool) Add(f func(...interface{}) interface{}, args ...interface{})

Add creates a Job from the given function and args and adds it to the Pool.

func (*Pool) Results

func (pool *Pool) Results() (res []*Job)

Results retrieves the completed jobs.

func (*Pool) Run

func (pool *Pool) Run()

Run starts the Pool by launching the workers. It's OK to start an empty Pool. The jobs will be fed to the workers as soon as they become available.

func (*Pool) Status

func (pool *Pool) Status() Stats

Status returns a "stats" instance.

func (*Pool) Stop

func (pool *Pool) Stop()

Stop will signal the workers to exit and wait for them to actually do that. It also releases any other resources (e.g.: it stops the supervisor goroutine) so call this method when you're done with the Pool instance to allow the GC to do its job.

func (*Pool) Wait

func (pool *Pool) Wait()

Wait blocks until all the jobs in the Pool are done.

func (*Pool) WaitForJob

func (pool *Pool) WaitForJob() *Job

WaitForJob blocks until a completed job is available and returns it. If there are no jobs running, it returns nil.

type Result

type Result struct {
	Subdomains []string // Subdomains found
	Error      error    // Any error that has occurred
}

Result is the Current result structure

type Setting

type Setting struct {
	CensysPages    string // Censys pages to check. For All, use "all"
	AskPages       string // Ask search pages to check
	BaiduPages     string // Ask search pages to check
	BingPages      string // Ask search pages to check
	DogpilePages   string // Dogpile search pages to check
	YahooPages     string // Yahoo search pages to check
	ShodanPages    string // Shodan search pages to check
	GoogleterPages string // Googleter
}

Setting contains settings for sources

func InitializeSettings

func InitializeSettings() (setting *Setting)

InitializeSettings sets default settings value

type State

type State struct {
	Color         bool     // Whether to use color or not
	Threads       int      // Number of threads to use
	Timeout       int      // Timeout for requests to different passive sources
	Verbose       bool     // Show verbose information
	Domain        string   // Domain name to find subdomains for
	Recursive     bool     // Whether perform recursive subdomain discovery or not
	Output        string   // Name of output file
	Alive         bool     // Get only alive subdomains (x - no wildcards :-))
	IsJSON        bool     // Provide JSON output file
	Wordlist      string   // Wordlist file for subdomains bruteforcing
	Bruteforce    bool     // Flag to decide whether to bruteforce or not
	WildcardIP    []string // Wildcard IP Structure
	IsWildcard    bool     // Does the host has wildcard subdomains, if yes parse them carefully
	Sources       string   // Comma separated list of sources to use
	Silent        bool     // Show only silent output or not
	FinalResults  []string // Contains final bruteforcing results
	SetConfig     string   // Used for changing the current configuration file details
	SetSetting    string   // Used for passing custom configuration to the application
	DomainList    string   // List of domains to find subdomains for
	OutputDir     string   // Directory to output results to if domain list is used
	LoadResolver  []string // Slice of resolvers to use
	ComResolver   string   // Comma-separated list of resolvers to use
	ListResolver  string   // File to load resolvers from
	AquatoneJSON  bool     // Use aquatone style json format
	ExcludeSource string   // Sources to exclude
	NoPassive     bool     // Do not perform passive enumeration
	OutputHandle  *os.File // Handle to the output file used for output buffering

	CurrentSettings Setting // Current application settings
	ConfigState     Config  // Current configuration file state
}

State holds the State read in from the CLI

func InitState

func InitState() (state *State)

InitState initializes the default state

type Stats

type Stats struct {
	Submitted int
	Running   int
	Completed int
}

Stats is a structure holding statistical data about the pool.

Jump to

Keyboard shortcuts

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