# Active

<table><thead><tr><th width="151">Tools</th><th>Details</th></tr></thead><tbody><tr><td><a href="https://github.com/RedSiege/EyeWitness">EyeWitness</a></td><td>Designed to take screenshots of websites provide some server header info, and identify default credentials if known.<br><code>eyewitness --web -x &#x3C;nmap_scan>.xml -d &#x3C;output_name></code> <br><code>eyewitness --web -x &#x3C;nessus_scan>.xml -d &#x3C;output_name></code><br><code>eyewitness -f &#x3C;subdomains> -d &#x3C;output_name></code></td></tr><tr><td><a href="https://github.com/michenriksen/aquatone">Aquatone</a> (<a href="https://github.com/shelld3v/aquatone">new</a>)</td><td>Tool for visual inspection of websites across a large amount of hosts and is convenient for quickly gaining an overview of HTTP-based attack surface.<br><code>cat &#x3C;nmap_scan>.xml | ./aquatone -nmap</code></td></tr></tbody></table>

## Automated

* [AutoRecon](https://github.com/Tib3rius/AutoRecon)
* [reconftw](https://github.com/six2dez/reconftw)
* [nmapAutomator](https://github.com/21y4d/nmapAutomator)
* [FinalRecon](https://github.com/thewhiteh4t/FinalRecon)
* [magicRecon](https://github.com/robotshell/magicRecon)

***

## Infrastructure

### Technology Stack

{% tabs %}
{% tab title="Tools" %}

<table><thead><tr><th width="161">Tool</th><th>Details</th></tr></thead><tbody><tr><td><a href="https://github.com/urbanadventurer/WhatWeb">whatweb</a></td><td><code>whatweb -v &#x3C;DOMAIN></code><br><code>whatweb -v -a &#x3C;LEVEL_AGGRESSIVE> &#x3C;DOMAIN></code></td></tr></tbody></table>
{% endtab %}

{% tab title="Website" %}

<table><thead><tr><th width="183">Website</th><th>Details</th></tr></thead><tbody><tr><td><a href="https://www.wappalyzer.com/">Wappalyzer</a></td><td>Option to intall it as a browser extension.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

### WAF

<table><thead><tr><th width="162">Tool</th><th>Details</th></tr></thead><tbody><tr><td><a href="https://github.com/EnableSecurity/wafw00f">wafw00f</a></td><td>Allows one to identify and fingerprint Web Application Firewall (WAF) products protecting a website.<br><code>wafw00f -v -a &#x3C;DOMAIN></code></td></tr></tbody></table>

## DNS Subdomain & Vhost

<table><thead><tr><th width="151">Tool</th><th>Details</th></tr></thead><tbody><tr><td><a href="https://github.com/darkoperator/dnsrecon">dnsrecon</a></td><td>Script for DNS info and specific scans<br><code>dnsrecon -d &#x3C;DOMAIN> [-n &#x3C;SERVER_DNS>]</code><br><code>dnsrecon -d &#x3C;DOMAIN> -D &#x3C;WORDLIST> -t brt</code> (bruteforce)<br><code>dnsrecon -d &#x3C;DOMAIN> -r &#x3C;RANGE></code> (reverse lookup)</td></tr><tr><td><a href="https://github.com/SparrowOchon/dnsenum2">dnsenum</a></td><td>Script that autoenumerates DNS subdomain <br><code>dnsenum &#x3C;DOMAIN> [--dnsserver &#x3C;SERVER_DNS>]</code> </td></tr><tr><td><a href="https://github.com/OJ/gobuster">gobuster <strong>dns</strong></a></td><td>Bruteforce subdomain<br><code>gobuster dns [--resolver &#x3C;SERVER_DNS>] -do &#x3C;DOMAIN> -w &#x3C;WORDLIST> -ne</code></td></tr><tr><td><a href="https://github.com/ffuf/ffuf">ffuf</a></td><td>Try to find Vhost<br><code>ffuf -c -w &#x3C;WORDLIST>:X -u http://X.&#x3C;DOMAIN>/</code> <br><code>ffuf -c -w &#x3C;WORDLIST>:X -u http://&#x3C;IP:PORT or DOMAIN>/ -H 'Host: X.&#x3C;DOMAIN>'</code></td></tr><tr><td><a href="https://github.com/TheRook/subbrute">subbrute</a></td><td>Create the list with own NameServers/Domain <em>(ex., myResolver.txt)</em> <br><code>subbrute.py -r myResolver.txt &#x3C;DOMAIN> [-s &#x3C;WORDLIST>]</code></td></tr></tbody></table>

### Zone Transfer

Zone Transfer is how a secondary (slave) DNS server receives information from the primary (master) DNS server and updates it. The primary DNS server may not be configured correctly. If we can successfully perform a zone transfer for a domain, we will get all the information available for that domain.&#x20;

1. Need to find all possible Subdomains and Name Servers.
2. Need to perform Asynchronous Full Transfer Zone (**AXFR**) queries on each element found at 1.

{% tabs %}
{% tab title="Tools" %}
Other tools such as [dnsrecon](https://github.com/darkoperator/dnsrecon) and [dnsenum](https://github.com/SparrowOchon/dnsenum2) already perform zone transfer checks.

<table><thead><tr><th width="157">Tool</th><th>Details</th></tr></thead><tbody><tr><td>host</td><td><code>host -l &#x3C;DOMAIN> &#x3C;SERVER_DNS></code></td></tr><tr><td>nslookup</td><td><code>nslookup -type=any -query=AXFR &#x3C;DOMAIN> &#x3C;SERVER_DNS></code></td></tr><tr><td>dig</td><td><code>dig axfr @&#x3C;SERVER_DNS> &#x3C;DOMAIN></code></td></tr></tbody></table>
{% endtab %}

{% tab title="Website" %}

<table><thead><tr><th width="183">Website</th><th>Details</th></tr></thead><tbody><tr><td><a href="https://hackertarget.com/zone-transfer/">HackerTarget</a></td><td>Online Test for open Zone Transfer.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Port & Host scanning

Finding the active host and ports for then proceeding with **services enumeration**.

{% tabs %}
{% tab title="Host" %}

### [nmap](https://nmap.org/docs.html)

`ARP` on the same subnet, otherwise `ICMP`

<table><thead><tr><th width="295">Command</th><th>Description</th></tr></thead><tbody><tr><td><code>nmap -sn &#x3C;NETWORK></code></td><td>Host discovery, no port scan.</td></tr><tr><td><code>nmap -iL &#x3C;FILE></code></td><td>Input from list of hosts/networks</td></tr><tr><td><code>nmap -sn -PE/-PS/-PA/-PU &#x3C;NETWORK></code></td><td><strong>ICMP</strong>/<strong>TCP-SYN</strong>/<strong>TCP-ACK</strong>/<strong>UDP</strong> scan.</td></tr><tr><td><code>--disable-arp-ping</code></td><td>Disable ARP.</td></tr><tr><td><code>--packet-trace, --reason</code></td><td>For investigating.</td></tr></tbody></table>

#### Ping Sweep&#x20;

Do this at least twice to be sure.

<table><thead><tr><th width="181">Terminal</th><th>Details</th></tr></thead><tbody><tr><td>Linux</td><td><code>for i in {1..254} ;do (ping -c 1 X.X.X.$i | grep "bytes from" &#x26;) ;done</code></td></tr><tr><td>CMD</td><td><code>for /L %i in (1 1 254) do ping X.X.X.%i -n 1 -w 100 | find "Reply"</code></td></tr><tr><td>PowerShell</td><td><code>1..254 | % {"172.15.5.$($): $(Test-Connection -count 1 -comp 172.15.5.$($) -quiet)"}</code></td></tr></tbody></table>
{% endtab %}

{% tab title="Port" %}

### [nmap](https://nmap.org/docs.html)

<table><thead><tr><th width="325">Command</th><th>Description</th></tr></thead><tbody><tr><td><code>nmap -Pn -n &#x3C;IP></code></td><td>NO host scan and NO DNS resolution.</td></tr><tr><td><code>sudo nmap -sS &#x3C;IP></code></td><td><strong>SYN</strong> scan (default with sudo).</td></tr><tr><td><code>nmap -sT &#x3C;IP></code></td><td><strong>CONNECT</strong> scan (default without sudo).</td></tr><tr><td><code>sudo nmap -sA &#x3C;IP></code></td><td><strong>ACK</strong> scan.</td></tr><tr><td><code>sudo nmap -sU [--open] &#x3C;IP></code></td><td><strong>UDP</strong> scan.</td></tr><tr><td><strong><code>-v</code></strong></td><td>Show open ports as soon as it reveals them.</td></tr><tr><td><code>-T&#x3C;1-5> -sV -sC -O</code></td><td>Speed, Version, Default Script, OS</td></tr><tr><td><code>-A</code></td><td>sV + sC + O</td></tr><tr><td><code>--source-port</code></td><td>Possibile bypass firewall <em>(ex. 53)</em></td></tr><tr><td><em><mark style="color:blue;"><code>/usr/share/nmap/scripts/</code></mark></em> <br><code>nmap --script-updatedb</code><br><code>nmap --script--help &#x3C;SCRIPT></code><br><code>nmap --script "&#x3C;SCRIPT or TYPE>" &#x3C;IP></code></td><td>Scripts for enumeration and attack of services. (<a href="https://nmap.org/book/nse-usage.html#nse-categories"><strong>LINK</strong></a>)</td></tr><tr><td><code>nmap -oN &#x3C;NAME> &#x3C;IP></code> <br><code>nmap -oX &#x3C;NAME> &#x3C;IP></code><br><code>nmap -oG &#x3C;NAME> &#x3C;IP></code> <br><code>nmap -oA &#x3C;NAME> &#x3C;IP></code></td><td>TXT format, <code>.nmap</code><br>XML format, <code>.xml</code><br>Grepable format, <code>.gnmap</code><br>All format.</td></tr><tr><td><code>xsltproc &#x3C;FILE.xml> -o &#x3C;NEW_NAME.html></code></td><td>Create an html page from xml nmap scan.</td></tr></tbody></table>

***

<table><thead><tr><th width="133">Tool</th><th>Details</th></tr></thead><tbody><tr><td>netcat</td><td><code>nc -nzvv -w 1 &#x3C;IP> &#x3C;PORT-RANGE></code>     <em>(CONNECT scan)</em> <br><code>nc -nzv -u -w 1 &#x3C;IP> &#x3C;PORT-RANGE></code> <em>(UDP scan, !false-positive!)</em> </td></tr><tr><td>Powershell</td><td><code>1..1024 | % {echo ((New-Object Net.Sockets.TcpClient).Connect("&#x3C;IP>", $_)) "TCP port $_ is open"} 2>$null</code></td></tr></tbody></table>
{% endtab %}

{% tab title="Other" %}

<table><thead><tr><th width="140">Tool</th><th>Details</th></tr></thead><tbody><tr><td><a href="https://github.com/robertdavidgraham/masscan">masscan</a></td><td>Internet-scale port scanner, for very large networks<br><code>sudo masscan &#x3C;NETWORK></code></td></tr><tr><td><a href="https://fping.org/">fping</a></td><td>ICMP scan<br><code>fping -a -q -g &#x3C;NETWORK></code></td></tr><tr><td><a href="https://github.com/royhills/arp-scan">arp-scan</a></td><td>ARP scan<br><code>arp-scan -g -S &#x3C;SOURCE_MAC> -i &#x3C;INTERFACE> &#x3C;NETWORK></code></td></tr><tr><td><a href="https://github.com/RustScan/RustScan">RustScan</a></td><td>The Modern Port Scanner<br><code>rustscan -a &#x3C;IP> [&#x3C;NMAP OPTIONS>]</code></td></tr><tr><td>netcat</td><td><code>for i in $(seq 1 254); do nc -zv -w 1 X.X.X.$i 445;done</code></td></tr></tbody></table>

{% code title="netscan.py" overflow="wrap" %}

```python
import socket
import ipaddress
import sys
def port_scan(ip_range, ports):
    for ip in ip_range:
        print(f"Scanning {ip}")
        for port in ports:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.settimeout(.2)
            result = sock.connect_ex((str(ip), port))
            if result == 0:
                print(f"Port {port} is open on {ip}")
            sock.close()
ip_range = ipaddress.IPv4Network(sys.argv[1], strict=False)
ports = [80, 443, 8080]  # List of ports to scan
port_scan(ip_range, ports)
```

{% endcode %}
{% endtab %}

{% tab title="Note" %}
Windows Defender blocks ICMP, traditional ping.
{% endtab %}
{% endtabs %}


---

# 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://ivalexev.gitbook.io/rednote/pentesting-process/information-gathering/active.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.
