Creación de diccionarios con Crunch y uso sobre Aircrack-ng

Proceso de creación de diccionarios con Crunch y uso sobre Aircrack-ng para cracking de contraseñas.


NOTA

Recordar que para protocolos de seguridad WPA/WPA2 con cifrado TKIP o CCMP, el estándar IEEE 802.11 plantea el uso de contraseñas con una longitud establecida entre 8 y 32 caracteres como medida de seguridad.


  • Crunch es un generador de diccionarios en base a reglas definidas por el usuario a través de argumentos de terminal, el cual se puede utilizar junto a Aircrack-ng mediante redireccionamiento de STDOUT por pipes ( | ).

  • Recordar que si cada diccionario quiere ser guardado en un fichero, redirigir STDOUT a un fichero mediante >

crunch <options> > wordlist.txt

Uso de Crunch

  • Crear diccionario normal indicando longitud mínima y máxima de cada palabra que compondrá el diccionario.

# crunch <min_length> <max_length>

crunch 8 9
Crunch will now generate the following amount of data: 56174480370944 bytes
53572159 MB
52316 GB
51 TB
0 PB
Crunch will now generate the following number of lines: 5638330743552
aaaaaaaa
aaaaaaab
aaaaaaac
aaaaaaad
aaaaaaae
aaaaaaaf
aaaaaaag
aaaaaaah
...
  • Crear diccionario de longitud específica con caracteres limitados, indicando que solo se quieren formar palabras compuestas por los caracteres a, b, c, 1, 2 y 3

# crunch <min_length> <max_length> <character_filter>

crunch 8 9 abc123
Crunch will now generate the following amount of data: 115893504 bytes
110 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 11757312
aaaaaaaa
aaaaaaab
aaaaaaac
aaaaaaa1
aaaaaaa2
aaaaaaa3
aaaaaaba
aaaaaabb
aaaaaabc
aaaaaab1
...
  • Crear diccionario con patrón de caracteres específicos mediante opción -t (con o sin conjunto de caracteres asignados). Para crear un patrón se pueden utilizar ciertos símbolos:

    • @ representa caracteres alfabéticos en minúscula o de un conjunto definido

    • , representa caracteres alfabéticos en mayúscula

    • % representa caracteres numéricos

    • ^ representa caracteres simbólicos

# crunch <min_length> <max_length> -t <character_pattern>

crunch 11 11 -t password%%%
Crunch will now generate the following amount of data: 12000 bytes
0 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 1000
password000
password001
password002
password003
...
password999
  • Otra forma de lograr el resultado anterior es crear el diccionario indicando el conjunto de números a utilizar

# crunch <min_length> <max_length> <character_filter> -t <character_pattern>

crunch 11 11 0123456789 -t password@@@
Crunch will now generate the following amount of data: 12000 bytes
0 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 1000
password000
password001
password002
password003
...
password999
  • Crear diccionario a partir de conjunto de caracteres específico o palabras completadas mediante opción -p

# crunch <min_length> <max_length> -p <character_list>

crunch 10 10 -p abcde12345
Crunch will now generate approximately the following amount of data: 39916800 bytes
38 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 3628800
12345abcde
12345abced
12345abdce
12345abdec
12345abecd
12345abedc
12345acbde
12345acbed
12345acdbe
12345acdeb
...
edcba54321
  • Crear diccionario de palabras específicas mediante la opción -p

# crunch -p <word_1> <word_2> <word_3>

crunch -p dog cat bird
Crunch will now generate approximately the following amount of data: 66 bytes
0 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 6
birdcatdog
birddogcat
catbirddog
catdogbird
dogbirdcat
dogcatbird
  • Crear diccionario combinando opciones -t y -p para refinar más la lista final

# crunch <min_length> <max_length> -t <character_pattern> -p <word_1> <word_2> <word_3>

crunch 5 5 -t ddd%% -p dog cat bird
Crunch will now generate approximately the following amount of data: 7800 bytes
0 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 600
birdcatdog00
birdcatdog01
birdcatdog02
birdcatdog03
birdcatdog04
birdcatdog05
birdcatdog06
birdcatdog07
birdcatdog08
birdcatdog09
...

NOTA

En la ejecución anterior, el patrón ddd%% toma las palabras definidas por -p y las asigna a cada variable d (se puede asignar cualquier carácter alfanumérico como variable). Así, cada variable marca un carácter de la contraseña, por eso se define una longitud mínima y máxima de 5 (tres variables junto a dos caracteres numéricos). Luego, con %% se agregan dos dígitos a la palabra resultante.

  • Crear diccionario por conjunto de caracteres definidos combinados con opciones -t y -p.

# crunch <min_length> <max_length> <character_filter> -t <character_pattern> -p <word_1> <word_2> <word_3>

crunch 5 5 aADE -t ddd@@ -p dog cat bird
Crunch will now generate approximately the following amount of data: 1248 bytes
0 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 96
birdcatdogaa
birdcatdogaA
birdcatdogaD
birdcatdogaE
birdcatdogAa
birdcatdogAA
birdcatdogAD
birdcatdogAE
birdcatdogDa
birdcatdogDA
...

Uso de Crunch junto a Aircrack-ng

  • Ejecutar crunch redirigiendo STDOUT sobre Aircrack-ng mediante pipes de terminal

crunch 11 11 -t password%%% | sudo aircrack-ng -e wifu traffic_file.cap -w -

                              Aircrack-ng 1.5.2

                   [00:00:02] 128 keys tested (48.74 k/s)


                          KEY FOUND! [ password123 ]


      Master Key     : 57 7D EF 0B 09 FF 92 92 3F 15 52 E8 48 D8 26 6D
                       EB 10 8A 15 B5 F0 62 14 4F 88 C1 78 FB D4 52 04

      Transient Key  : 2E 8D 54 FF 59 CD 06 85 40 EB 36 66 58 0F FD DF
                       19 84 FC FA 6C EC F7 8A 29 12 83 00 00 00 00 00
                       00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                       00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

      EAPOL HMAC     : DC 5F 0D 69 7D 77 64 C1 16 7D F4 13 B5 8D 51 AB