projectdiscovery / cdncheck

A utility to detect various technology for a given IP address.
https://projectdiscovery.io
MIT License
747 stars 84 forks source link

Add support for ipv6 ranges #59

Open Mzack9999 opened 1 year ago

Mzack9999 commented 1 year ago

Description

Only ipv4 cidrs are supported via regex extraction

iamargus95 commented 1 year ago

@Mzack9999, Could you provide some examples of ipv6 addresses that I can put into test cases. I have a draft PR to which I'd like to add the test cases : Draft PR

brenocss commented 1 year ago

After Check() accepts IPv6, we could add something like this here. @tarunKoyalwar

https://github.com/projectdiscovery/cdncheck/blob/main/cdncheck.go#L119

    if dnsResponse.AAAA != nil {
        for _, ip := range dnsResponse.AAAA {
            ipAddr := net.ParseIP(ip)
            if ipAddr == nil {
                continue
            }
            matched, value, itemType, err := c.Check(ipAddr)
            if err != nil {
                return false, "", "", err
            }
            if matched {
                return matched, value, itemType, nil
            }
        }
    }