Estoy intentando hacer pruebas con AP's "simulados" y para hacerlo más real me gustaría simular que sueltan paquetes (IV's) acordes a la contraseña asignada, claramente con cifrado WEP.
Para eso necesito poder crear ficheros (.cap, .ivs) con IV's genuinas para después pasarlas por aircrack y ver si las descifra correctamente.
Actualmente no tengo mucho tiempo para hacer reversing a ese tipo de ficheros, pero me he mirado el source de aricrack en concreto esta función, pero el bucle for me explota la cabeza...
https://github.com/aircrack-ng/aircrack-ng/blob/master/src/aircrack-ng.c#L3139
Código
int check_wep_key( unsigned char *wepkey, int B, int keylen ){ unsigned char x1, x2; unsigned long xv; int i, j, n, bad, tests; unsigned char K[64]; unsigned char S[256]; if (keylen<=0) keylen = opt.keylen; pthread_mutex_lock(&mx_nb); nb_tried++; pthread_mutex_unlock(&mx_nb); bad = 0; tests = 32; // printf("keylen: %d\n", keylen); // if(keylen==13) // printf("%02X:%02X:%02X:%02X:%02X\n", wepkey[8],wepkey[9],wepkey[10],wepkey[11],wepkey[12]); if(opt.dict) tests = wep.nb_ivs; if(tests < TEST_MIN_IVS) tests=TEST_MIN_IVS; if(tests > TEST_MAX_IVS) tests=TEST_MAX_IVS; for( n = 0; n < tests; n++ ) { /* xv = 5 * ( rand() % wep.nb_ivs ); */ xv = 5 * n; pthread_mutex_lock( &mx_ivb ); for( i = j = 0; i < 256; i++ ) { j = ( j + S[i] + K[i % (3 + keylen)]) & 0xFF; SWAP( S[i], S[j] ); } i = 1; j = ( 0 + S[i] ) & 0xFF; SWAP(S[i], S[j]); x1 = wep.ivbuf[xv + 3] ^ S[(S[i] + S[j]) & 0xFF]; i = 2; j = ( j + S[i] ) & 0xFF; SWAP(S[i], S[j]); x2 = wep.ivbuf[xv + 4] ^ S[(S[i] + S[j]) & 0xFF]; pthread_mutex_unlock( &mx_ivb ); // printf("xv: %li x1: %02X x2: %02X\n", (xv/5), x1, x2); if( ( x1 != 0xAA || x2 != 0xAA ) && ( x1 != 0xE0 || x2 != 0xE0 ) && ( x1 != 0x42 || x2 != 0x42 ) && ( x1 != 0x02 || x2 != 0xAA ) ) //llc sub layer management bad++; if( bad > ((tests*opt.probability)/100) ) return( FAILURE ); } opt.probability = (((tests-bad)*100)/tests); key_found(wepkey, keylen, B); return( SUCCESS ); }
Bueno, si alguien me puede ayudar a generar las IV's o conoce la existencia de algún programa para hacerlo, se lo agradecería mucho.
Saludos