Documentation ¶
Overview ¶
Package httpx containst the httpx common funcionality
Index ¶
- Constants
- Variables
- func Decodebig5(s []byte) ([]byte, error)
- func Decodegbk(s []byte) ([]byte, error)
- func Encodebig5(s []byte) ([]byte, error)
- func ExtractTitle(r *Response) (title string)
- type CSPData
- type ChainItem
- type CustomCallback
- type Filter
- type FilterCustom
- type FilterRegex
- type FilterString
- type HTTPX
- func (h *HTTPX) AddFilter(f Filter)
- func (h *HTTPX) CSPGrab(r *http.Response) *CSPData
- func (h *HTTPX) CdnCheck(ip string) (bool, error)
- func (h *HTTPX) Do(req *retryablehttp.Request) (*Response, error)
- func (h *HTTPX) IsVirtualHost(req *retryablehttp.Request) (bool, error)
- func (h *HTTPX) NewRequest(method, targetURL string) (req *retryablehttp.Request, err error)
- func (h *HTTPX) SetCustomHeaders(r *retryablehttp.Request, headers map[string]string)
- func (h *HTTPX) SupportHTTP2(protocol, method, targetURL string) bool
- func (h *HTTPX) SupportPipeline(protocol, method, host string, port int) bool
- func (h *HTTPX) TLSGrab(r *http.Response) *TLSData
- func (h *HTTPX) Verify(req *retryablehttp.Request) (bool, error)
- type Options
- type RequestOverride
- type Response
- type TLSData
Constants ¶
const ( // HTTP defines the plain http scheme HTTP = "http" // HTTPS defines the secure http scheme HTTPS = "https" // HTTPorHTTPS defines the both http and https scheme HTTPorHTTPS = "http|https" )
Variables ¶
var CSPHeaders []string = []string{
"Content-Security-Policy",
"Content-Security-Policy-Report-Only",
"X-Content-Security-Policy-Report-Only",
"X-Webkit-Csp-Report-Only",
}
CSPHeaders is an incomplete list of most common CSP headers
var DefaultOptions = Options{ RandomAgent: true, Threads: 25, Timeout: 30 * time.Second, RetryMax: 5, Unsafe: false, CdnCheck: true, 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 Decodebig5 ¶ added in v0.0.7
Decodebig5 converts BIG5 to UTF-8
func Encodebig5 ¶ added in v0.0.7
Encodebig5 converts UTF-8 to BIG5
Types ¶
type CSPData ¶ added in v1.0.3
type CSPData struct {
Domains []string `json:"domains,omitempty"`
}
CSPData contains the Content-Security-Policy domain list
type ChainItem ¶ added in v1.0.6
type ChainItem struct { Request string `json:"request,omitempty"` Response string `json:"response,omitempty"` StatusCode int `json:"status_code,omitempty"` }
ChainItem request=>response
type CustomCallback ¶
CustomCallback used in custom filters
type FilterCustom ¶
type FilterCustom struct {
CallBacks []CustomCallback
}
FilterCustom defines a filter with callback functions applied
type FilterRegex ¶
type FilterRegex struct {
Regexs []string
}
FilterRegex defines a filter of type regex
type FilterString ¶
type FilterString struct {
Keywords []string
}
FilterString defines a filter of type string
type HTTPX ¶
type HTTPX struct { Filters []Filter Options *Options CustomHeaders map[string]string RequestOverride *RequestOverride Dialer *fastdialer.Dialer // contains filtered or unexported fields }
HTTPX represent an instance of the library client
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, targetURL 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) SupportHTTP2 ¶ added in v1.0.0
SupportHTTP2 checks if the target host supports HTTP2
func (*HTTPX) SupportPipeline ¶ added in v1.0.0
SupportPipeline checks if the target host supports HTTP1.1 pipelining by sending x probes and reading back responses expecting at least 2 with HTTP/1.1 or HTTP/1.0
type Options ¶
type Options struct { RandomAgent bool DefaultUserAgent string RequestOverride RequestOverride HTTPProxy string SocksProxy string Threads int CdnCheck bool // 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 // VHostSimilarityRatio 1 - 100 VHostSimilarityRatio int FollowRedirects bool FollowHostRedirects bool Unsafe bool TLSGrab bool // VHOSTs options VHostIgnoreStatusCode bool VHostIgnoreContentLength bool VHostIgnoreNumberOfWords bool VHostIgnoreNumberOfLines bool VHostStripHTML bool Allow []string Deny []string }
Options contains configuration options for the client
type RequestOverride ¶ added in v1.0.0
type RequestOverride struct {
URIPath string
}
RequestOverride contains the URI path to override the request
type Response ¶
type Response struct { StatusCode int Headers map[string][]string Data []byte ContentLength int Raw string RawHeaders string Words int Lines int TLSData *TLSData CSPData *CSPData HTTP2 bool Pipeline bool Duration time.Duration Chain []httputil.ChainItem }
Response contains the response to a server
func (*Response) GetChainAsSlice ¶ added in v1.0.6
GetChainAsSlice dump the whole redirect chain as structuerd slice
func (*Response) GetChainStatusCodes ¶ added in v1.0.6
GetChainStatusCodes from redirects
func (*Response) GetHeaderPart ¶ added in v0.0.7
GetHeaderPart with offset
type TLSData ¶ added in v1.0.3
type TLSData struct { DNSNames []string `json:"dns_names,omitempty"` Emails []string `json:"emails,omitempty"` CommonName []string `json:"common_name,omitempty"` Organization []string `json:"organization,omitempty"` IssuerCommonName []string `json:"issuer_common_name,omitempty"` IssuerOrg []string `json:"issuer_organization,omitempty"` }
TLSData contains the relevant Transport Layer Security information