[Fix] Fixed multiline output when using only one fuzz variable (issue #645) (#656)

* Fixed incorrect len() in pkg/output/stdout.go::PrintResult()

* Fixed incorrect iteration on res.Input in pkg/output/stdout.go::prepareInputsOneLine(), Fixes #645

* Update CONTRIBUTORS.md

* Update pkg/output/stdout.go

---------

Co-authored-by: Joona Hoikkala <5235109+joohoi@users.noreply.github.com>
This commit is contained in:
Rémi GASCOU (Podalirius) 2023-04-21 16:22:09 +02:00 committed by GitHub
parent b2c1f9471f
commit 627c8710cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -37,6 +37,7 @@
* [noraj](https://pwn.by/noraj)
* [oh6hay](https://github.com/oh6hay)
* [penguinxoxo](https://github.com/penguinxoxo)
* [p0dalirius](https://github.com/p0dalirius)
* [putsi](https://github.com/putsi)
* [SakiiR](https://github.com/SakiiR)
* [seblw](https://github.com/seblw)

View file

@ -372,7 +372,7 @@ func (s *Stdoutput) PrintResult(res ffuf.Result) {
s.resultJson(res)
case s.config.Quiet:
s.resultQuiet(res)
case len(res.Input) > 1 || s.config.Verbose || len(s.config.OutputDirectory) > 0 || len(res.ScraperData) > 0:
case len(s.fuzzkeywords) > 1 || s.config.Verbose || len(s.config.OutputDirectory) > 0 || len(res.ScraperData) > 0:
// Print a multi-line result (when using multiple input keywords and wordlists)
s.resultMultiline(res)
default:
@ -382,22 +382,22 @@ func (s *Stdoutput) PrintResult(res ffuf.Result) {
func (s *Stdoutput) prepareInputsOneLine(res ffuf.Result) string {
inputs := ""
if len(res.Input) > 1 {
for k, v := range res.Input {
if ffuf.StrInSlice(k, s.config.CommandKeywords) {
if len(s.fuzzkeywords) > 1 {
for _, k := range s.fuzzkeywords {
if ffuf.StrInSlice(k, s.config.CommandKeywords) {
// If we're using external command for input, display the position instead of input
inputs = fmt.Sprintf("%s%s : %s ", inputs, k, strconv.Itoa(res.Position))
} else {
inputs = fmt.Sprintf("%s%s : %s ", inputs, k, v)
inputs = fmt.Sprintf("%s%s : %s ", inputs, k, res.Input[k])
}
}
} else {
for k, v := range res.Input {
if ffuf.StrInSlice(k, s.config.CommandKeywords) {
for _, k := range s.fuzzkeywords {
if ffuf.StrInSlice(k, s.config.CommandKeywords) {
// If we're using external command for input, display the position instead of input
inputs = strconv.Itoa(res.Position)
} else {
inputs = string(v)
inputs = string(res.Input[k])
}
}
}