Add Host information to JSON output file (#223)

This commit is contained in:
Joona Hoikkala 2020-04-23 00:53:28 +03:00 committed by GitHub
parent 88720dfdc9
commit 08ec6bad2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 4 deletions

View file

@ -11,6 +11,7 @@
- Changed
- Added tls renegotiation flag to fix #193 in http.Client
- Fixed HTML report to display select/combo-box for rows per page (and increased default from 10 to 250 rows).
- Added Host information to JSON output file
- v1.0.2
- Changed

View file

@ -3,6 +3,7 @@ package ffuf
// Request holds the meaningful data that is passed for runner for making the query
type Request struct {
Method string
Host string
Url string
Headers map[string]string
Data []byte

View file

@ -9,9 +9,10 @@ import (
)
type ejsonFileOutput struct {
CommandLine string `json:"commandline"`
Time string `json:"time"`
Results []Result `json:"results"`
CommandLine string `json:"commandline"`
Time string `json:"time"`
Results []Result `json:"results"`
Config *ffuf.Config `json:"config"`
}
type JsonResult struct {
@ -24,6 +25,7 @@ type JsonResult struct {
RedirectLocation string `json:"redirectlocation"`
ResultFile string `json:"resultfile"`
Url string `json:"url"`
Host string `json:"host"`
}
type jsonFileOutput struct {
@ -70,6 +72,7 @@ func writeJSON(config *ffuf.Config, res []Result) error {
RedirectLocation: r.RedirectLocation,
ResultFile: r.ResultFile,
Url: r.Url,
Host: r.Host,
})
}
outJSON := jsonFileOutput{

View file

@ -39,6 +39,7 @@ type Result struct {
RedirectLocation string `json:"redirectlocation"`
Url string `json:"url"`
ResultFile string `json:"resultfile"`
Host string `json:"host"`
HTMLColor string `json:"-"`
}
@ -57,7 +58,7 @@ func (s *Stdoutput) Banner() error {
// Print wordlists
for _, provider := range s.config.InputProviders {
if provider.Name == "wordlist" {
printOption([]byte("Wordlist"), []byte(provider.Keyword + ": " + provider.Value))
printOption([]byte("Wordlist"), []byte(provider.Keyword+": "+provider.Value))
}
}
@ -302,6 +303,7 @@ func (s *Stdoutput) Result(resp ffuf.Response) {
RedirectLocation: resp.GetRedirectLocation(false),
Url: resp.Request.Url,
ResultFile: resp.ResultFile,
Host: resp.Request.Host,
}
s.Results = append(s.Results, sResult)
}

View file

@ -106,6 +106,8 @@ func (r *SimpleRunner) Execute(req *ffuf.Request) (ffuf.Response, error) {
if _, ok := req.Headers["Host"]; ok {
httpreq.Host = req.Headers["Host"]
}
req.Host = httpreq.Host
httpreq = httpreq.WithContext(r.config.Context)
for k, v := range req.Headers {
httpreq.Header.Set(k, v)