fix csv output file format (#683)

* fix csv output file format

* Add my username to the CONTRIBUTORS.md

---------

Co-authored-by: Joona Hoikkala <5235109+joohoi@users.noreply.github.com>
This commit is contained in:
serg 2023-09-13 11:39:12 +03:00 committed by GitHub
parent 6f29907b4f
commit 9f2163acd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -5,7 +5,9 @@
- Changed
- Explicitly allow TLS1.0
- Fix markdown output file format
- Fix csv output file format
- Fixed divide by 0 error when setting rate limit to 0 manually.
- v2.0.0
- New

View file

@ -17,6 +17,7 @@
* [Ephex2](https://github.com/Ephex2)
* [erbbysam](https://github.com/erbbysam)
* [eur0pa](https://github.com/eur0pa)
* [gserrg](https://github.com/gserrg)
* [fabiobauer](https://github.com/fabiobauer)
* [fang0654](https://github.com/fang0654)
* [haseobang](https://github.com/haseobang)

View file

@ -9,7 +9,7 @@ import (
"github.com/ffuf/ffuf/v2/pkg/ffuf"
)
var staticheaders = []string{"url", "redirectlocation", "position", "status_code", "content_length", "content_words", "content_lines", "content_type", "duration", "resultfile"}
var staticheaders = []string{"url", "redirectlocation", "position", "status_code", "content_length", "content_words", "content_lines", "content_type", "duration", "resultfile", "Ffufhash"}
func writeCSV(filename string, config *ffuf.Config, res []ffuf.Result, encode bool) error {
header := make([]string, 0)
@ -53,8 +53,13 @@ func base64encode(in []byte) string {
func toCSV(r ffuf.Result) []string {
res := make([]string, 0)
for _, v := range r.Input {
res = append(res, string(v))
ffufhash := ""
for k, v := range r.Input {
if k == "FFUFHASH" {
ffufhash = string(v)
} else {
res = append(res, string(v))
}
}
res = append(res, r.Url)
res = append(res, r.RedirectLocation)
@ -66,5 +71,6 @@ func toCSV(r ffuf.Result) []string {
res = append(res, r.ContentType)
res = append(res, r.Duration.String())
res = append(res, r.ResultFile)
res = append(res, ffufhash)
return res
}