Skip to content

Commit

Permalink
Add extract-fqdn option
Browse files Browse the repository at this point in the history
  • Loading branch information
RamanaReddy0M committed May 30, 2024
1 parent 91afa0c commit ff262a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/httpx/csp.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var CSPHeaders = []string{

// CSPData contains the Content-Security-Policy domain list
type CSPData struct {
Fqdns []string `json:"fqdns,omitempty"`
Fqdns []string `json:"fqdn,omitempty"`
Domains []string `json:"domains,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ type Options struct {
OutputContentType bool
OutputIP bool
OutputCName bool
ExtractFqdn bool
Unsafe bool
Debug bool
DebugRequests bool
Expand Down Expand Up @@ -335,6 +336,7 @@ func ParseOptions() *Options {
flagSet.BoolVar(&options.OutputWebSocket, "websocket", false, "display server using websocket"),
flagSet.BoolVar(&options.OutputIP, "ip", false, "display host ip"),
flagSet.BoolVar(&options.OutputCName, "cname", false, "display host cname"),
flagSet.BoolVarP(&options.ExtractFqdn, "efqdn", "extract-fqdn", false, "get domain and subdomains from response body and header in jsonl/csv output"),
flagSet.BoolVar(&options.Asn, "asn", false, "display host asn information"),
flagSet.DynamicVar(&options.OutputCDN, "cdn", "true", "display cdn/waf in use"),
flagSet.BoolVar(&options.Probe, "probe", false, "display probe status"),
Expand Down
6 changes: 5 additions & 1 deletion runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,11 @@ func (r *Runner) RunEnumeration() {
if r.options.OnResult != nil {
r.options.OnResult(resp)
}

// Set body domains and fqdns
if r.options.ExtractFqdn && resp.CSPData != nil {
resp.BodyDomains = resp.CSPData.Domains
resp.BodyFqdns = resp.CSPData.Fqdns
}
// store responses or chain in directory
URL, _ := urlutil.Parse(resp.URL)
domainFile := resp.Method + ":" + URL.EscapedString()
Expand Down
2 changes: 2 additions & 0 deletions runner/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type Result struct {
ASN *AsnResponse `json:"asn,omitempty" csv:"asn"`
Err error `json:"-" csv:"-"`
CSPData *httpx.CSPData `json:"csp,omitempty" csv:"csp"`
BodyFqdns []string `json:"body_fqdn,omitempty" csv:"body_fqdn"`
BodyDomains []string `json:"body_domains,omitempty" csv:"body_domains"`
TLSData *clients.Response `json:"tls,omitempty" csv:"tls"`
Hashes map[string]interface{} `json:"hash,omitempty" csv:"hash"`
ExtractRegex []string `json:"extract_regex,omitempty" csv:"extract_regex"`
Expand Down

0 comments on commit ff262a0

Please sign in to comment.