boh - placing resize in wrapped method

dev
Mzack9999 2024-04-03 19:40:09 +02:00
parent 620287f76b
commit a140a4194e
4 changed files with 15 additions and 4 deletions

View File

@ -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
response, err := dnsClient.Do(compiledRequest)

View File

@ -222,7 +222,7 @@ func (request *Request) executeParallelHTTP(input *contextargs.Context, dynamicV
return
case spmHandler.ResultChan <- func() error {
// putting ratelimiter here prevents any unnecessary waiting if any
request.options.RateLimiter.Take()
request.options.RateLimitTake()
previous := make(map[string]interface{})
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) {
hasInteractMatchers := interactsh.HasMatchers(request.CompiledOperators)
request.options.RateLimiter.Take()
request.options.RateLimitTake()
ctx := request.newContext(input)
ctxWithTimeout, cancel := context.WithTimeout(ctx, time.Duration(request.options.Options.Timeout)*time.Second)

View File

@ -145,7 +145,7 @@ func (request *Request) executeGeneratedFuzzingRequest(gr fuzz.GeneratedRequest,
if request.options.HostErrorsCache != nil && request.options.HostErrorsCache.Check(input.MetaInput.Input) {
return false
}
request.options.RateLimiter.Take()
request.options.RateLimitTake()
req := &generatedRequest{
request: gr.Request,
dynamicValues: gr.DynamicValues,

View File

@ -128,6 +128,17 @@ type ExecutorOptions struct {
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
// given max-request of payloads
func (e *ExecutorOptions) GetThreadsForNPayloadRequests(totalRequests int, currentThreads int) int {