mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 20:05:27 +00:00
added force http2 option (#2919)
* added force http2 option * implemented http2 with transport method * fix and added forcehttp on clientpool * updated readme with new flag * option update Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
This commit is contained in:
parent
38cfc1c183
commit
628b96f768
@ -157,6 +157,7 @@ CONFIGURATIONS:
|
|||||||
-r, -resolvers string file containing resolver list for nuclei
|
-r, -resolvers string file containing resolver list for nuclei
|
||||||
-sr, -system-resolvers use system DNS resolving as error fallback
|
-sr, -system-resolvers use system DNS resolving as error fallback
|
||||||
-passive enable passive HTTP response processing mode
|
-passive enable passive HTTP response processing mode
|
||||||
|
-fh2, -force-http2 force http2 connection on requests
|
||||||
-ev, -env-vars enable environment variables to be used in template
|
-ev, -env-vars enable environment variables to be used in template
|
||||||
-cc, -client-cert string client certificate file (PEM-encoded) used for authenticating against scanned hosts
|
-cc, -client-cert string client certificate file (PEM-encoded) used for authenticating against scanned hosts
|
||||||
-ck, -client-key string client key file (PEM-encoded) used for authenticating against scanned hosts
|
-ck, -client-key string client key file (PEM-encoded) used for authenticating against scanned hosts
|
||||||
|
|||||||
@ -190,6 +190,7 @@ on extensive configurability, massive extensibility and ease of use.`)
|
|||||||
flagSet.StringVarP(&options.ResolversFile, "resolvers", "r", "", "file containing resolver list for nuclei"),
|
flagSet.StringVarP(&options.ResolversFile, "resolvers", "r", "", "file containing resolver list for nuclei"),
|
||||||
flagSet.BoolVarP(&options.SystemResolvers, "system-resolvers", "sr", false, "use system DNS resolving as error fallback"),
|
flagSet.BoolVarP(&options.SystemResolvers, "system-resolvers", "sr", false, "use system DNS resolving as error fallback"),
|
||||||
flagSet.BoolVar(&options.OfflineHTTP, "passive", false, "enable passive HTTP response processing mode"),
|
flagSet.BoolVar(&options.OfflineHTTP, "passive", false, "enable passive HTTP response processing mode"),
|
||||||
|
flagSet.BoolVarP(&options.ForceAttemptHTTP2, "force-http2", "fh2", false, "force http2 connection on requests"),
|
||||||
flagSet.BoolVarP(&options.EnvironmentVariables, "env-vars", "ev", false, "enable environment variables to be used in template"),
|
flagSet.BoolVarP(&options.EnvironmentVariables, "env-vars", "ev", false, "enable environment variables to be used in template"),
|
||||||
flagSet.StringVarP(&options.ClientCertFile, "client-cert", "cc", "", "client certificate file (PEM-encoded) used for authenticating against scanned hosts"),
|
flagSet.StringVarP(&options.ClientCertFile, "client-cert", "cc", "", "client certificate file (PEM-encoded) used for authenticating against scanned hosts"),
|
||||||
flagSet.StringVarP(&options.ClientKeyFile, "client-key", "ck", "", "client key file (PEM-encoded) used for authenticating against scanned hosts"),
|
flagSet.StringVarP(&options.ClientKeyFile, "client-key", "ck", "", "client key file (PEM-encoded) used for authenticating against scanned hosts"),
|
||||||
|
|||||||
@ -39,6 +39,7 @@ func newHttpClient(options *types.Options) (*http.Client, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
|
ForceAttemptHTTP2: options.ForceAttemptHTTP2,
|
||||||
DialContext: dialer.Dial,
|
DialContext: dialer.Dial,
|
||||||
DialTLSContext: dialer.DialTLS,
|
DialTLSContext: dialer.DialTLS,
|
||||||
MaxIdleConns: 500,
|
MaxIdleConns: 500,
|
||||||
|
|||||||
@ -203,6 +203,7 @@ func wrappedGet(options *types.Options, configuration *Configuration) (*retryabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
|
ForceAttemptHTTP2: options.ForceAttemptHTTP2,
|
||||||
DialContext: Dialer.Dial,
|
DialContext: Dialer.Dial,
|
||||||
DialTLSContext: Dialer.DialTLS,
|
DialTLSContext: Dialer.DialTLS,
|
||||||
MaxIdleConns: maxIdleConns,
|
MaxIdleConns: maxIdleConns,
|
||||||
@ -211,6 +212,7 @@ func wrappedGet(options *types.Options, configuration *Configuration) (*retryabl
|
|||||||
TLSClientConfig: tlsConfig,
|
TLSClientConfig: tlsConfig,
|
||||||
DisableKeepAlives: disableKeepAlives,
|
DisableKeepAlives: disableKeepAlives,
|
||||||
}
|
}
|
||||||
|
|
||||||
if types.ProxyURL != "" {
|
if types.ProxyURL != "" {
|
||||||
if proxyURL, err := url.Parse(types.ProxyURL); err == nil {
|
if proxyURL, err := url.Parse(types.ProxyURL); err == nil {
|
||||||
transport.Proxy = http.ProxyURL(proxyURL)
|
transport.Proxy = http.ProxyURL(proxyURL)
|
||||||
|
|||||||
@ -149,6 +149,8 @@ type Options struct {
|
|||||||
// using same matchers/extractors from http protocol without the need
|
// using same matchers/extractors from http protocol without the need
|
||||||
// to send a new request, reading responses from a file.
|
// to send a new request, reading responses from a file.
|
||||||
OfflineHTTP bool
|
OfflineHTTP bool
|
||||||
|
// Force HTTP2 requests
|
||||||
|
ForceAttemptHTTP2 bool
|
||||||
// StatsJSON writes stats output in JSON format
|
// StatsJSON writes stats output in JSON format
|
||||||
StatsJSON bool
|
StatsJSON bool
|
||||||
// Headless specifies whether to allow headless mode templates
|
// Headless specifies whether to allow headless mode templates
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user