Fix md output format (#672)

* Fix MD output

* Add CHANGELOG.md entry
This commit is contained in:
Joona Hoikkala 2023-04-21 18:19:18 +03:00 committed by GitHub
parent e979f72229
commit 5fd821c17d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -3,6 +3,7 @@
- New
- Changed
- Explicitly allow TLS1.0
- Fix markdown output file format
- v2.0.0
- New

View file

@ -14,9 +14,9 @@ const (
Command line : ` + "`{{.CommandLine}}`" + `
Time: ` + "{{ .Time }}" + `
{{ range .Keys }}| {{ . }} {{ end }}| URL | Redirectlocation | Position | Status Code | Content Length | Content Words | Content Lines | Content Type | Duration | ResultFile | ScraperData
{{ range .Keys }}| :- {{ end }}| :-- | :--------------- | :---- | :------- | :---------- | :------------- | :------------ | :--------- | :----------- | :------------ |
{{range .Results}}{{ range $keyword, $value := .Input }}| {{ $value | printf "%s" }} {{ end }}| {{ .Url }} | {{ .RedirectLocation }} | {{ .Position }} | {{ .StatusCode }} | {{ .ContentLength }} | {{ .ContentWords }} | {{ .ContentLines }} | {{ .ContentType }} | {{ .Duration}} | {{ .ResultFile }} | {{ .ScraperData }} |
{{ range .Keys }}| {{ . }} {{ end }}| URL | Redirectlocation | Position | Status Code | Content Length | Content Words | Content Lines | Content Type | Duration | ResultFile | ScraperData | Ffufhash
{{ range .Keys }}| :- {{ end }}| :-- | :--------------- | :---- | :------- | :---------- | :------------- | :------------ | :--------- | :----------- | :------------ | :-------- |
{{range .Results}}{{ range $keyword, $value := .Input }}| {{ $value | printf "%s" }} {{ end }}| {{ .Url }} | {{ .RedirectLocation }} | {{ .Position }} | {{ .StatusCode }} | {{ .ContentLength }} | {{ .ContentWords }} | {{ .ContentLines }} | {{ .ContentType }} | {{ .Duration}} | {{ .ResultFile }} | {{ .ScraperData }} | {{ .FfufHash }}
{{end}}` // The template format is not pretty but follows the markdown guide
)
@ -30,10 +30,15 @@ func writeMarkdown(filename string, config *ffuf.Config, results []ffuf.Result)
htmlResults := make([]htmlResult, 0)
ffufhash := ""
for _, r := range results {
strinput := make(map[string]string)
for k, v := range r.Input {
strinput[k] = string(v)
if k == "FFUFHASH" {
ffufhash = string(v)
} else {
strinput[k] = string(v)
}
}
strscraper := ""
for k, v := range r.ScraperData {
@ -64,6 +69,7 @@ func writeMarkdown(filename string, config *ffuf.Config, results []ffuf.Result)
ResultFile: r.ResultFile,
Url: r.Url,
Host: r.Host,
FfufHash: ffufhash,
}
htmlResults = append(htmlResults, hres)
}