> For the complete documentation index, see [llms.txt](https://www.hackbook.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.hackbook.io/reconnaissance/active-scanning.md).

# Active Scanning

## Live Host Scanning

Commonly done with ICMP sweeps (typically disallowed by firewalls and secure and windows 10+). We listen for echo replies and know the host is alive if it responds(fping, hping, nmap, nc):&#x20;

* <mark style="color:green;">fping -a -g</mark>  //<mark style="color:yellow;">-a</mark> alive scan, <mark style="color:yellow;">-g</mark> generate list&#x20;
* <mark style="color:green;">nmap -sn</mark>  //<mark style="color:yellow;">-sn</mark> "ping sweep" but its <mark style="color:yellow;">actually an arp sweep</mark>&#x20;
* <mark style="color:green;">nmap -sn --disable-arp-ping</mark> //makes it a real ping sweep

### ARP Discovery Scan

ARP Discovery scan for live hosts. Just finds the hosts, not a port scan!\
\
**netdiscover:**\ <mark style="color:green;">`netdiscover -i tap0 -r 10.10.10.0/24`</mark>\
`or`\ <mark style="color:green;">`netdiscover -i tap0 -S -L -f -r 10.10.10.0/24`</mark>\
\
a**rp-scan:**\ <mark style="color:green;">`arp-scan -I tap0 10.10.10.0/24`</mark>

**hping:**\
This tool lets us craft our packets to run the scans we want **without extra noise**.\ <mark style="color:green;">`hping3 -S <ip> -p 80 -c 2`</mark> \ <mark style="color:yellow;">-p</mark> No port will default to port 0, not all ports. \ <mark style="color:yellow;">-S</mark> sets a syn only flag and will **syn scan** the port/ip. What we should see here is 2 syn packets being sent and, **if live, we will see a syn-ack and a rst flag** being set as the target responds to say the port is open then closes our stateful connection. \ <mark style="color:yellow;">-c</mark> says to only send 2 syn attempts The first is a rst-ack (closed). The second is a syn-ack (open)

### Classic Ping Sweep Scripts

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

```bash
#!/bin/bash
for ip in $(seq 0 254); do
ping -c 1 192.168.31.$ip | grep "bytes from" |cut -d " " -f4 |cut -d ":" -f1 &
done
```

{% endtab %}

{% tab title="Bash1line" %}

```bash
for i {1..254} do ping -c 1 10.0.1.$i | fgrep ttl & done 2>/dev/null | sed -e 's/^.*from //' -e 's/:.*$//' | sort -n -t. -k4
```

{% endtab %}

{% tab title="Win" %}

```c
for /l %i in (1,1,254) do @ping -n 1 -w 100 10.185.11.%i
```

{% endtab %}
{% endtabs %}

## <mark style="color:orange;">Then start looking for low hanging fruit:</mark>

* Misconfigured servers
* Missing or bad ACLs
* Default or weak pass
* Open shares or null sessions allowed
* Broadcast requests
* Vulnerable to public exploits

{% hint style="success" %}
Once you have your hosts. Do some port scans against them with [NMAP](/reconnaissance/active-scanning/nmap.md) and [NSE](/reconnaissance/active-scanning/nmap/nse.md). Then hop on over to [Services](/initial-access/services.md) to start exploiting them with your Recon.&#x20;
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://www.hackbook.io/reconnaissance/active-scanning.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.
