dnsx icon indicating copy to clipboard operation
dnsx copied to clipboard

Cdn check with domain and with dns response

Open brenocss opened this issue 2 years ago • 3 comments
trafficstars

I have modified the cdncheck function to accept domains However, I believe it is better to use the second function that was created, which takes a dnsResponse as input. This reduces the number of DNS requests.

brenocss avatar May 19 '23 16:05 brenocss

echo www.gap.com | ./dnsx -cdn -json | jq

      _             __  __
   __| | _ __   ___ \ \/ /
  / _' || '_ \ / __| \  /
 | (_| || | | |\__ \ /  \
  \__,_||_| |_||___//_/\_\

                projectdiscovery.io

[INF] Current dnsx version 1.1.4 (latest)
{
  "host": "www.gap.com",
  "ttl": 2795,
  "resolver": [
    "1.0.0.1:53"
  ],
  "a": [
    "104.104.158.228"
  ],
  "cname": [
    "www.gap.com.edgekey.net",
    "e12405.x.akamaiedge.net"
  ],
  "all": [
    "www.gap.com.\t2795\tIN\tCNAME\twww.gap.com.edgekey.net.",
    "www.gap.com.edgekey.net.\t20795\tIN\tCNAME\te12405.x.akamaiedge.net.",
    "e12405.x.akamaiedge.net.\t20\tIN\tA\t104.104.158.228",
    "\n;; OPT PSEUDOSECTION:\n; EDNS: version 0; flags:; udp: 1232"
  ],
  "status_code": "NOERROR",
  "timestamp": "2023-05-19T13:24:09.8923071-03:00",
  "cdn": true,
  "cdn-name": "akamai"
}

brenocss avatar May 19 '23 16:05 brenocss

This fixes a bug as well where a site use multi-cdn's. The first DNS query will pickup one CDN response, while that second call to CdnCheck will generate a possibly different CDN. So the CDN in the main response will say one, while the "cdn-name" parameter will contain a different one. So 👍 👍 If the request doesn't contain the A/AAAA records, you may still need to generate that second query as mentioned in the question above. I don't think you can avoid the issue in that case.

sleach avatar Jul 28 '23 22:07 sleach

@Mzack9999 did you find this use case?

brenocss avatar Jul 31 '23 19:07 brenocss