* adding content-type to csv and json output (#336) * added to contributors and changelog * changed 'type' to 'content-type' * added content-type for html and md output * updated changelog Co-authored-by: layton <layton@desktop-manjaro.fritz.box> Co-authored-by: Joona Hoikkala <joohoi@users.noreply.github.com>
This commit is contained in:
parent
825bd3231d
commit
0c991947a7
@ -1,6 +1,7 @@
|
|||||||
## Changelog
|
## Changelog
|
||||||
- master
|
- master
|
||||||
- New
|
- New
|
||||||
|
- All output file formats now include the `Content-Type`.
|
||||||
- Changed
|
- Changed
|
||||||
|
|
||||||
- v1.2.1
|
- v1.2.1
|
||||||
|
|||||||
@ -29,3 +29,4 @@
|
|||||||
* [seblw](https://github.com/seblw)
|
* [seblw](https://github.com/seblw)
|
||||||
* [Shaked](https://github.com/Shaked)
|
* [Shaked](https://github.com/Shaked)
|
||||||
* [SolomonSklash](https://github.com/SolomonSklash)
|
* [SolomonSklash](https://github.com/SolomonSklash)
|
||||||
|
* [l4yton](https://github.com/l4yton)
|
||||||
|
|||||||
@ -13,6 +13,7 @@ type Response struct {
|
|||||||
ContentLength int64
|
ContentLength int64
|
||||||
ContentWords int64
|
ContentWords int64
|
||||||
ContentLines int64
|
ContentLines int64
|
||||||
|
ContentType string
|
||||||
Cancelled bool
|
Cancelled bool
|
||||||
Request *Request
|
Request *Request
|
||||||
Raw string
|
Raw string
|
||||||
@ -50,6 +51,7 @@ func NewResponse(httpresp *http.Response, req *Request) Response {
|
|||||||
var resp Response
|
var resp Response
|
||||||
resp.Request = req
|
resp.Request = req
|
||||||
resp.StatusCode = int64(httpresp.StatusCode)
|
resp.StatusCode = int64(httpresp.StatusCode)
|
||||||
|
resp.ContentType = httpresp.Header.Get("Content-Type")
|
||||||
resp.Headers = httpresp.Header
|
resp.Headers = httpresp.Header
|
||||||
resp.Cancelled = false
|
resp.Cancelled = false
|
||||||
resp.Raw = ""
|
resp.Raw = ""
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/ffuf/ffuf/pkg/ffuf"
|
"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 {
|
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.ContentLength, 10))
|
||||||
res = append(res, strconv.FormatInt(r.ContentWords, 10))
|
res = append(res, strconv.FormatInt(r.ContentWords, 10))
|
||||||
res = append(res, strconv.FormatInt(r.ContentLines, 10))
|
res = append(res, strconv.FormatInt(r.ContentLines, 10))
|
||||||
|
res = append(res, r.ContentType)
|
||||||
res = append(res, r.ResultFile)
|
res = append(res, r.ResultFile)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,7 +76,8 @@ const (
|
|||||||
<th>Position</th>
|
<th>Position</th>
|
||||||
<th>Length</th>
|
<th>Length</th>
|
||||||
<th>Words</th>
|
<th>Words</th>
|
||||||
<th>Lines</th>
|
<th>Lines</th>
|
||||||
|
<th>Type</th>
|
||||||
<th>Resultfile</th>
|
<th>Resultfile</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -84,7 +85,7 @@ const (
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{range $result := .Results}}
|
{{range $result := .Results}}
|
||||||
<div style="display:none">
|
<div style="display:none">
|
||||||
|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 }}|
|
||||||
</div>
|
</div>
|
||||||
<tr class="result-{{ $result.StatusCode }}" style="background-color: {{$result.HTMLColor}};">
|
<tr class="result-{{ $result.StatusCode }}" style="background-color: {{$result.HTMLColor}};">
|
||||||
<td><font color="black" class="status-code">{{ $result.StatusCode }}</font></td>
|
<td><font color="black" class="status-code">{{ $result.StatusCode }}</font></td>
|
||||||
@ -96,7 +97,8 @@ const (
|
|||||||
<td>{{ $result.Position }}</td>
|
<td>{{ $result.Position }}</td>
|
||||||
<td>{{ $result.ContentLength }}</td>
|
<td>{{ $result.ContentLength }}</td>
|
||||||
<td>{{ $result.ContentWords }}</td>
|
<td>{{ $result.ContentWords }}</td>
|
||||||
<td>{{ $result.ContentLines }}</td>
|
<td>{{ $result.ContentLines }}</td>
|
||||||
|
<td>{{ $result.ContentType }}</td>
|
||||||
<td>{{ $result.ResultFile }}</td>
|
<td>{{ $result.ResultFile }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ type JsonResult struct {
|
|||||||
ContentLength int64 `json:"length"`
|
ContentLength int64 `json:"length"`
|
||||||
ContentWords int64 `json:"words"`
|
ContentWords int64 `json:"words"`
|
||||||
ContentLines int64 `json:"lines"`
|
ContentLines int64 `json:"lines"`
|
||||||
|
ContentType string `json:"content-type"`
|
||||||
RedirectLocation string `json:"redirectlocation"`
|
RedirectLocation string `json:"redirectlocation"`
|
||||||
ResultFile string `json:"resultfile"`
|
ResultFile string `json:"resultfile"`
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
@ -74,6 +75,7 @@ func writeJSON(config *ffuf.Config, res []Result) error {
|
|||||||
ContentLength: r.ContentLength,
|
ContentLength: r.ContentLength,
|
||||||
ContentWords: r.ContentWords,
|
ContentWords: r.ContentWords,
|
||||||
ContentLines: r.ContentLines,
|
ContentLines: r.ContentLines,
|
||||||
|
ContentType: r.ContentType,
|
||||||
RedirectLocation: r.RedirectLocation,
|
RedirectLocation: r.RedirectLocation,
|
||||||
ResultFile: r.ResultFile,
|
ResultFile: r.ResultFile,
|
||||||
Url: r.Url,
|
Url: r.Url,
|
||||||
|
|||||||
@ -14,9 +14,9 @@ const (
|
|||||||
Command line : ` + "`{{.CommandLine}}`" + `
|
Command line : ` + "`{{.CommandLine}}`" + `
|
||||||
Time: ` + "{{ .Time }}" + `
|
Time: ` + "{{ .Time }}" + `
|
||||||
|
|
||||||
{{ range .Keys }}| {{ . }} {{ end }}| URL | Redirectlocation | Position | Status Code | Content Length | Content Words | Content Lines | ResultFile |
|
{{ range .Keys }}| {{ . }} {{ end }}| URL | Redirectlocation | Position | Status Code | Content Length | Content Words | Content Lines | Content Type | ResultFile |
|
||||||
{{ range .Keys }}| :- {{ end }}| :-- | :--------------- | :---- | :------- | :---------- | :------------- | :------------ | :--------- |
|
{{ range .Keys }}| :- {{ end }}| :-- | :--------------- | :---- | :------- | :---------- | :------------- | :------------ | :--------- | :----------- |
|
||||||
{{range .Results}}{{ range $keyword, $value := .Input }}| {{ $value | printf "%s" }} {{ end }}| {{ .Url }} | {{ .RedirectLocation }} | {{ .Position }} | {{ .StatusCode }} | {{ .ContentLength }} | {{ .ContentWords }} | {{ .ContentLines }} | {{ .ResultFile }} |
|
{{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
|
{{end}}` // The template format is not pretty but follows the markdown guide
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ type Result struct {
|
|||||||
ContentLength int64 `json:"length"`
|
ContentLength int64 `json:"length"`
|
||||||
ContentWords int64 `json:"words"`
|
ContentWords int64 `json:"words"`
|
||||||
ContentLines int64 `json:"lines"`
|
ContentLines int64 `json:"lines"`
|
||||||
|
ContentType string `json:"content-type"`
|
||||||
RedirectLocation string `json:"redirectlocation"`
|
RedirectLocation string `json:"redirectlocation"`
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
ResultFile string `json:"resultfile"`
|
ResultFile string `json:"resultfile"`
|
||||||
@ -301,6 +302,7 @@ func (s *Stdoutput) Result(resp ffuf.Response) {
|
|||||||
ContentLength: resp.ContentLength,
|
ContentLength: resp.ContentLength,
|
||||||
ContentWords: resp.ContentWords,
|
ContentWords: resp.ContentWords,
|
||||||
ContentLines: resp.ContentLines,
|
ContentLines: resp.ContentLines,
|
||||||
|
ContentType: resp.ContentType,
|
||||||
RedirectLocation: resp.GetRedirectLocation(false),
|
RedirectLocation: resp.GetRedirectLocation(false),
|
||||||
Url: resp.Request.Url,
|
Url: resp.Request.Url,
|
||||||
ResultFile: resp.ResultFile,
|
ResultFile: resp.ResultFile,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user