Documentation ¶
Index ¶
- Variables
- func CheckOrCreateConfigDir() error
- func FileExists(path string) bool
- func HistoryReplayable(conf *Config) (bool, string)
- func HostURLFromRequest(req Request) string
- func RandomString(n int) string
- func RequestContainsKeyword(req Request, kw string) bool
- func StrInSlice(key string, slice []string) bool
- func UniqStringSlice(inslice []string) []string
- func UrlEqual(url1, url2 *url.URL) bool
- func Version() string
- func WriteHistoryEntry(conf *Config) (string, error)
- type AutocalibrationStrategy
- type Config
- type ConfigOptions
- type ConfigOptionsHistory
- type FilterOptions
- type FilterProvider
- type GeneralOptions
- type HTTPOptions
- type InputOptions
- type InputProvider
- type InputProviderConfig
- type InternalInputProvider
- type Job
- func (j *Job) Calibrate(input map[string][]byte) error
- func (j *Job) CalibrateForHost(host string, baseinput map[string][]byte) error
- func (j *Job) CalibrateIfNeeded(host string, input map[string][]byte) error
- func (j *Job) CheckStop()
- func (j *Job) DeleteQueueItem(index int)
- func (j *Job) Next()
- func (j *Job) Pause()
- func (j *Job) QueuedJobs() []QueueJob
- func (j *Job) Reset(cycle bool)
- func (j *Job) Resume()
- func (j *Job) SkipQueue()
- func (j *Job) Start()
- func (j *Job) Stop()
- type MatcherManager
- type MatcherOptions
- type Multierror
- type OutputOptions
- type OutputProvider
- type Progress
- type QueueJob
- type RateThrottle
- type Request
- type Response
- type Result
- type RunnerProvider
- type Scraper
- type ScraperResult
- type ValueRange
Constants ¶
This section is empty.
Variables ¶
var ( //VERSION holds the current version number VERSION = "2.1.0" //VERSION_APPENDIX holds additional version definition VERSION_APPENDIX = "-dev" CONFIGDIR = filepath.Join(xdg.ConfigHome, "ffuf") HISTORYDIR = filepath.Join(CONFIGDIR, "history") SCRAPERDIR = filepath.Join(CONFIGDIR, "scraper") AUTOCALIBDIR = filepath.Join(CONFIGDIR, "autocalibration") )
Functions ¶
func CheckOrCreateConfigDir ¶
func CheckOrCreateConfigDir() error
func FileExists ¶
FileExists checks if the filepath exists and is not a directory. Returns false in case it's not possible to describe the named file.
func HistoryReplayable ¶
func HostURLFromRequest ¶
HostURLFromRequest gets a host + path without the filename or last part of the URL path
func RandomString ¶
RandomString returns a random string of length of parameter n
func RequestContainsKeyword ¶
RequestContainsKeyword checks if a keyword is present in any field of a request
func StrInSlice ¶
func UniqStringSlice ¶
UniqStringSlice returns an unordered slice of unique strings. The duplicates are dropped
func WriteHistoryEntry ¶
Types ¶
type AutocalibrationStrategy ¶
type Config ¶
type Config struct { AutoCalibration bool `json:"autocalibration"` AutoCalibrationKeyword string `json:"autocalibration_keyword"` AutoCalibrationPerHost bool `json:"autocalibration_perhost"` AutoCalibrationStrategies []string `json:"autocalibration_strategies"` AutoCalibrationStrings []string `json:"autocalibration_strings"` Cancel context.CancelFunc `json:"-"` Colors bool `json:"colors"` CommandKeywords []string `json:"-"` CommandLine string `json:"cmdline"` ConfigFile string `json:"configfile"` Context context.Context `json:"-"` Data string `json:"postdata"` Debuglog string `json:"debuglog"` Delay optRange `json:"delay"` DirSearchCompat bool `json:"dirsearch_compatibility"` Encoders []string `json:"encoders"` Extensions []string `json:"extensions"` FilterMode string `json:"fmode"` FollowRedirects bool `json:"follow_redirects"` Headers map[string]string `json:"headers"` IgnoreBody bool `json:"ignorebody"` IgnoreWordlistComments bool `json:"ignore_wordlist_comments"` InputMode string `json:"inputmode"` InputNum int `json:"cmd_inputnum"` InputProviders []InputProviderConfig `json:"inputproviders"` InputShell string `json:"inputshell"` Json bool `json:"json"` MatcherManager MatcherManager `json:"matchers"` MatcherMode string `json:"mmode"` MaxTime int `json:"maxtime"` MaxTimeJob int `json:"maxtime_job"` Method string `json:"method"` Noninteractive bool `json:"noninteractive"` OutputDirectory string `json:"outputdirectory"` OutputFile string `json:"outputfile"` OutputFormat string `json:"outputformat"` OutputSkipEmptyFile bool `json:"OutputSkipEmptyFile"` ProgressFrequency int `json:"-"` ProxyURL string `json:"proxyurl"` Quiet bool `json:"quiet"` Rate int64 `json:"rate"` Raw bool `json:"raw"` Recursion bool `json:"recursion"` RecursionDepth int `json:"recursion_depth"` RecursionStrategy string `json:"recursion_strategy"` ReplayProxyURL string `json:"replayproxyurl"` RequestFile string `json:"requestfile"` RequestProto string `json:"requestproto"` ScraperFile string `json:"scraperfile"` Scrapers string `json:"scrapers"` SNI string `json:"sni"` StopOn403 bool `json:"stop_403"` StopOnAll bool `json:"stop_all"` StopOnErrors bool `json:"stop_errors"` Threads int `json:"threads"` Timeout int `json:"timeout"` Url string `json:"url"` Verbose bool `json:"verbose"` Wordlists []string `json:"wordlists"` Http2 bool `json:"http2"` ClientCert string `json:"client-cert"` ClientKey string `json:"client-key"` TLSSkipVerify bool }
func ConfigFromOptions ¶
func ConfigFromOptions(parseOpts *ConfigOptions, ctx context.Context, cancel context.CancelFunc) (*Config, error)
ConfigFromOptions parses the values in ConfigOptions struct, ensures that the values are sane, and creates a Config struct out of them.
func (*Config) SetContext ¶
func (c *Config) SetContext(ctx context.Context, cancel context.CancelFunc)
func (*Config) ToOptions ¶
func (c *Config) ToOptions() ConfigOptions
type ConfigOptions ¶
type ConfigOptions struct { Filter FilterOptions `json:"filters"` General GeneralOptions `json:"general"` HTTP HTTPOptions `json:"http"` Input InputOptions `json:"input"` Matcher MatcherOptions `json:"matchers"` Output OutputOptions `json:"output"` }
func NewConfigOptions ¶
func NewConfigOptions() *ConfigOptions
NewConfigOptions returns a newly created ConfigOptions struct with default values
func ReadConfig ¶
func ReadConfig(configFile string) (*ConfigOptions, error)
func ReadDefaultConfig ¶
func ReadDefaultConfig() (*ConfigOptions, error)
type ConfigOptionsHistory ¶
type ConfigOptionsHistory struct { ConfigOptions Time time.Time `json:"time"` }
func SearchHash ¶
func SearchHash(hash string) ([]ConfigOptionsHistory, int, error)
type FilterOptions ¶
type FilterProvider ¶
type FilterProvider interface { Filter(response *Response) (bool, error) Repr() string ReprVerbose() string }
FilterProvider is a generic interface for both Matchers and Filters
type GeneralOptions ¶
type GeneralOptions struct { AutoCalibration bool `json:"autocalibration"` AutoCalibrationKeyword string `json:"autocalibration_keyword"` AutoCalibrationPerHost bool `json:"autocalibration_per_host"` AutoCalibrationStrategies []string `json:"autocalibration_strategies"` AutoCalibrationStrings []string `json:"autocalibration_strings"` Colors bool `json:"colors"` ConfigFile string `toml:"-" json:"config_file"` Delay string `json:"delay"` Json bool `json:"json"` MaxTime int `json:"maxtime"` MaxTimeJob int `json:"maxtime_job"` Noninteractive bool `json:"noninteractive"` Quiet bool `json:"quiet"` Rate int `json:"rate"` ScraperFile string `json:"scraperfile"` Scrapers string `json:"scrapers"` Searchhash string `json:"-"` ShowVersion bool `toml:"-" json:"-"` StopOn403 bool `json:"stop_on_403"` StopOnAll bool `json:"stop_on_all"` StopOnErrors bool `json:"stop_on_errors"` Threads int `json:"threads"` Verbose bool `json:"verbose"` }
type HTTPOptions ¶
type HTTPOptions struct { Cookies []string `json:"-"` // this is appended in headers Data string `json:"data"` FollowRedirects bool `json:"follow_redirects"` Headers []string `json:"headers"` IgnoreBody bool `json:"ignore_body"` Method string `json:"method"` ProxyURL string `json:"proxy_url"` Raw bool `json:"raw"` Recursion bool `json:"recursion"` RecursionDepth int `json:"recursion_depth"` RecursionStrategy string `json:"recursion_strategy"` ReplayProxyURL string `json:"replay_proxy_url"` SNI string `json:"sni"` Timeout int `json:"timeout"` URL string `json:"url"` Http2 bool `json:"http2"` ClientCert string `json:"client-cert"` ClientKey string `json:"client-key"` }
type InputOptions ¶
type InputOptions struct { DirSearchCompat bool `json:"dirsearch_compat"` Encoders []string `json:"encoders"` Extensions string `json:"extensions"` IgnoreWordlistComments bool `json:"ignore_wordlist_comments"` InputMode string `json:"input_mode"` InputNum int `json:"input_num"` InputShell string `json:"input_shell"` Inputcommands []string `json:"input_commands"` Request string `json:"request_file"` RequestProto string `json:"request_proto"` Wordlists []string `json:"wordlists"` }
type InputProvider ¶
type InputProvider interface { ActivateKeywords([]string) AddProvider(InputProviderConfig) error Keywords() []string Next() bool Position() int SetPosition(int) Reset() Value() map[string][]byte Total() int }
InputProvider interface handles the input data for RunnerProvider
type InputProviderConfig ¶
type InternalInputProvider ¶
type InternalInputProvider interface { Keyword() string Next() bool Position() int SetPosition(int) ResetPosition() IncrementPosition() Value() []byte Total() int Active() bool Enable() Disable() }
InternalInputProvider interface handles providing input data to InputProvider
type Job ¶
type Job struct { Config *Config ErrorMutex sync.Mutex Input InputProvider Runner RunnerProvider ReplayRunner RunnerProvider Scraper Scraper Output OutputProvider Jobhash string Counter int ErrorCounter int SpuriousErrorCounter int Total int Running bool RunningJob bool Paused bool Count403 int Count429 int Error string Rate *RateThrottle // contains filtered or unexported fields }
Job ties together Config, Runner, Input and Output
func (*Job) Calibrate ¶
CalibrateResponses returns slice of Responses for randomly generated filter autocalibration requests
func (*Job) CalibrateForHost ¶
CalibrateForHost runs autocalibration for a specific host
func (*Job) CalibrateIfNeeded ¶
CalibrateIfNeeded runs a self-calibration task for filtering options (if needed) by requesting random resources and
configuring the filters accordingly
func (*Job) CheckStop ¶
func (j *Job) CheckStop()
CheckStop stops the job if stopping conditions are met
func (*Job) DeleteQueueItem ¶
DeleteQueueItem deletes a recursion job from the queue by its index in the slice
func (*Job) QueuedJobs ¶
QueuedJobs returns the slice of queued recursive jobs
type MatcherManager ¶
type MatcherManager interface { SetCalibrated(calibrated bool) SetCalibratedForHost(host string, calibrated bool) AddFilter(name string, option string, replace bool) error AddPerDomainFilter(domain string, name string, option string) error RemoveFilter(name string) AddMatcher(name string, option string) error GetFilters() map[string]FilterProvider GetMatchers() map[string]FilterProvider FiltersForDomain(domain string) map[string]FilterProvider CalibratedForDomain(domain string) bool Calibrated() bool }
MatcherManager provides functions for managing matchers and filters
type MatcherOptions ¶
type Multierror ¶
type Multierror struct {
// contains filtered or unexported fields
}
func (*Multierror) Add ¶
func (m *Multierror) Add(err error)
func (*Multierror) ErrorOrNil ¶
func (m *Multierror) ErrorOrNil() error
type OutputOptions ¶
type OutputProvider ¶
type OutputProvider interface { Banner() Finalize() error Progress(status Progress) Info(infostring string) Error(errstring string) Raw(output string) Warning(warnstring string) Result(resp Response) PrintResult(res Result) SaveFile(filename, format string) error GetCurrentResults() []Result SetCurrentResults(results []Result) Reset() Cycle() }
OutputProvider is responsible of providing output from the RunnerProvider
type RateThrottle ¶
type RateThrottle struct { Config *Config RateMutex sync.Mutex RateLimiter *time.Ticker // contains filtered or unexported fields }
func NewRateThrottle ¶
func NewRateThrottle(conf *Config) *RateThrottle
func (*RateThrottle) ChangeRate ¶
func (r *RateThrottle) ChangeRate(rate int)
func (*RateThrottle) CurrentRate ¶
func (r *RateThrottle) CurrentRate() int64
CurrentRate calculates requests/second value from circular list of rate
func (*RateThrottle) Tick ¶
func (r *RateThrottle) Tick(start, end time.Time)
rateTick adds a new duration measurement tick to rate counter
type Request ¶
type Request struct { Method string Host string Url string Headers map[string]string Data []byte Input map[string][]byte Position int Raw string }
Request holds the meaningful data that is passed for runner for making the query
func BaseRequest ¶
BaseRequest returns a base request struct populated from the main config
func CopyRequest ¶
CopyRequest performs a deep copy of a request and returns a new struct
func NewRequest ¶
func RecursionRequest ¶
RecursionRequest returns a base request for a recursion target
func SniperRequests ¶
SniperRequests returns an array of requests, each with one of the templated locations replaced by a keyword
type Response ¶
type Response struct { StatusCode int64 Headers map[string][]string Data []byte ContentLength int64 ContentWords int64 ContentLines int64 ContentType string Cancelled bool Request *Request Raw string ResultFile string ScraperData map[string][]string Time time.Duration }
Response struct holds the meaningful data returned from request and is meant for passing to filters
func (*Response) GetRedirectLocation ¶
GetRedirectLocation returns the redirect location for a 3xx redirect HTTP response
type Result ¶
type Result struct { Input map[string][]byte `json:"input"` Position int `json:"position"` StatusCode int64 `json:"status"` ContentLength int64 `json:"length"` ContentWords int64 `json:"words"` ContentLines int64 `json:"lines"` ContentType string `json:"content-type"` RedirectLocation string `json:"redirectlocation"` Url string `json:"url"` Duration time.Duration `json:"duration"` ScraperData map[string][]string `json:"scraper"` ResultFile string `json:"resultfile"` Host string `json:"host"` HTMLColor string `json:"-"` }
type RunnerProvider ¶
type RunnerProvider interface { Prepare(input map[string][]byte, basereq *Request) (Request, error) Execute(req *Request) (Response, error) Dump(req *Request) ([]byte, error) }
RunnerProvider is an interface for request executors
type Scraper ¶
type Scraper interface { Execute(resp *Response, matched bool) []ScraperResult AppendFromFile(path string) error }
type ScraperResult ¶
type ValueRange ¶
type ValueRange struct {
Min, Max int64
}
func ValueRangeFromString ¶
func ValueRangeFromString(instr string) (ValueRange, error)