# 05 - Cкан поддоменов

## Выбор инструмента

Поиск поддоменов расширяет периметр атаки и позволяет получить представление о цели. Можно воспользоваться онлайн сервисами (пассивный режим), которые периодически собирают такую информацию, например [shodan.io](https://reeves0x0.gitbook.io/linux-under-attack/scan/www.shodan.io), но я воспользуюсь активным режимом, то есть мы сами будем сканировать поддомены. Выбор инструмента является важной частью, я буду использовать [amass](https://github.com/owasp-amass/amass) ,  инструмент написан на Go, быстрый, имеет встроенный словарь, так же умеет рисовать графы.

```bash
// в обычном варианте (долго и лишь встроенным словарем) и вывод с файл
amass enum -d discord.com -o result.txt
// без брута, только свой словарь
amass enum -passive -aw SecLists/Discovery/DNS/subdomains-top1million-5000.txt -d discord.com
```

<figure><img src="/files/o6pVLjJPKyHalWmvjZ2E" alt=""><figcaption><p>Результат работы amass enum</p></figcaption></figure>

\
Ну или можно обойтись скриптом nmap, подробнее об этом методе написано [тут](https://nmap.org/nsedoc/scripts/dns-brute.html).

```bash
// скрипт + 6 потоков
nmap --script dns-brute --script-args dns-brute.domain=discord.com,dns-brute.threads=6,dns-brute 
```

Задачи по subdomain enumeration являются легкими, но долгими, лучше ставить на ночь. После чего все найденные поддомены можно ставить на скан диреторий сайта.<br>

```bash
// быстрый запрос поддоменов через сторонний сервис
curl -s 'https://crt.sh/?q=cia.gov&output=json' --compressed -H 'User-Agent: Mozilla/5.0'|jq -r '.[].common_name,.[].name_value'|sort -u
```


---

# 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://reeves0x0.gitbook.io/linux-under-attack/scan/05-ckan-poddomenov.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.
