Documentation ¶
Overview ¶
Package httpfuzz is a fast fuzzer that allows you to easily fuzz HTTP endpoints. It works in a similar way to Burp Intruder, but it doesn't read the entire wordlist into memory. Instead, it calculates how many requests it's going to send ahead of time and streams through the wordlist line-by-line, using go's sync.WaitGroup to wait until the last request finishes.
Index ¶
- func NativeSupportedFileTypes() []string
- type Client
- type Config
- type DelimiterArray
- type File
- type Fuzzer
- type InitializerFunc
- type Job
- type Listener
- type PluginBroker
- type Request
- func (r *Request) BodyTargetCount(delimiter byte) (int, error)
- func (r *Request) CloneBody(ctx context.Context) (*Request, error)
- func (r *Request) HasPathArgument(pathArg string) bool
- func (r *Request) IsMultipartForm() bool
- func (r *Request) RemoveDelimiters(delimiter byte) error
- func (r *Request) ReplaceMultipartField(fieldName, payload string) error
- func (r *Request) ReplaceMultipartFileData(fieldName string, file *File) error
- func (r *Request) SetBodyPayloadAt(position int, delimiter byte, payload string) error
- func (r *Request) SetDirectoryRoot(value string)
- func (r *Request) SetQueryParam(param, value string)
- func (r *Request) SetURLPathArgument(arg, value string)
- type Response
- type Result
- type Wordlist
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NativeSupportedFileTypes ¶
func NativeSupportedFileTypes() []string
NativeSupportedFileTypes returns a list of file types httpfuzz can generate by default.
Types ¶
type Client ¶
Client is a modified net/http Client that can natively handle our request and response types
type Config ¶
type Config struct { TargetHeaders []string TargetParams []string TargetPathArgs []string TargetFileKeys []string TargetMultipartFieldNames []string FilesystemPayloads []string TargetFilenames []string LogSuccess bool EnableGeneratedPayloads bool FuzzFileSize int64 FuzzDirectory bool Wordlist *Wordlist Seed *Request Client *Client RequestDelay time.Duration Plugins *PluginBroker Logger *log.Logger URLScheme string TargetDelimiter byte // contains filtered or unexported fields }
Config holds all fuzzer configuration.
type DelimiterArray ¶
type DelimiterArray struct {
Contents []byte
}
A DelimiterArray finds the positions of a delimiter within a byte slice. It is faster than SuffixArray for our use case since we only need the position of a single byte instead of a group of bytes.
func (*DelimiterArray) Lookup ¶
func (d *DelimiterArray) Lookup(delimiter byte) []int
Lookup returns the offsets within a byte slice a particular delimiter is at in O(n) time.
type File ¶
File is a generated file of a given type with associated metadata.
type Fuzzer ¶
type Fuzzer struct {
*Config
}
Fuzzer creates HTTP requests from a seed request using the combination of inputs specified in the config. It uses the producer-consumer pattern to efficiently handle large wordlists.
func (*Fuzzer) GenerateRequests ¶
GenerateRequests begins generating HTTP requests based on the seed request and sends them into the returned channel. It streams the wordlist from the filesystem line-by-line so it can handle wordlists in constant time. The trade-off is that callers cannot know ahead of time how many requests will be sent.
func (*Fuzzer) ProcessRequests ¶
ProcessRequests executes HTTP requests in as they're received over the channel.
func (*Fuzzer) RequestCount ¶
RequestCount calculates the total number of requests that will be sent given a set of input and the fields to be fuzzed using combinatorials. This will be slower the larger the input file. It is imperative that this count matches the number of requests created by GenerateRequest, otherwise httpfuzz will wait forever on requests that aren't coming or exit before all requests are processed.
type InitializerFunc ¶
InitializerFunc is a go function that should be exported by a function package. It should be named "New". Your InitializerFunc should return an instance of your Listener with a reference to httpfuzz's logger for consistent logging.
type Listener ¶
type Listener interface {
Listen(results <-chan *Result)
}
Listener must be implemented by a plugin to users to hook the request - response transaction. The Listen method will be run in its own goroutine, so plugins cannot block the rest of the program, however panics can take down the entire process.
type PluginBroker ¶
type PluginBroker struct {
// contains filtered or unexported fields
}
PluginBroker handles sending messages to plugins.
func LoadPlugins ¶
func LoadPlugins(logger *log.Logger, paths []string) (*PluginBroker, error)
LoadPlugins loads Plugins from binaries on the filesytem.
func (*PluginBroker) SendResult ¶
func (p *PluginBroker) SendResult(result *Result) error
SendResult sends a *Result to all loaded plugins for further processing.
func (*PluginBroker) SignalDone ¶
func (p *PluginBroker) SignalDone()
SignalDone closes all plugin chans that are waiting on results. Call only after all results have been sent.
func (*PluginBroker) Wait ¶
func (p *PluginBroker) Wait()
Wait blocks the goroutine until all plugins have finished executing.
type Request ¶
Request is a more fuzzable *http.Request. It supports deep-cloning its body and has several convenience methods for modifying request attributes.
func RequestFromFile ¶
RequestFromFile parses an HTTP request from a file.
func (*Request) BodyTargetCount ¶
BodyTargetCount calculates the number of targets in a request body.
func (*Request) CloneBody ¶
CloneBody makes a copy of a request, including its body, while leaving the original body intact.
func (*Request) HasPathArgument ¶
HasPathArgument returns true if a request URL has a given path argument.
func (*Request) IsMultipartForm ¶
IsMultipartForm returns true if this is a multipart request.
func (*Request) RemoveDelimiters ¶
RemoveDelimiters removes all target delimiters from a request so it can be sent to the server and interpreted properly.
func (*Request) ReplaceMultipartField ¶
ReplaceMultipartField replaces a regular form field in a multipart request with a payload. We do this because delimiters don't work with binary files.
func (*Request) ReplaceMultipartFileData ¶
ReplaceMultipartFileData replaces a file in the request body with a generated payload.
func (*Request) SetBodyPayloadAt ¶
SetBodyPayloadAt injects a payload at a given position.
func (*Request) SetDirectoryRoot ¶
SetDirectoryRoot inserts a string after the final "/" in a URL to
func (*Request) SetQueryParam ¶
SetQueryParam sets a URL query param to a given value.
func (*Request) SetURLPathArgument ¶
SetURLPathArgument sets a URL path argument to a given value.
type Result ¶
type Result struct { Request *Request Response *Response Payload string Location string FieldName string TimeElapsed time.Duration }
Result is the request, response and associated metadata to be processed by plugins.