zdns icon indicating copy to clipboard operation
zdns copied to clipboard

Add NS followed by A lookup module

Open vishalmohanty opened this issue 3 years ago • 1 comments

This diff adds a module that does the following.

  • Does an NS lookup to get all nameservers for a domain.
  • Does an A and/or AAAA lookup based on the ipv4-lookup and ipv6-lookup flag respectively using each of the nameservers from the previous step.

Also added the UTs and Integration tests for the module.

vishalmohanty avatar Mar 03 '22 07:03 vishalmohanty

This is how the output looks like Format of every record:

name_server: {name_server_ip, name_server_name},
ipv4_addresses: []string,
ipv6_addresses: []string,
status: zdns.Status

Running it for zdns-testing:

{
    "data": {
        "ip_records": [
            {
                "ipv4_addresses": [
                    "1.2.3.4",
                    "2.3.4.5",
                    "3.4.5.6"
                ],
                "name_server": {
                    "ip": "216.239.34.108",
                    "name": "ns-cloud-c2.googledomains.com"
                },
                "status": "NOERROR"
            },
            {
                "name_server": {
                    "ip": "2001:4860:4802:34::6c",
                    "name": "ns-cloud-c2.googledomains.com"
                },
                "status": "ERROR"
            },
            {
                "ipv4_addresses": [
                    "3.4.5.6",
                    "1.2.3.4",
                    "2.3.4.5"
                ],
                "name_server": {
                    "ip": "216.239.38.108",
                    "name": "ns-cloud-c4.googledomains.com"
                },
                "status": "NOERROR"
            },
            {
                "name_server": {
                    "ip": "2001:4860:4802:38::6c",
                    "name": "ns-cloud-c4.googledomains.com"
                },
                "status": "ERROR"
            },
            {
                "ipv4_addresses": [
                    "2.3.4.5",
                    "1.2.3.4",
                    "3.4.5.6"
                ],
                "name_server": {
                    "ip": "216.239.32.108",
                    "name": "ns-cloud-c1.googledomains.com"
                },
                "status": "NOERROR"
            },
            {
                "name_server": {
                    "ip": "2001:4860:4802:32::6c",
                    "name": "ns-cloud-c1.googledomains.com"
                },
                "status": "ERROR"
            },
            {
                "ipv4_addresses": [
                    "1.2.3.4",
                    "2.3.4.5",
                    "3.4.5.6"
                ],
                "name_server": {
                    "ip": "216.239.36.108",
                    "name": "ns-cloud-c3.googledomains.com"
                },
                "status": "NOERROR"
            },
            {
                "name_server": {
                    "ip": "2001:4860:4802:36::6c",
                    "name": "ns-cloud-c3.googledomains.com"
                },
                "status": "ERROR"
            }
        ]
    },
    "name": "www.zdns-testing.com",
    "status": "NOERROR",
    "timestamp": "2022-03-02T23:18:47-08:00"
}

Note that IPv6 nameservers do not give any result somehow.

vishalmohanty avatar Mar 03 '22 07:03 vishalmohanty