mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 14:55:25 +00:00
boh - placing resize in wrapped method
This commit is contained in:
parent
620287f76b
commit
a140a4194e
@ -143,7 +143,7 @@ func (request *Request) execute(input *contextargs.Context, domain string, metad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
request.options.RateLimiter.Take()
|
request.options.RateLimitTake()
|
||||||
|
|
||||||
// Send the request to the target servers
|
// Send the request to the target servers
|
||||||
response, err := dnsClient.Do(compiledRequest)
|
response, err := dnsClient.Do(compiledRequest)
|
||||||
|
|||||||
@ -222,7 +222,7 @@ func (request *Request) executeParallelHTTP(input *contextargs.Context, dynamicV
|
|||||||
return
|
return
|
||||||
case spmHandler.ResultChan <- func() error {
|
case spmHandler.ResultChan <- func() error {
|
||||||
// putting ratelimiter here prevents any unnecessary waiting if any
|
// putting ratelimiter here prevents any unnecessary waiting if any
|
||||||
request.options.RateLimiter.Take()
|
request.options.RateLimitTake()
|
||||||
previous := make(map[string]interface{})
|
previous := make(map[string]interface{})
|
||||||
return request.executeRequest(input, httpRequest, previous, false, wrappedCallback, 0)
|
return request.executeRequest(input, httpRequest, previous, false, wrappedCallback, 0)
|
||||||
}():
|
}():
|
||||||
@ -366,7 +366,7 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa
|
|||||||
executeFunc := func(data string, payloads, dynamicValue map[string]interface{}) (bool, error) {
|
executeFunc := func(data string, payloads, dynamicValue map[string]interface{}) (bool, error) {
|
||||||
hasInteractMatchers := interactsh.HasMatchers(request.CompiledOperators)
|
hasInteractMatchers := interactsh.HasMatchers(request.CompiledOperators)
|
||||||
|
|
||||||
request.options.RateLimiter.Take()
|
request.options.RateLimitTake()
|
||||||
|
|
||||||
ctx := request.newContext(input)
|
ctx := request.newContext(input)
|
||||||
ctxWithTimeout, cancel := context.WithTimeout(ctx, time.Duration(request.options.Options.Timeout)*time.Second)
|
ctxWithTimeout, cancel := context.WithTimeout(ctx, time.Duration(request.options.Options.Timeout)*time.Second)
|
||||||
|
|||||||
@ -145,7 +145,7 @@ func (request *Request) executeGeneratedFuzzingRequest(gr fuzz.GeneratedRequest,
|
|||||||
if request.options.HostErrorsCache != nil && request.options.HostErrorsCache.Check(input.MetaInput.Input) {
|
if request.options.HostErrorsCache != nil && request.options.HostErrorsCache.Check(input.MetaInput.Input) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
request.options.RateLimiter.Take()
|
request.options.RateLimitTake()
|
||||||
req := &generatedRequest{
|
req := &generatedRequest{
|
||||||
request: gr.Request,
|
request: gr.Request,
|
||||||
dynamicValues: gr.DynamicValues,
|
dynamicValues: gr.DynamicValues,
|
||||||
|
|||||||
@ -128,6 +128,17 @@ type ExecutorOptions struct {
|
|||||||
ExportReqURLPattern bool
|
ExportReqURLPattern bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: centralizing components is not feasible with current clogged architecture
|
||||||
|
// a possible approach could be an internal event bus with pub-subs? This would be less invasive than
|
||||||
|
// reworking dep injection from scratch
|
||||||
|
func (eo *ExecutorOptions) RateLimitTake() {
|
||||||
|
if eo.RateLimiter.GetLimit() != uint(eo.Options.RateLimit) {
|
||||||
|
eo.RateLimiter.SetLimit(uint(eo.Options.RateLimit))
|
||||||
|
eo.RateLimiter.SetDuration(eo.Options.RateLimitDuration)
|
||||||
|
}
|
||||||
|
eo.RateLimiter.Take()
|
||||||
|
}
|
||||||
|
|
||||||
// GetThreadsForPayloadRequests returns the number of threads to use as default for
|
// GetThreadsForPayloadRequests returns the number of threads to use as default for
|
||||||
// given max-request of payloads
|
// given max-request of payloads
|
||||||
func (e *ExecutorOptions) GetThreadsForNPayloadRequests(totalRequests int, currentThreads int) int {
|
func (e *ExecutorOptions) GetThreadsForNPayloadRequests(totalRequests int, currentThreads int) int {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user