El libre pensamiento para un internet libre
No estas registrado.
Antes de ir al grano recuerdo un par de cosas.
rfkill es un comando fundamental que se usa para bloquear y desbloquear interfaces.
Requiere logicamente privilegios de administrador ya que efectúa modificación en "nuestros ficheros sistema"
Si hacéis sudo rfkill list obtendréis en consola un listado de vuestras interfaces con su estado:
root@kalimuX0:~# rfkill list
0: Toshiba Bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
3: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
5: phy3: Wireless LAN
Soft blocked: no
Hard blocked: no
Hay dos tipos de bloqueo posible
duro (hard): Un bloqueo "físico" que impide levantar la interfaz. en este caso rfkill no puede hacer nada y es cuestión de prensar el botón wifi de su ordenador o de habilitar en la BIOS/EFI la interfaz wireless/bluetooth
blando (soft): Un bloqueo a nivel de software. Un programa, un proceso (por ejemplo network manager) está interfiriendo y retiene la interfaz.
En este caso rfkill permite desbloquear la interfaz
Para desbloquear (o bloquear) una interfaz concreta debemos usar el indice que sale en el listado.
En mi caso el indice 1 corresponde a mi tarjeta wifi interna
1: phy0: Wireless LAN
- Para bloquear la interfaz haría
sudo rfkill block 1
- Para desbloquearla
sudo rfkill unblock 1
- la orden propuesta y ejecutada no es correcta y no levanta el bloqueo
- la interfaz está modo monitor pero sigue bloqueado y no se puede usar:
Reproduciendo el error en consola
Airmon-ng es un script bash así que podemos editarlo directamente
Para conocer su ruta podemos hacer en consola "type airmon-ng"
sudo -i && type airmon-ng
y tendremos la ruta
root@kalimuX0:~# type airmon-ng
airmon-ng está asociado (/usr/sbin/airmon-ng)
Abrimos con un editor de texto el fichero desde la misma consola (tiene privilegios root permanentes gracias a sudo -i)
gedit /usr/sbin/airmon-ng
El script tiene estas dos funciones relacionadas con rfkill:
función rfkill_check() (linea 258 hasta 293)
rfkill_check() {
#take phy and check blocks
if [ "${RFKILL}" = 0 ]; then
#immediatly return if rfkill isn't supported
return 0
fi
if [ -z "${1}" ]; then
printf "Fatal, rfkill_check requires a phy to be passed in\n"
exit 1
fi
#first we have to find the rfkill index
#this is available as /sys/class/net/wlan0/phy80211/rfkill## but that's a bit difficult to parse
index="$(rfkill list | grep ${1} | awk -F: '{print $1}')"
if [ -z "$index" ]; then
return 187
fi
rfkill_status="$(rfkill list ${index} 2>&1)"
if [ $? != 0 ]; then
printf "rfkill error: ${rfkill_status}\n"
return 187
elif [ -z "${rfkill_status}" ]; then
printf "rfkill had no output, something went wrong.\n"
exit 1
else
soft=$(printf "${rfkill_status}" | grep -i soft | awk '{print $3}')
hard=$(printf "${rfkill_status}" | grep -i hard | awk '{print $3}')
if [ "${soft}" = "yes" ] && [ "${hard}" = "no" ]; then
return 1
elif [ "${soft}" = "no" ] && [ "${hard}" = "yes" ]; then
return 2
elif [ "${soft}" = "yes" ] && [ "${hard}" = "yes" ]; then
return 3
fi
fi
return 0
}
rfkill_unblock (linea 295 hasta 310)
rfkill_unblock() {
#attempt unblock and CHECK SUCCESS
if [ "${RFKILL}" = 0 ]; then
#immediatly return if rfkill isn't supported
return 0
fi
rfkill_status="$(rfkill unblock ${1#phy} 2>&1)"
if [ $? != 0 ]; then
printf "rfkill error: ${rfkill_status}\n"
printf "Unable to unblock.\n"
return 1
else
sleep 1
return 0
fi
}
modificando una linea en la función se arregla el problema a lo bruto pero es efectivo
* En la linea linea 270 (primera funcción) :
index="$(rfkill list | grep ${1} | awk -F: '{print $1}')"
Tenemos a una variable index que recoge el numero que nos interesa
Veis al final de la variable: awk -F: '{print $1}'.
Significa que se guarda el primer campo de listado rfkill (separador ":" ); es decir el número de la interfaz (ver más arriba la salida estándar de rfkill )
* Modificamos la linea 304 (segunda funcción)
A saber está:
rfkill_status="$(rfkill unblock ${1#phy} 2>&1)"
Es una variable pero al declararla se ejecuta la orden "rfkill unblock wlanX"
Tenemos concretamente a un array: ${1#phy}
Y el resultado es la interfaz wlan asociada la interfaz phy elegida.
La solución rápida es sustituir este array "phy" por la variable "index"
[code]rfkill_status="$(rfkill unblock $index 2>&1)"[/code]
Guardamos los cambios y "ya está", de forma grosera.
Ahora airmon-ng hace lo debido y puedo activar el modo monitor y usar la interfaz
El bug será parcheado correctamente y del todo por MisterX (hace falta retocar más cosas como la salida en consola) muy pronto.
#1723 new defect airmon-ng: invalid rfkill command against soft block @ trac aircrack-ng
Desconectado
Tema | Respuestas | Vistas | Ultimo mensaje |
---|---|---|---|
1 | 149 | Ayer 18:07:21 por crash | |
0 | 29 | Ayer 17:07:48 por kcdtv | |
Drivers RTL8187 Windwos para 10 por martim
|
7 | 347 | 18-04-2018 14:07:03 por kcdtv |
3 | 172 | 18-04-2018 14:01:35 por kcdtv | |
Pegado: |
81 | 3410 | 14-04-2018 22:25:30 por crash |
Ultimo usuario registrado: IldeNet
Usuarios registrados conectados: 0
Invitados conectados: 8
Número total de usuarios registrados: 978
Número total de temas: 1,044
Número total de mensajes: 10,169
Atom tema feed - Impulsado por FluxBB