# Sniffing y MitM attack

## Tcpdump

```shell
tcpdump -i <interface>
tcpdump -i <interface> -v src <source-IP-address> and dst <destination-IP-address> and port <port>
tcpdump -i <interface> -v port 80 | egrep -i "POST /|GET /|Host:"
tcpdump -i <interface> -v port 80 | egrep -i "POST /|GET /|clave=|pwd=|passwd=|password=|Host:"
tcpdump -i <interface> -v port 80 | egrep -i "Set-Cookie:|Cookie:|Host:"
tcpdump -r <file.pcap>
```

## Ettercap

* <https://www.ettercap-project.org/>

```bash
ettercap -G
```

## Bettercap

* <https://www.bettercap.org/>

```shell
# General
bettercap
net.probe on
net.recon on
net.sniff on
net.show
events.show

# Selección de interfaz
bettercap -iface <interface>

# Sniffing host y puerto específico
set net.sniff.filter "host <IP-address> and port <port>"
net.sniff on
events.show

# Interfaz de usuario (user:pass)
bettercap -caplet http-ui
```

## ARPspoof

```shell
arpspoof -i <interface> -t <gateway-IP-address> <target-IP-address>
arpspoof -i <interface> -t <target-IP-address> <gateway-IP-address>
```

## Responder

```
responder -I <interface> -A
```


---

# 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/escaneo-y-enumeracion/sniffing-y-mitm-attack.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.
