1 --- aircrack.c.orig 2004-12-14 19:43:39.000000000 +0200
2 +++ aircrack.c 2004-12-14 23:53:24.000000000 +0200
3 @@ -49,6 +49,8 @@ char usage[] =
4 " -m <maddr> : MAC address to filter usable packets\n"
5 " -n <nbits> : WEP key length: 64 / 128 / 256 / 512\n"
6 " -p <nfork> : SMP support: # of processes to start\n"
7 +" -q <quiet> : quiet mode (less print, more speed)\n"
8 +" -u <sec's> : screen update only x seconds (default = each)\n"
11 /* command-line parameters */
12 @@ -61,6 +63,10 @@ unsigned char maddr[6]; /* MAC a
13 int weplen = 13; /* WEP key length */
14 int ffact = 2; /* fudge threshold */
15 int nfork = 1; /* number of forks */
16 +int quietmode = 3; /* quiet mode, printf slowdown cracking */
17 +int seconds = 30; /* update x seconds */
18 +#define MAX_ENTROPY 5
19 +ushort entropy=1,quiet_show=1;
21 /* runtime global data */
23 @@ -295,17 +301,27 @@ void show_stats( int B )
25 int i, et_h, et_m, et_s;
27 - tm_prev = time( NULL );
28 + /* don't waste time, entropy help check
29 + time only once in 5 calls, this save huge amount of ops
30 + Entropy also avoids multiply fast printing
31 + at matched seconds time. */
33 + if( (entropy++) >= MAX_ENTROPY) {
34 + tm_prev = time( NULL ); // get -1,
35 delta = tm_prev - tm_start;
37 + /* if( ! delta ) delta++; // Bogus checks, delays us */
38 + if( (delta % seconds) == 0) quiet_show = 1;
41 + if(quietmode>=1 && quiet_show == 1 )
44 if( ioctl( 0, TIOCGWINSZ, &ws ) < 0 )
50 - if( ! delta ) delta++;
53 et_m = ( delta - et_h * 3600 ) / 60;
54 et_s = delta - et_h * 3600 - et_m * 60;
55 @@ -320,6 +336,8 @@ void show_stats( int B )
56 "%ld keys at %ld k/m\n", et_h, et_m, et_s, tried,
57 ( 60 * tried ) / delta );
61 printf( "\n KB depth votes\n" );
63 for( i = 0; i <= B; i++ )
64 @@ -334,19 +352,21 @@ void show_stats( int B )
67 if( wpoll[i][j].votes == INFINITY )
68 - printf( "%02X(+inf) ", wpoll[i][j].index );
69 + { if(quietmode>2) printf( "%02X(+inf) ", wpoll[i][j].index ); }
71 - printf( "%02X(%4d) ", wpoll[i][j].index,
72 - wpoll[i][j].votes );
73 + { if(quietmode>2) printf( "%02X(%4d) ", wpoll[i][j].index,
74 + wpoll[i][j].votes ); }
77 + /* if(quietmode>2) */
84 + } // end of quietmode = 2
86 + } // end of quietmode = 1
89 /* safe I/O routines */
90 @@ -831,9 +851,13 @@ int do_wep_crack( int B )
93 /* we have a valid key */
95 + entropy=MAX_ENTROPY; // hack to show correct time
96 + quiet_show = 1; // show lastest status
99 + printf( "\t\t\33[1;32mWEP BSSID = %02X:%02X:%02X:%02X:%02X:%02X\33[0m\n",
100 + maddr[0], maddr[1], maddr[2],
101 + maddr[3], maddr[4], maddr[5] );
102 printf( " \33[31;1mKEY FOUND! [ " );
104 for( i = 0; i < weplen; i++ )
105 @@ -893,7 +917,7 @@ int main( int argc, char *argv[] )
109 - int option = getopt( argc, argv, "d:f:m:n:p:s:" );
110 + int option = getopt( argc, argv, "d:f:m:n:p:s:q:u:" );
112 if( option < 0 ) break;
114 @@ -997,6 +1021,26 @@ int main( int argc, char *argv[] )
120 + if( sscanf( optarg, "%d", &quietmode ) != 1 )
123 + if( quietmode < 0 || quietmode > 3 )
130 + if( sscanf( optarg, "%d", &seconds ) != 1 )
133 + if( seconds <= 1 || seconds >= 3600 )
134 + { printf(" seconds should be between 1...3600\n");
138 default : goto usage;
141 @@ -1068,10 +1112,10 @@ int main( int argc, char *argv[] )
143 srand( time( NULL ) );
145 - tm_start = time( NULL );
146 + tm_start = time( NULL ) - 1 ; /* avoid check (perv-start) = 0 */
147 tm_prev = time( NULL );
149 - printf( "\33[2J" );
150 + if(quietmode>=1) printf( "\33[2J" );
153 return( do_wep_crack( 0 ) );