• DNS Reconnaissance and whois | 93
  • Learning Kali Linux




    Download 22,59 Mb.
    Pdf ko'rish
    bet93/225
    Sana14.05.2024
    Hajmi22,59 Mb.
    #232856
    1   ...   89   90   91   92   93   94   95   96   ...   225
    Bog'liq
    learningkalilinux

    Using nslookup and dig
    One tool we can use to query DNS servers is 
    nslookup

    nslookup
    will issue queries
    against the DNS server you have configured, if you don’t otherwise tell it to use a dif‐
    ferent server. In 
    Example 3-9
    , you can see an example of using 
    nslookup
    to query my
    local DNS server. In the response, you will see that what we got back was a non-
    authoritative answer. You can see the name server that was used for the lookup.
    Example 3-9. Using nslookup
    root@rosebud:~# nslookup www.oreilly.com
    Server:
    192.168.86.1
    Address: 
    192.168.86.1#53
    Non-authoritative answer:
    DNS Reconnaissance and whois | 93


    www.oreilly.com canonical 
    name
    =
    www.oreilly.com.edgekey.net.
    www.oreilly.com.edgekey.net 
    canonical 
    name
    =
    e4619.g.akamaiedge.net.
    Name: 
    e4619.g.akamaiedge.net
    Address: 23.79.209.167
    In that request, the local server has provided an answer to us, but it’s telling us that it’s
    a nonauthoritative answer. What we got back for this FQDN is a series of aliases cul‐
    minating in the IP address, after all the aliases have been unwound. To get an authori‐
    tative response, we need to ask the authoritative name server for the domain. To do
    that, we can use another utility that will do DNS lookups. We’ll use the program 
    dig
    and ask it for the name server record. You can see that in 
    Example 3-10
    .
    Example 3-10. Using dig
    root@rosebud:~# dig ns oreilly.com
    ; <<>> DiG 9.10.6-Debian <<>> ns oreilly.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER
    <<- opco
    de: QUERY, status: NOERROR, id: 56163
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 512
    ;; QUESTION SECTION:
    ;oreilly.com. 
    IN 
    NS
    ;; ANSWER SECTION:
    oreilly.com. 
    3599 
    IN 
    NS 
    a20-66.akam.net.
    oreilly.com. 
    3599 
    IN 
    NS 
    a13-64.akam.net.
    oreilly.com. 
    3599 
    IN 
    NS 
    a3-67.akam.net.
    oreilly.com. 
    3599 
    IN 
    NS 
    a1-225.akam.net.
    oreilly.com. 
    3599 
    IN 
    NS 
    a4-64.akam.net.
    oreilly.com. 
    3599 
    IN 
    NS 
    a16-65.akam.net.
    At this point, we could continue to use 
    dig
    , but we’ll go back to using 
    nslookup
    just to
    see clearly the differences in the results. When we run 
    nslookup
    again, we specify the
    server we are going to query. In this case, we’re going to use one of the name servers
    listed in 
    Example 3-10
    . We do that by appending the name server we want to ask to
    the end of the line we were using before. You can see how this works in 
    Example 3-11
    .
    Example 3-11. Using nslookup and specifying the DNS server
    root@rosebud:~# nslookup www.oreilly.com a20-66.akam.net
    Server:
    a20-66.akam.net
    Address: 
    95.100.175.66#53
    www.oreilly.com canonical 
    name
    =
    www.oreilly.com.edgekey.net.

    Download 22,59 Mb.
    1   ...   89   90   91   92   93   94   95   96   ...   225




    Download 22,59 Mb.
    Pdf ko'rish