# 5. DNS Enumeration

## 1. DNS Enumeration using zone transfer

### dig

find the nameserver of a domain

```
dig ns zonetransfer.me
```

<figure><img src="/files/9ub1Fx8AJ1Oh9WDcEISN" alt=""><figcaption></figcaption></figure>

Now try the zone transfer for the domain from its primary and secondary name servers

```
dig axfr zonetransfer.me @nsztm2.digi.ninja
```

<figure><img src="/files/Qch81cv4tkgecn5D0Hk1" alt=""><figcaption></figcaption></figure>

### nslookup

Fire up the tool on windows

```
nslookup
set querytype=soa
```

<figure><img src="/files/xOiBum2GGEtpx9qkdFXO" alt=""><figcaption></figcaption></figure>

Now execute the zone transfer

```
ls -d nsztm2.digi.ninja
```

## <mark style="color:red;">2. Zone transfer using DNSSEC transfer</mark>

{% embed url="<https://github.com/darkoperator/dnsrecon>" %}

```
./dnsrecon.py -d zonetransfer.me -z
```

{% hint style="info" %}
-d target domain

-z DNSSEC Zone walk
{% endhint %}

<figure><img src="/files/lroEbKwYXjD5cFAtL9ip" alt=""><figcaption></figcaption></figure>

**Other tools**

{% embed url="<https://github.com/davebarr/dnswalk>" %}

## <mark style="color:red;">3. DNS Enumeration using Nmap</mark>

```
nmap --script=broadcast-dns-service-discovery zonetransfer.me
```

<figure><img src="/files/hL5s0w16dV8yjRvjpXHW" alt=""><figcaption></figcaption></figure>

DNS brute forcing

```
nmap -T5 -p 53 --script dns-brute zonetransfer.me
```

<figure><img src="/files/c53HSy5UYchahgqnEDvd" alt=""><figcaption></figcaption></figure>

common service records

```
nmap --script dns-srv-enum --script-args "dns-srv-enum.domain='zonetransfer.me'"
```

{% embed url="<https://www.youtube.com/watch?v=PvDS1ZBFPwk&list=PL-Fa25Pu8l6wrp7rSDuZYRe1pbtmpEGa-&index=4&pp=gAQBiAQB>" %}

{% embed url="<https://youtu.be/sBq73tI9BKM>" %}

{% embed url="<https://www.udemy.com/course/ethical-hacker-practical/?referralCode=289CF01CF51246BCAD6C>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ceh-practical.cavementech.com/module-4.-enumeration/5.-dns-enumeration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
