zmap / zdns

Fast DNS Lookup Library and CLI Tool
Apache License 2.0
939 stars 123 forks source link

Add NS followed by A lookup module #294

Closed vishalmohanty closed 15 hours ago

vishalmohanty commented 2 years ago

This diff adds a module that does the following.

Also added the UTs and Integration tests for the module.

vishalmohanty commented 2 years ago

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.