httpx

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 16 Imported by: 53

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	Threads:  25,
	Timeout:  30 * time.Second,
	RetryMax: 5,

	VHostIgnoreStatusCode:    false,
	VHostIgnoreContentLength: true,
	VHostIgnoreNumberOfWords: false,
	VHostIgnoreNumberOfLines: false,
	VHostStripHTML:           false,
	VHostSimilarityRatio:     85,
	DefaultUserAgent:         "httpx - Open-source project (github.com/projectdiscovery/httpx)",
}

DefaultOptions contains the default options

Functions

func ExtractTitle

func ExtractTitle(r *Response) string

ExtractTitle from a response

Types

type CustomCallback

type CustomCallback func(response *Response) (bool, error)

CustomCallback used in custom filters

type Filter

type Filter interface {
	Filter(response *Response) (bool, error)
}

Filter defines a generic filter interface to apply to responses

type FilterCustom

type FilterCustom struct {
	CallBacks []CustomCallback
}

FilterCustom defines a filter with callback functions applied

func (FilterCustom) Filter

func (f FilterCustom) Filter(response *Response) (bool, error)

Filter a response with custom callbacks

type FilterRegex

type FilterRegex struct {
	Regexs []string
}

FilterRegex defines a filter of type regex

func (FilterRegex) Filter

func (f FilterRegex) Filter(response *Response) (bool, error)

Filter a response with regexes

type FilterString

type FilterString struct {
	Keywords []string
}

FilterString defines a filter of type string

func (FilterString) Filter

func (f FilterString) Filter(response *Response) (bool, error)

Filter a response with strings filtering

type HTTPX

type HTTPX struct {
	Filters []Filter
	Options *Options

	CustomHeaders map[string]string
	// contains filtered or unexported fields
}

HTTPX represent an instance of the library client

func New

func New(options *Options) (*HTTPX, error)

New httpx instance

func (*HTTPX) AddFilter

func (h *HTTPX) AddFilter(f Filter)

AddFilter cascade

func (*HTTPX) Do

func (h *HTTPX) Do(req *retryablehttp.Request) (*Response, error)

Do http request

func (*HTTPX) IsVirtualHost

func (h *HTTPX) IsVirtualHost(req *retryablehttp.Request) (bool, error)

IsVirtualHost checks if the target endpoint is a virtual host

func (*HTTPX) NewRequest

func (h *HTTPX) NewRequest(method, URL string) (req *retryablehttp.Request, err error)

NewRequest from url

func (*HTTPX) SetCustomHeaders

func (h *HTTPX) SetCustomHeaders(r *retryablehttp.Request, headers map[string]string)

SetCustomHeaders on the provided request

func (*HTTPX) Verify

func (h *HTTPX) Verify(req *retryablehttp.Request) (bool, error)

Verify the http calls and apply-cascade all the filters, as soon as one matches it returns true

type Options

type Options struct {
	Threads int
	// Timeout is the maximum time to wait for the request
	Timeout time.Duration
	// RetryMax is the maximum number of retries
	RetryMax int

	CustomHeaders    map[string]string
	FollowRedirects  bool
	DefaultUserAgent string

	HttpProxy  string
	SocksProxy string

	// VHOSTs options
	VHostIgnoreStatusCode    bool
	VHostIgnoreContentLength bool
	VHostIgnoreNumberOfWords bool
	VHostIgnoreNumberOfLines bool
	VHostStripHTML           bool

	// VHostimilarityRatio 1 - 100
	VHostSimilarityRatio int
}

Options contains configuration options for the client

type Response

type Response struct {
	StatusCode    int
	Headers       map[string][]string
	Data          []byte
	ContentLength int
	Raw           string
	Words         int
	Lines         int
}

Response contains the response to a server

Jump to

Keyboard shortcuts

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