Skip to content

Commit

Permalink
Adding AAAA dns type for ipv6 (#1668)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzack9999 authored Apr 16, 2024
1 parent 49c93c6 commit 020d580
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
21 changes: 16 additions & 5 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1749,9 +1749,19 @@ retry:
if err != nil {
onlyHost = URL.Host
}
ips, cnames, err := getDNSData(hp, onlyHost)
allIps, cnames, err := getDNSData(hp, onlyHost)
if err != nil {
ips = append(ips, ip)
allIps = append(allIps, ip)
}

var ips4, ips6 []string
for _, ip := range allIps {
switch {
case iputil.IsIPv4(ip):
ips4 = append(ips4, ip)
case iputil.IsIPv6(ip):
ips6 = append(ips6, ip)
}
}

if scanopts.OutputCName && len(cnames) > 0 {
Expand Down Expand Up @@ -2041,7 +2051,8 @@ retry:
HTTP2: http2,
Method: method,
Host: ip,
A: ips,
A: ips4,
AAAA: ips6,
CNAMEs: cnames,
CDN: isCDN,
CDNName: cdnName,
Expand Down Expand Up @@ -2110,7 +2121,7 @@ func (r *Runner) handleFaviconHash(hp *httpx.HTTPX, req *retryablehttp.Request,
// search in the response of the requested path for element and rel shortcut/mask/apple-touch icon
// link with .ico extension (which will be prioritized if available)
// if not, any of link from other icons can be requested
potentialURLs, err := extractPotentialFavIconsURLs(req, currentResp)
potentialURLs, err := extractPotentialFavIconsURLs(currentResp)
if err != nil {
return "", "", err
}
Expand Down Expand Up @@ -2152,7 +2163,7 @@ func (r *Runner) calculateFaviconHashWithRaw(data []byte) (string, error) {
return fmt.Sprintf("%d", hashNum), nil
}

func extractPotentialFavIconsURLs(req *retryablehttp.Request, resp *httpx.Response) ([]string, error) {
func extractPotentialFavIconsURLs(resp *httpx.Response) ([]string, error) {
var potentialURLs []string
document, err := goquery.NewDocumentFromReader(bytes.NewReader(resp.Data))
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions runner/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type Result struct {
Jarm string `json:"jarm,omitempty" csv:"jarm"`
ChainStatusCodes []int `json:"chain_status_codes,omitempty" csv:"chain_status_codes"`
A []string `json:"a,omitempty" csv:"a"`
AAAA []string `json:"aaaa,omitempty" csv:"aaaa"`
CNAMEs []string `json:"cname,omitempty" csv:"cname"`
Technologies []string `json:"tech,omitempty" csv:"tech"`
Extracts map[string][]string `json:"extracts,omitempty" csv:"extracts"`
Expand Down

0 comments on commit 020d580

Please sign in to comment.