Читать книгу Kali Linux Penetration Testing Bible - Gus Khawaja - Страница 60

DNS

Оглавление

The Domain Name System (DNS) translates domain names into IP addresses. For example, instead of typing https://172.217.13.132 , you simply type https://google.com. The question is, how did I come up with the IP address? Use the host command on your terminal window:

$host [domain name] root@kali:/# host google.com google.com has address 172.217.13.174 google.com has IPv6 address 2607:f8b0:4020:806::200e google.com mail is handled by 40 alt3.aspmx.l.google.com. google.com mail is handled by 30 alt2.aspmx.l.google.com. google.com mail is handled by 10 aspmx.l.google.com. google.com mail is handled by 50 alt4.aspmx.l.google.com. google.com mail is handled by 20 alt1.aspmx.l.google.com.

The DNS is divided into two categories: public and private (like the IP addresses). The Google DNS address is public so that anyone connected to the internet can reach Google's website.

On the other hand, we can have private DNS for our local intranet. This can be set up using a DNS server (e.g., Microsoft Windows Server) or your router if it has a built‐in DNS server. In my home network, I defined a domain called ksec.local . Each host on the network will have a domain name that corresponds to its IP address. For example, my file server domain name is ds‐server.ksec.local (because the server hostname is ds‐server ), and the router/DNS server will manage all the DNS A records (an A record is a mapping between IPv4 addresses and domain names):

root@kali:~# host ds-server.ksec.local ds-server.ksec.local has address 10.0.0.177

If you specify a nonexisting DNS record, you will get an error message (this is useful to brute‐force the DNS records):

root@kali:~# host hello.ksec.local Host hello.ksec.local not found: 3(NXDOMAIN)

Take note that you can add your own static DNS records inside your Kali host. The file is located at /etc/hosts , and here you can redirect any domain name to any live IP address. (This is how DNS poisoning works; the hacker will manipulate the A records to point to his server IP address.)

root@kali:~# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 kali # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters

You'll learn more about this subject later in this book, and you will learn how DNS brute‐forcing and zone transfers work.

Kali Linux Penetration Testing Bible

Подняться наверх