mirror of https://github.com/daffainfo/nuclei.git
Added global http redirects follow support
parent
6dac54b923
commit
8ab2dc5e48
|
@ -132,6 +132,8 @@ on extensive configurability, massive extensibility and ease of use.`)
|
|||
|
||||
createGroup(flagSet, "configs", "Configurations",
|
||||
flagSet.StringVar(&cfgFile, "config", "", "path to the nuclei configuration file"),
|
||||
flagSet.BoolVarP(&options.FollowRedirects, "follow-redirects", "fr", false, "enable following redirects for http templates"),
|
||||
flagSet.IntVarP(&options.MaxRedirects, "max-redirects", "mr", 10, "max number of redirects to follow for http templates"),
|
||||
flagSet.StringVarP(&options.ReportingConfig, "report-config", "rc", "", "nuclei reporting module configuration file"), // TODO merge into the config file or rename to issue-tracking
|
||||
flagSet.StringSliceVarP(&options.CustomHeaders, "header", "H", []string{}, "custom headers in header:value format"),
|
||||
flagSet.RuntimeMapVarP(&options.Vars, "var", "V", []string{}, "custom vars in var=value format"),
|
||||
|
|
|
@ -31,6 +31,7 @@ var (
|
|||
Dialer *fastdialer.Dialer
|
||||
|
||||
rawHttpClient *rawhttp.Client
|
||||
forceMaxRedirects int
|
||||
poolMutex *sync.RWMutex
|
||||
normalClient *retryablehttp.Client
|
||||
clientPool map[string]*retryablehttp.Client
|
||||
|
@ -42,6 +43,9 @@ func Init(options *types.Options) error {
|
|||
if normalClient != nil {
|
||||
return nil
|
||||
}
|
||||
if options.FollowRedirects {
|
||||
forceMaxRedirects = options.MaxRedirects
|
||||
}
|
||||
poolMutex = &sync.RWMutex{}
|
||||
clientPool = make(map[string]*retryablehttp.Client)
|
||||
|
||||
|
@ -155,6 +159,10 @@ func wrappedGet(options *types.Options, configuration *Configuration) (*retryabl
|
|||
followRedirects := configuration.FollowRedirects
|
||||
maxRedirects := configuration.MaxRedirects
|
||||
|
||||
if forceMaxRedirects > 0 {
|
||||
followRedirects = true
|
||||
maxRedirects = forceMaxRedirects
|
||||
}
|
||||
// override connection's settings if required
|
||||
if configuration.Connection != nil {
|
||||
disableKeepAlives = configuration.Connection.DisableKeepAlive
|
||||
|
|
|
@ -119,6 +119,10 @@ type Options struct {
|
|||
// InteractionsCoolDownPeriod is additional seconds to wait for interactions after closing
|
||||
// of the poller.
|
||||
InteractionsCoolDownPeriod int
|
||||
// MaxRedirects is the maximum numbers of redirects to be followed.
|
||||
MaxRedirects int
|
||||
// FollowRedirects enables following redirects for http request module
|
||||
FollowRedirects bool
|
||||
// OfflineHTTP is a flag that specific offline processing of http response
|
||||
// using same matchers/extractors from http protocol without the need
|
||||
// to send a new request, reading responses from a file.
|
||||
|
|
Loading…
Reference in New Issue