diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4996f85..446178f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
## Changelog
- master
- New
+ - All output file formats now include the `Content-Type`.
- Changed
- v1.2.1
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index c7a78ab..8d58d9d 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -29,3 +29,4 @@
* [seblw](https://github.com/seblw)
* [Shaked](https://github.com/Shaked)
* [SolomonSklash](https://github.com/SolomonSklash)
+* [l4yton](https://github.com/l4yton)
diff --git a/pkg/ffuf/response.go b/pkg/ffuf/response.go
index 7329f39..aecfd2f 100644
--- a/pkg/ffuf/response.go
+++ b/pkg/ffuf/response.go
@@ -13,6 +13,7 @@ type Response struct {
ContentLength int64
ContentWords int64
ContentLines int64
+ ContentType string
Cancelled bool
Request *Request
Raw string
@@ -50,6 +51,7 @@ func NewResponse(httpresp *http.Response, req *Request) Response {
var resp Response
resp.Request = req
resp.StatusCode = int64(httpresp.StatusCode)
+ resp.ContentType = httpresp.Header.Get("Content-Type")
resp.Headers = httpresp.Header
resp.Cancelled = false
resp.Raw = ""
diff --git a/pkg/output/file_csv.go b/pkg/output/file_csv.go
index 3024aab..1b304af 100644
--- a/pkg/output/file_csv.go
+++ b/pkg/output/file_csv.go
@@ -9,7 +9,7 @@ import (
"github.com/ffuf/ffuf/pkg/ffuf"
)
-var staticheaders = []string{"url", "redirectlocation", "position", "status_code", "content_length", "content_words", "content_lines", "resultfile"}
+var staticheaders = []string{"url", "redirectlocation", "position", "status_code", "content_length", "content_words", "content_lines", "content_type", "resultfile"}
func writeCSV(config *ffuf.Config, res []Result, encode bool) error {
@@ -68,6 +68,7 @@ func toCSV(r Result) []string {
res = append(res, strconv.FormatInt(r.ContentLength, 10))
res = append(res, strconv.FormatInt(r.ContentWords, 10))
res = append(res, strconv.FormatInt(r.ContentLines, 10))
+ res = append(res, r.ContentType)
res = append(res, r.ResultFile)
return res
}
diff --git a/pkg/output/file_html.go b/pkg/output/file_html.go
index ee5aa4d..2573724 100644
--- a/pkg/output/file_html.go
+++ b/pkg/output/file_html.go
@@ -76,7 +76,8 @@ const (
Position |
Length |
Words |
- Lines |
+ Lines |
+ Type |
Resultfile |
@@ -84,7 +85,7 @@ const (
{{range $result := .Results}}
-|result_raw|{{ $result.StatusCode }}{{ range $keyword, $value := $result.Input }}|{{ $value | printf "%s" }}{{ end }}|{{ $result.Url }}|{{ $result.RedirectLocation }}|{{ $result.Position }}|{{ $result.ContentLength }}|{{ $result.ContentWords }}|{{ $result.ContentLines }}|
+|result_raw|{{ $result.StatusCode }}{{ range $keyword, $value := $result.Input }}|{{ $value | printf "%s" }}{{ end }}|{{ $result.Url }}|{{ $result.RedirectLocation }}|{{ $result.Position }}|{{ $result.ContentLength }}|{{ $result.ContentWords }}|{{ $result.ContentLines }}|{{ $result.ContentType }}|
| {{ $result.StatusCode }} |
@@ -96,7 +97,8 @@ const (
{{ $result.Position }} |
{{ $result.ContentLength }} |
{{ $result.ContentWords }} |
- {{ $result.ContentLines }} |
+ {{ $result.ContentLines }} |
+ {{ $result.ContentType }} |
{{ $result.ResultFile }} |
{{ end }}
diff --git a/pkg/output/file_json.go b/pkg/output/file_json.go
index 604b4fc..5b95fbe 100644
--- a/pkg/output/file_json.go
+++ b/pkg/output/file_json.go
@@ -22,6 +22,7 @@ type JsonResult struct {
ContentLength int64 `json:"length"`
ContentWords int64 `json:"words"`
ContentLines int64 `json:"lines"`
+ ContentType string `json:"content-type"`
RedirectLocation string `json:"redirectlocation"`
ResultFile string `json:"resultfile"`
Url string `json:"url"`
@@ -74,6 +75,7 @@ func writeJSON(config *ffuf.Config, res []Result) error {
ContentLength: r.ContentLength,
ContentWords: r.ContentWords,
ContentLines: r.ContentLines,
+ ContentType: r.ContentType,
RedirectLocation: r.RedirectLocation,
ResultFile: r.ResultFile,
Url: r.Url,
diff --git a/pkg/output/file_md.go b/pkg/output/file_md.go
index 6e25b4a..9029d23 100644
--- a/pkg/output/file_md.go
+++ b/pkg/output/file_md.go
@@ -14,9 +14,9 @@ const (
Command line : ` + "`{{.CommandLine}}`" + `
Time: ` + "{{ .Time }}" + `
- {{ range .Keys }}| {{ . }} {{ end }}| URL | Redirectlocation | Position | Status Code | Content Length | Content Words | Content Lines | ResultFile |
- {{ range .Keys }}| :- {{ end }}| :-- | :--------------- | :---- | :------- | :---------- | :------------- | :------------ | :--------- |
- {{range .Results}}{{ range $keyword, $value := .Input }}| {{ $value | printf "%s" }} {{ end }}| {{ .Url }} | {{ .RedirectLocation }} | {{ .Position }} | {{ .StatusCode }} | {{ .ContentLength }} | {{ .ContentWords }} | {{ .ContentLines }} | {{ .ResultFile }} |
+ {{ range .Keys }}| {{ . }} {{ end }}| URL | Redirectlocation | Position | Status Code | Content Length | Content Words | Content Lines | Content Type | ResultFile |
+ {{ range .Keys }}| :- {{ end }}| :-- | :--------------- | :---- | :------- | :---------- | :------------- | :------------ | :--------- | :----------- |
+ {{range .Results}}{{ range $keyword, $value := .Input }}| {{ $value | printf "%s" }} {{ end }}| {{ .Url }} | {{ .RedirectLocation }} | {{ .Position }} | {{ .StatusCode }} | {{ .ContentLength }} | {{ .ContentWords }} | {{ .ContentLines }} | {{ .ContentType }} | {{ .ResultFile }} |
{{end}}` // The template format is not pretty but follows the markdown guide
)
diff --git a/pkg/output/stdout.go b/pkg/output/stdout.go
index 8de94a1..870ab19 100644
--- a/pkg/output/stdout.go
+++ b/pkg/output/stdout.go
@@ -36,6 +36,7 @@ type Result struct {
ContentLength int64 `json:"length"`
ContentWords int64 `json:"words"`
ContentLines int64 `json:"lines"`
+ ContentType string `json:"content-type"`
RedirectLocation string `json:"redirectlocation"`
Url string `json:"url"`
ResultFile string `json:"resultfile"`
@@ -301,6 +302,7 @@ func (s *Stdoutput) Result(resp ffuf.Response) {
ContentLength: resp.ContentLength,
ContentWords: resp.ContentWords,
ContentLines: resp.ContentLines,
+ ContentType: resp.ContentType,
RedirectLocation: resp.GetRedirectLocation(false),
Url: resp.Request.Url,
ResultFile: resp.ResultFile,