From b7c7918cffbe68f97cee1d12e6d1dc22df0f5a5a Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Sat, 14 Sep 2024 04:57:14 +0700 Subject: [PATCH] refactor(runner): adjust `max-host-error` if gt `concurrency` Signed-off-by: Dwi Siswanto --- internal/runner/runner.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index b36d8ed584..e94b132df3 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -501,8 +501,17 @@ func (r *Runner) RunEnumeration() error { } if r.options.ShouldUseHostError() { - cache := hosterrorscache.New(r.options.MaxHostError, hosterrorscache.DefaultMaxHostsCount, r.options.TrackError) + maxHostError := r.options.MaxHostError + if r.options.TemplateThreads > maxHostError { + gologger.Print().Msgf("[%v] The concurrency value is higher than max-host-error", r.colorizer.BrightYellow("WRN")) + gologger.Info().Msg("Adjusting max-host-error to the concurrency value") + + maxHostError = r.options.TemplateThreads + } + + cache := hosterrorscache.New(maxHostError, hosterrorscache.DefaultMaxHostsCount, r.options.TrackError) cache.SetVerbose(r.options.Verbose) + r.hostErrors = cache executorOpts.HostErrorsCache = cache }