From e3e4e6250d1f541168a400bdaa48e111e435c3ec Mon Sep 17 00:00:00 2001 From: Joona Hoikkala <5235109+joohoi@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:04:20 +0300 Subject: [PATCH] Report if request times out while time matcher / filter is active (#722) * Report if request times out while time matcher / filter is active * Add changelog entry * Fix sprintf statement * Make linter happy --- CHANGELOG.md | 1 + pkg/ffuf/job.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13e3149..6789103 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fix csv output file format - Fixed divide by 0 error when setting rate limit to 0 manually. - Automatic brotli and deflate decompression + - Report if request times out when a time based matcher or filter is active - v2.0.0 - New diff --git a/pkg/ffuf/job.go b/pkg/ffuf/job.go index e80bddf..fdc8417 100644 --- a/pkg/ffuf/job.go +++ b/pkg/ffuf/job.go @@ -411,6 +411,28 @@ func (j *Job) runTask(input map[string][]byte, position int, retried bool) { } else { j.runTask(input, position, true) } + if os.IsTimeout(err) { + for name := range j.Config.MatcherManager.GetMatchers() { + if name == "time" { + inputmsg := "" + for k, v := range input { + inputmsg = inputmsg + fmt.Sprintf("%s : %s // ", k, v) + } + j.Output.Info("Timeout while 'time' matcher is active: " + inputmsg) + return + } + } + for name := range j.Config.MatcherManager.GetFilters() { + if name == "time" { + inputmsg := "" + for k, v := range input { + inputmsg = inputmsg + fmt.Sprintf("%s : %s // ", k, v) + } + j.Output.Info("Timeout while 'time' filter is active: " + inputmsg) + return + } + } + } return } if j.SpuriousErrorCounter > 0 {