Codebase list hcxtools / 72c5249
Update upstream source from tag 'upstream/6.2.7' Update to upstream version '6.2.7' with Debian dir cb37cacfb5d2cac6f95ebb6ba955997333d20ed7 Paulo Roberto Alves de Oliveira (aka kretcheu) 2 years ago
4 changed file(s) with 120 addition(s) and 120 deletion(s). Raw diff Collapse all Expand all
00 PRODUCTION := 1
1 PRODUCTION_VERSION := 6.2.6
1 PRODUCTION_VERSION := 6.2.7
22 PRODUCTION_YEAR := 2022
33
44 ifeq ($(PRODUCTION),1)
0 26.04.2022
1 ==========
2 hcxpsktool: fixed stdout bug
3 release v6.2.7
4
5
06 22.04.2022
17 ==========
28 release v6.2.6
4646 /*===========================================================================*/
4747 struct hccap_s
4848 {
49 char essid[36];
50 unsigned char ap[6];
51 unsigned char client[6];
52 unsigned char snonce[32];
53 unsigned char anonce[32];
54 unsigned char eapol[256];
55 int eapol_size;
56 int keyver;
57 unsigned char keymic[16];
49 char essid[36];
50 unsigned char ap[6];
51 unsigned char client[6];
52 unsigned char snonce[32];
53 unsigned char anonce[32];
54 unsigned char eapol[256];
55 int eapol_size;
56 int keyver;
57 unsigned char keymic[16];
5858 };
5959 typedef struct hccap_s hccap_t;
6060 #define HCCAP_SIZE (sizeof(hccap_t))
356356 {
357357 static int p;
358358
359 fprintf(stdout, "\nRAW: ");
359 fprintf(stdout, "\nRAW: ");
360360
361361 for(p = 0; p < len; p++)
362362 {
829829 if(c == 0) fprintf(stdout, "not available due to missing radiotap header");
830830 fprintf(stdout, "\n");
831831
832 if((eapolwrittencount +eapolncwrittencount +eapolwrittenhcpxcountdeprecated +eapolncwrittenhcpxcountdeprecated +eapolwrittenhcpcountdeprecated
832 if((eapolwrittencount +eapolncwrittencount +eapolwrittenhcpxcountdeprecated +eapolncwrittenhcpxcountdeprecated +eapolwrittenhcpcountdeprecated
833833 +eapolwrittenjcountdeprecated +pmkidwrittenhcount +pmkidwrittenjcountdeprecated +pmkidwrittencountdeprecated
834834 +eapmd5writtencount +eapmd5johnwrittencount +eapleapwrittencount +eapmschapv2writtencount +tacacspwrittencount) == 0)
835835 {
871871 "This could prevent to calculate a valid EAPOL MESSAGE PAIR\n"
872872 "or to get a valid PMKID.\n");
873873 }
874 if(ancientdumpfileformat == true)
874 if(ancientdumpfileformat == true)
875875 {
876876 fprintf(stdout, "\nInformation: limited dump file format detected!\n"
877877 "This file format is a very basic format to save captured network data.\n"
926926 }
927927 if(malformedcount > 5)
928928 {
929 printf( "\nInformation: malformed packets detected!\n"
929 printf( "\nInformation: malformed packets detected!\n"
930930 "In monitor mode the adapter does not check to see if the cyclic redundancy check (CRC)\n"
931931 "values are correct for packets captured. The device is able to detect the Physical Layer\n"
932932 "Convergence Procedure (PLCP) preamble and is able to synchronize to it, but if there is\n"
986986 wecl = strlen(pcapngweakcandidate);
987987 if((wecl > 0) && (wecl < 64) && (strcmp(pcapngweakcandidate, "N/A") != 0))
988988 {
989 if(fh_essid != NULL) fprintf(fh_essid, "%s\n", pcapngweakcandidate);
989 if(fh_essid != NULL) fprintf(fh_essid, "%s\n", pcapngweakcandidate);
990990 }
991991 for(zeigermac = aplist; zeigermac < aplistptr; zeigermac++)
992992 {
12261226 }
12271227 for(zeiger = tacacsplist +1; zeiger < tacacsplistptr; zeiger++)
12281228 {
1229 if((zeigerold->sessionid == zeiger->sessionid) && (zeigerold->sequencenr == zeiger->sequencenr) && (zeigerold->len == zeiger->len) && (memcmp(zeigerold->data, zeiger->data, zeiger->len) == 0)) continue;
1229 if((zeigerold->sessionid == zeiger->sessionid) && (zeigerold->sequencenr == zeiger->sequencenr) && (zeigerold->len == zeiger->len) && (memcmp(zeigerold->data, zeiger->data, zeiger->len) == 0)) continue;
12301230 if(fh_tacacsp != NULL)
12311231 {
12321232 fprintf(fh_tacacsp, "$tacacs-plus$0$%08x$", zeiger->sessionid);
12431243 {
12441244 static uint32_t authlen;
12451245 static tacacsp_t *tacacsp;
1246 static tacacsplist_t *tacacsplistnew;
1246 static tacacsplist_t *tacacsplistnew;
12471247
12481248 if(restlen < (uint32_t)TACACSP_SIZE) return;
12491249 tacacsp = (tacacsp_t*)tacacspptr;
12951295 /*===========================================================================*/
12961296 static void processptppacket(uint32_t restlen, uint8_t *ptpptr)
12971297 {
1298 static ptp_t *ptp;
1298 static ptp_t *ptp;
12991299
13001300 if(restlen < (uint32_t)PTP_SIZE) return;
13011301 ptp = (ptp_t*)ptpptr;
13231323 static void processudppacket(uint64_t timestamp, uint32_t restlen, uint8_t *udpptr)
13241324 {
13251325 static udp_t *udp;
1326 static uint16_t udplen;
1326 static uint16_t udplen;
13271327
13281328 if(restlen < UDP_SIZE) return;
13291329 udp = (udp_t*)udpptr;
13371337 /*===========================================================================*/
13381338 static void processtcppacket(uint64_t timestamp, uint32_t restlen, uint8_t *tcpptr)
13391339 {
1340 static uint32_t tcplen;
1340 static uint32_t tcplen;
13411341 static tcp_t *tcp;
13421342 static tacacsp_t *tacacsp;
13431343
14881488 /*===========================================================================*/
14891489 static void addeapmschapv2hash(uint8_t id, uint8_t mschapv2usernamelen, uint8_t *mschapv2username, uint8_t *mschapv2request, uint8_t *mschapv2response)
14901490 {
1491 static eapmschapv2hashlist_t *eapmschapv2hashlistnew;
1491 static eapmschapv2hashlist_t *eapmschapv2hashlistnew;
14921492
14931493 eapmschapv2hashcount++;
14941494 if(eapmschapv2hashlistptr >= eapmschapv2hashlist +eapmschapv2hashlistmax)
15821582 if(memcmp(zeiger->client, macfm, 6) != 0) continue;
15831583 zeiger->mschapv2usernamelen = mschapv2usernamelen;
15841584 memcpy(zeiger->mschapv2username, mschapv2usernameptr, mschapv2usernamelen);
1585 addeapmschapv2hash(eapmschapv2->id, zeiger->mschapv2usernamelen, zeiger->mschapv2username, zeiger->mschapv2request, eapmschapv2->mschapv2data);
1585 addeapmschapv2hash(eapmschapv2->id, zeiger->mschapv2usernamelen, zeiger->mschapv2username, zeiger->mschapv2request, eapmschapv2->mschapv2data);
15861586 }
15871587 qsort(eapmschapv2msglist, EAPMSCHAPV2MSGLIST_MAX +1, EAPMSCHAPV2MSGLIST_SIZE, sort_eapmschapv2msglist_by_timestamp);
15881588 }
16271627 /*===========================================================================*/
16281628 static void addeapleaphash(uint8_t id, uint8_t leapusernamelen, uint8_t *leapusername, uint8_t *leaprequest, uint8_t *leapresponse)
16291629 {
1630 static eapleaphashlist_t *eapleaphashlistnew;
1630 static eapleaphashlist_t *eapleaphashlistnew;
16311631
16321632 eapleaphashcount++;
16331633 if(eapleaphashlistptr >= eapleaphashlist +eapleaphashlistmax)
16721672 if(eapleap->leaplen != LEAPREQ_LEN_MAX) return;
16731673 if(eapleap->leaplen > eapleaplen -EAPLEAP_SIZE) return;
16741674 if(eapleap->leaplen == eapleaplen -EAPLEAP_SIZE) return;
1675 if(memcmp(&zeroed32, eapleap->leapdata, LEAPREQ_LEN_MAX) == 0) return;
1675 if(memcmp(&zeroed32, eapleap->leapdata, LEAPREQ_LEN_MAX) == 0) return;
16761676 memset(zeiger, 0, EAPLEAPMSGLIST_SIZE);
16771677 zeiger->timestamp = eaptimestamp;
16781678 memcpy(zeiger->ap, macfm, 6);
16991699 zeiger = eapleapmsglist +EAPLEAPMSGLIST_MAX;
17001700 if(eapleap->leaplen != LEAPRESP_LEN_MAX) return;
17011701 if(eapleap->leaplen > eapleaplen -EAPLEAP_SIZE) return;
1702 if(memcmp(&zeroed32, eapleap->leapdata, LEAPRESP_LEN_MAX) == 0) return;
1702 if(memcmp(&zeroed32, eapleap->leapdata, LEAPRESP_LEN_MAX) == 0) return;
17031703 memset(zeiger, 0, EAPLEAPMSGLIST_SIZE);
17041704 zeiger->timestamp = eaptimestamp;
17051705 memcpy(zeiger->ap, macto, 6);
17131713 if((zeiger->id) != eapleap->id) continue;
17141714 if(memcmp(zeiger->ap, macto, 6) != 0) continue;
17151715 if(memcmp(zeiger->client, macfm, 6) != 0) continue;
1716 addeapleaphash(eapleap->id, zeiger->leapusernamelen, zeiger->leapusername, zeiger->leaprequest, eapleap->leapdata);
1716 addeapleaphash(eapleap->id, zeiger->leapusernamelen, zeiger->leapusername, zeiger->leaprequest, eapleap->leapdata);
17171717 }
17181718 qsort(eapleapmsglist, EAPLEAPMSGLIST_MAX +1, EAPLEAPMSGLIST_SIZE, sort_eapleapmsglist_by_timestamp);
17191719 }
17781778 /*===========================================================================*/
17791779 static void addeapmd5hash(uint8_t id, uint8_t *challenge, uint8_t *response)
17801780 {
1781 static eapmd5hashlist_t *eapmd5hashlistnew;
1781 static eapmd5hashlist_t *eapmd5hashlistnew;
17821782
17831783 eapmd5hashcount++;
17841784 if(eapmd5hashlistptr >= eapmd5hashlist +eapmd5hashlistmax)
18121812 eapmd5len = ntohs(eapmd5->eapmd5len);
18131813 if(eapmd5len != restlen) return;
18141814 if(eapmd5->md5len != EAPMD5_LEN_MAX) return;
1815 if(memcmp(&zeroed32, eapmd5->md5data, EAPMD5_LEN_MAX) == 0) return;
1815 if(memcmp(&zeroed32, eapmd5->md5data, EAPMD5_LEN_MAX) == 0) return;
18161816 if(eapcode == EAP_CODE_REQ)
18171817 {
18181818 zeiger = eapmd5msglist +EAPMD5MSGLIST_MAX;
18411841 if((zeiger->id) != eapmd5->id) continue;
18421842 if(memcmp(zeiger->ap, macto, 6) != 0) continue;
18431843 if(memcmp(zeiger->client, macfm, 6) != 0) continue;
1844 addeapmd5hash(eapmd5->id, zeiger->md5, eapmd5->md5data);
1844 addeapmd5hash(eapmd5->id, zeiger->md5, eapmd5->md5data);
18451845 }
18461846 qsort(eapmd5msglist, EAPMD5MSGLIST_MAX +1, EAPMD5MSGLIST_SIZE, sort_eapmd5msglist_by_timestamp);
18471847 }
18851885 EVP_MD_CTX_free(mdctx);
18861886 return false;
18871887 }
1888 if(EVP_DigestSignInit(mdctx, NULL, EVP_sha1(), NULL, pkey) != 1)
1888 if(EVP_DigestSignInit(mdctx, NULL, EVP_sha1(), NULL, pkey) != 1)
18891889 {
18901890 EVP_PKEY_free(pkey);
18911891 EVP_MD_CTX_free(mdctx);
20802080 EVP_MD_CTX_free(mdctx);
20812081 return false;
20822082 }
2083 if(EVP_DigestSignInit(mdctx, NULL, EVP_md5(), NULL, pkey) != 1)
2083 if(EVP_DigestSignInit(mdctx, NULL, EVP_md5(), NULL, pkey) != 1)
20842084 {
20852085 EVP_PKEY_free(pkey);
20862086 EVP_MD_CTX_free(mdctx);
22942294 for(p = 0; p < zeigerhs->eapauthlen; p++) fprintf(fh_pmkideapol, "%02x", eapoltemp[p]);
22952295 fprintf(fh_pmkideapol, "*%02x\n", zeigerhs->status);
22962296 if(zeigerhs->rcgap == 0) eapolwrittencount++;
2297 else eapolncwrittencount++;
2297 else eapolncwrittencount++;
22982298 }
22992299 if((fh_pmkideapoljtrdeprecated != 0) && (zeigerhs->rcgap == 0))
23002300 {
24672467 qsort(aplist, aplistptr -aplist, MACLIST_SIZE, sort_maclist_by_mac_count);
24682468 qsort(pmkidlist, pmkidlistptr -pmkidlist, PMKIDLIST_SIZE, sort_pmkidlist_by_mac);
24692469 if(ncvalue == 0) qsort(handshakelist, handshakelistptr -handshakelist, HANDSHAKELIST_SIZE, sort_handshakelist_by_timegap);
2470 else qsort(handshakelist, handshakelistptr -handshakelist, HANDSHAKELIST_SIZE, sort_handshakelist_by_rcgap);
2470 else qsort(handshakelist, handshakelistptr -handshakelist, HANDSHAKELIST_SIZE, sort_handshakelist_by_rcgap);
24712471 zeigerhsakt = handshakelist;
24722472 zeigerpmkidakt = pmkidlist;
24732473 zeigermacold = aplist;
25702570 memcpy(zeigerold->devicename, zeiger->devicename, zeiger->devicenamelen);
25712571 zeigerold->devicenamelen = zeiger->devicenamelen;
25722572 }
2573 if(zeigerold->enrolleelen == 0)
2573 if(zeigerold->enrolleelen == 0)
25742574 {
25752575 memcpy(zeigerold->enrollee, zeiger->enrollee, zeiger->enrolleelen);
25762576 zeigerold->enrolleelen = zeiger->enrolleelen;
27732773 static uint32_t idstrlen;
27742774
27752775 eapcount++;
2776 if(restlen < (int)EAPAUTH_SIZE) return;
2776 if(restlen < (int)EAPAUTH_SIZE) return;
27772777 eapauth = (eapauth_t*)eapptr;
27782778 authlen = ntohs(eapauth->len);
27792779 if(authlen > restlen) return;
29072907 #endif
29082908 if(wpatype != VT_WPA_IE) return false;
29092909 zeiger->kdversion |= KV_WPAIE;
2910 gsuiteptr = (suite_t*)ieptr;
2910 gsuiteptr = (suite_t*)ieptr;
29112911 if(memcmp(gsuiteptr->oui, &ouimscorp, 3) == 0)
29122912 {
29132913 if(gsuiteptr->type == CS_WEP40) zeiger->groupcipher |= TCS_WEP40;
29352935 }
29362936 for(c = 0; c < csuitecount; c++)
29372937 {
2938 csuiteptr = (suite_t*)ieptr;
2938 csuiteptr = (suite_t*)ieptr;
29392939 if(memcmp(csuiteptr->oui, &ouimscorp, 3) == 0)
29402940 {
29412941 if(csuiteptr->type == CS_WEP40) zeiger->cipher |= TCS_WEP40;
29662966 }
29672967 for(c = 0; c < asuitecount; c++)
29682968 {
2969 asuiteptr = (suite_t*)ieptr;
2969 asuiteptr = (suite_t*)ieptr;
29702970 if(memcmp(asuiteptr->oui, &ouimscorp, 3) == 0)
29712971 {
29722972 if(asuiteptr->type == AK_PMKSA) zeiger->akm |= TAK_PMKSA;
30333033 static suitecount_t *asuitecountptr;
30343034 static suite_t *asuiteptr;
30353035 static int asuitecount;
3036 static rsnpmkidlist_t *rsnpmkidlistptr;
3036 static rsnpmkidlist_t *rsnpmkidlistptr;
30373037 static int rsnpmkidcount;
30383038
30393039 static const uint8_t foxtrott[4] = { 0xff, 0xff, 0xff, 0xff };
30483048 zeiger->kdversion |= KV_RSNIE;
30493049 rsnlen -= RSNIE_SIZE;
30503050 ieptr += RSNIE_SIZE;
3051 gsuiteptr = (suite_t*)ieptr;
3051 gsuiteptr = (suite_t*)ieptr;
30523052 if(memcmp(gsuiteptr->oui, &suiteoui, 3) == 0)
30533053 {
30543054 if(gsuiteptr->type == CS_WEP40) zeiger->groupcipher |= TCS_WEP40;
30773077 }
30783078 for(c = 0; c < csuitecount; c++)
30793079 {
3080 csuiteptr = (suite_t*)ieptr;
3080 csuiteptr = (suite_t*)ieptr;
30813081 if(memcmp(csuiteptr->oui, &suiteoui, 3) == 0)
30823082 {
30833083 if(csuiteptr->type == CS_WEP40) zeiger->cipher |= TCS_WEP40;
31093109 }
31103110 for(c = 0; c < asuitecount; c++)
31113111 {
3112 asuiteptr = (suite_t*)ieptr;
3112 asuiteptr = (suite_t*)ieptr;
31133113 if(memcmp(asuiteptr->oui, &suiteoui, 3) == 0)
31143114 {
31153115 if(asuiteptr->type == AK_PMKSA) zeiger->akm |= TAK_PMKSA;
31323132 rsnlen -= RSNCAPABILITIES_SIZE;
31333133 ieptr += RSNCAPABILITIES_SIZE;
31343134 if(rsnlen <= 0) return true;
3135 rsnpmkidlistptr = (rsnpmkidlist_t*)ieptr;
3135 rsnpmkidlistptr = (rsnpmkidlist_t*)ieptr;
31363136 #ifndef BIG_ENDIAN_HOST
31373137 rsnpmkidcount = rsnpmkidlistptr->count;
31383138 #else
33143314 return;
33153315 }
33163316 if(memcmp(&zeroed32, wpak->nonce, 32) == 0) return;
3317 if((memcmp(&fakenonce1, wpak->nonce, 32) == 0) && (rc == 17)) return;
3318 if((memcmp(&fakenonce2, wpak->nonce, 32) == 0) && (rc == 17)) return;
3317 if((memcmp(&fakenonce1, wpak->nonce, 32) == 0) && (rc == 17)) return;
3318 if((memcmp(&fakenonce2, wpak->nonce, 32) == 0) && (rc == 17)) return;
33193319 zeiger = messagelist +MESSAGELIST_MAX;
33203320 memset(zeiger, 0, MESSAGELIST_SIZE);
33213321 zeiger->timestamp = eaptimestamp;
33403340 if(eaptimestamp > zeiger->timestamp) eaptimegap = eaptimestamp -zeiger->timestamp;
33413341 else eaptimegap = zeiger->timestamp -eaptimestamp;
33423342 mpfield = ST_M34E4;
3343 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
3343 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
33443344 if(eaptimegap <= eapoltimeoutvalue) addhandshake(eaptimegap, rcgap, messagelist +MESSAGELIST_MAX, zeiger, keyver, mpfield);
33453345 }
33463346 if((zeiger->message &HS_M1) != HS_M1) continue;
33603360 {
33613361 if(zeiger->rc == myaktreplaycount) continue;
33623362 }
3363 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
3363 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
33643364 if(eaptimegap <= eapoltimeoutvalue) addhandshake(eaptimegap, rcgap, messagelist +MESSAGELIST_MAX, zeiger, keyver, mpfield);
33653365 }
33663366 qsort(messagelist, MESSAGELIST_MAX +1, MESSAGELIST_SIZE, sort_messagelist_by_epcount);
34753475 {
34763476 if(zeiger->rc == myaktreplaycount) continue;
34773477 }
3478 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
3478 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
34793479 if(eaptimegap <= eapoltimeoutvalue) addhandshake(eaptimegap, rcgap, zeiger, messagelist +MESSAGELIST_MAX, keyver, mpfield);
34803480 }
34813481 if((zeiger->message &HS_M4) != HS_M4) continue;
34923492 {
34933493 if(zeiger->rc == myaktreplaycount) continue;
34943494 }
3495 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
3495 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
34963496 if(eaptimegap <= eapoltimeoutvalue) addhandshake(eaptimegap, rcgap, zeiger, messagelist +MESSAGELIST_MAX, keyver, mpfield);
34973497 }
34983498 qsort(messagelist, MESSAGELIST_MAX +1, MESSAGELIST_SIZE, sort_messagelist_by_epcount);
35833583 eapolm2errorcount++;
35843584 return;
35853585 }
3586 if((memcmp(&fakenonce1, wpak->nonce, 32) == 0) && (rc == 17)) return;
3587 if((memcmp(&fakenonce2, wpak->nonce, 32) == 0) && (rc == 17)) return;
3586 if((memcmp(&fakenonce1, wpak->nonce, 32) == 0) && (rc == 17)) return;
3587 if((memcmp(&fakenonce2, wpak->nonce, 32) == 0) && (rc == 17)) return;
35883588 zeiger = messagelist +MESSAGELIST_MAX;
35893589 memset(zeiger, 0, MESSAGELIST_SIZE);
35903590 zeiger->timestamp = eaptimestamp;
36363636 }
36373637 if(rcgap != 0) continue;
36383638 }
3639 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
3639 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
36403640 if(eaptimegap <= eapoltimeoutvalue) addhandshake(eaptimegap, rcgap, messagelist +MESSAGELIST_MAX, zeiger, keyver, mpfield);
36413641 }
36423642 if((zeiger->message &HS_M3) != HS_M3) continue;
36613661 }
36623662 if(rcgap != 0) continue;
36633663 }
3664 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
3664 if(eaptimegap > eaptimegapmax) eaptimegapmax = eaptimegap;
36653665 if(eaptimegap <= eapoltimeoutvalue) addhandshake(eaptimegap, rcgap, messagelist +MESSAGELIST_MAX, zeiger, keyver, mpfield);
36663666 }
36673667 qsort(messagelist, MESSAGELIST_MAX +1, MESSAGELIST_SIZE, sort_messagelist_by_epcount);
37183718 eapolm1errorcount++;
37193719 return;
37203720 }
3721 if((memcmp(&fakenonce1, wpak->nonce, 32) == 0) && (rc == 17)) return;
3722 if((memcmp(&fakenonce2, wpak->nonce, 32) == 0) && (rc == 17)) return;
3721 if((memcmp(&fakenonce1, wpak->nonce, 32) == 0) && (rc == 17)) return;
3722 if((memcmp(&fakenonce2, wpak->nonce, 32) == 0) && (rc == 17)) return;
37233723 zeiger = messagelist +MESSAGELIST_MAX;
37243724 memset(zeiger, 0, MESSAGELIST_SIZE);
37253725 zeiger->timestamp = eaptimestamp;
37303730 zeiger->rc = rc;
37313731 memcpy(zeiger->nonce, wpak->nonce, 32);
37323732
3733 if((zeiger->rc == myaktreplaycount) && (memcmp(&myaktanonce, zeiger->nonce, 32) == 0))
3733 if((zeiger->rc == myaktreplaycount) && (memcmp(&myaktanonce, zeiger->nonce, 32) == 0))
37343734 {
37353735 zeiger->status |= ST_APLESS;
37363736 eapolm1ancount++;
38483848 static eapauth_t *eapauth;
38493849
38503850 eapauth = (eapauth_t*)eapptr;
3851 if(restlen < (int)EAPAUTH_SIZE) return;
3851 if(restlen < (int)EAPAUTH_SIZE) return;
38523852 if(eapauth->type == EAPOL_KEY)
38533853 {
38543854 process80211eapol(eaptimestamp, macto, macfm, macsrc, restlen, eapptr);
39103910 memcpy(zeiger->devicename, aplistptr->devicename, aplistptr->devicenamelen);
39113911 zeiger->devicenamelen = aplistptr->devicenamelen;
39123912 }
3913 if(zeiger->enrolleelen == 0)
3913 if(zeiger->enrolleelen == 0)
39143914 {
39153915 memcpy(zeiger->enrollee, aplistptr->enrollee, aplistptr->enrolleelen);
39163916 zeiger->enrolleelen = aplistptr->enrolleelen;
39673967 }
39683968 else if((tags.akm &TAK_FT_PSK) == TAK_FT_PSK) reassociationrequestftpskcount++;
39693969
3970 if((tags.akm &TAK_PSK) == TAK_PSK) reassociationrequestpskcount++;
3971 else if((tags.akm &TAK_FT_PSK) == TAK_FT_PSK) reassociationrequestftpskcount++;
3972 else if((tags.akm &TAK_PSKSHA256) == TAK_PSKSHA256) reassociationrequestpsk256count++;
3973 else if((tags.akm &TAK_SAE_SHA256) == TAK_SAE_SHA256) reassociationrequestsae256count++;
3974 else if((tags.akm &TAK_SAE_SHA384B) == TAK_SAE_SHA384B) reassociationrequestsae384bcount++;
3975 else if((tags.akm &TAK_OWE) == TAK_OWE) reassociationrequestowecount++;
3970 if((tags.akm &TAK_PSK) == TAK_PSK) reassociationrequestpskcount++;
3971 else if((tags.akm &TAK_FT_PSK) == TAK_FT_PSK) reassociationrequestftpskcount++;
3972 else if((tags.akm &TAK_PSKSHA256) == TAK_PSKSHA256) reassociationrequestpsk256count++;
3973 else if((tags.akm &TAK_SAE_SHA256) == TAK_SAE_SHA256) reassociationrequestsae256count++;
3974 else if((tags.akm &TAK_SAE_SHA384B) == TAK_SAE_SHA384B) reassociationrequestsae384bcount++;
3975 else if((tags.akm &TAK_OWE) == TAK_OWE) reassociationrequestowecount++;
39763976 if(cleanbackmac() == false) aplistptr++;
39773977 if(aplistptr >= aplist +maclistmax)
39783978 {
40484048 if(memcmp(&zeroed32, tags.pmkid, 16) != 0) addpmkid(macclient, macap, tags.pmkid);
40494049 }
40504050 if((tags.akm &TAK_PSK) == TAK_PSK) associationrequestpskcount++;
4051 else if((tags.akm &TAK_FT_PSK) == TAK_FT_PSK) associationrequestftpskcount++;
4052 else if((tags.akm &TAK_PSKSHA256) == TAK_PSKSHA256) associationrequestpsk256count++;
4053 else if((tags.akm &TAK_SAE_SHA256) == TAK_SAE_SHA256) associationrequestsae256count++;
4054 else if((tags.akm &TAK_SAE_SHA384B) == TAK_SAE_SHA384B) associationrequestsae384bcount++;
4055 else if((tags.akm &TAK_OWE) == TAK_OWE) associationrequestowecount++;
4051 else if((tags.akm &TAK_FT_PSK) == TAK_FT_PSK) associationrequestftpskcount++;
4052 else if((tags.akm &TAK_PSKSHA256) == TAK_PSKSHA256) associationrequestpsk256count++;
4053 else if((tags.akm &TAK_SAE_SHA256) == TAK_SAE_SHA256) associationrequestsae256count++;
4054 else if((tags.akm &TAK_SAE_SHA384B) == TAK_SAE_SHA384B) associationrequestsae384bcount++;
4055 else if((tags.akm &TAK_OWE) == TAK_OWE) associationrequestowecount++;
40564056 if(cleanbackmac() == false) aplistptr++;
40574057 if(aplistptr >= aplist +maclistmax)
40584058 {
41644164
41654165 proberequestcount++;
41664166 if(proberequestlen < (int)IETAG_SIZE) return;
4167 if(gettags(proberequestlen, proberequestptr, &tags) == false) return;
4167 if(gettags(proberequestlen, proberequestptr, &tags) == false) return;
41684168 if(tags.essidlen == 0) return;
41694169 if(tags.essid[0] == 0) return;
41704170 if(aplistptr >= aplist +maclistmax)
43834383 packetlen -= (int)ACTIONMEASUREMENTFRAME_SIZE;
43844384 packetptr += (int)ACTIONMEASUREMENTFRAME_SIZE;
43854385 if(packetlen < (int)IETAG_SIZE) return;
4386 if(gettags(packetlen, packetptr, &tags) == false) return;
4386 if(gettags(packetlen, packetptr, &tags) == false) return;
43874387 if(tags.essidlen == 0) return;
43884388 if(tags.essid[0] == 0) return;
43894389 if(aplistptr >= aplist +maclistmax)
45744574 if((rth->it_present & IEEE80211_RADIOTAP_CHANNEL) == IEEE80211_RADIOTAP_CHANNEL)
45754575 {
45764576 if(pf > caplen) return;
4577 if((pf %2) != 0) pf += 1;
4577 if((pf %2) != 0) pf += 1;
45784578 frequency = (capptr[pf +1] << 8) + capptr[pf];
45794579 usedfrequency[frequency] += 1;
45804580 if((frequency >= 2407) && (frequency <= 2474))
45824582 interfacechannel = (frequency -2407)/5;
45834583 band24count++;
45844584 }
4585 else if((frequency >= 2481) && (frequency <= 2487))
4585 else if((frequency >= 2481) && (frequency <= 2487))
45864586 {
45874587 interfacechannel = (frequency -2412)/5;
45884588 band24count++;
45994599 }
46004600 pf += 4;
46014601 }
4602 if((rth->it_present & IEEE80211_RADIOTAP_FHSS) == IEEE80211_RADIOTAP_FHSS)
4603 {
4604 if((pf %2) != 0) pf += 1;
4602 if((rth->it_present & IEEE80211_RADIOTAP_FHSS) == IEEE80211_RADIOTAP_FHSS)
4603 {
4604 if((pf %2) != 0) pf += 1;
46054605 pf += 2;
46064606 }
46074607 if((rth->it_present & IEEE80211_RADIOTAP_DBM_ANTSIGNAL) == IEEE80211_RADIOTAP_DBM_ANTSIGNAL)
48934893 {
48944894 pcapreaderrors++;
48954895 fprintf(stdout, "detected oversized snaplen (%d)\n", pcapfhdr.snaplen);
4896 if(fh_log != NULL) fprintf(fh_log, "detected oversized snaplen (%d): %d\n", pcapfhdr.snaplen, pcapfhdr.version_minor);
4896 if(fh_log != NULL) fprintf(fh_log, "detected oversized snaplen (%d): %d\n", pcapfhdr.snaplen, pcapfhdr.version_minor);
48974897 }
48984898
48994899 while(1)
49614961 fprintf(stdout, "\nsummary capture file\n"
49624962 "--------------------\n"
49634963 "file name................................: %s\n"
4964 "version (pcap/cap).......................: %d.%d (very basic format without any additional information)\n"
4964 "version (pcap/cap).......................: %d.%d (very basic format without any additional information)\n"
49654965 , basename(pcaporgname), versionmajor, versionminor
49664966 );
49674967
49994999 if(option->option_code == SHB_EOC) return 0;
50005000 padding = 0;
50015001 if(option->option_length > OPTIONLEN_MAX) return option->option_length;
5002 if((option->option_length %4)) padding = 4 -(option->option_length %4);
5002 if((option->option_length %4)) padding = 4 -(option->option_length %4);
50035003 if(option->option_code == SHB_HARDWARE)
50045004 {
50055005 if(option->option_length < OPTIONLEN_MAX)
51965196 }
51975197 pcapngbh = (block_header_t*)pcpngblock;
51985198 blocktype = pcapngbh->block_type;
5199 blocklen = pcapngbh->total_length;
5199 blocklen = pcapngbh->total_length;
52005200 blockmagic = pcapngbh->byte_order_magic;
52015201 #ifdef BIG_ENDIAN_HOST
52025202 blocktype = byte_swap_32(blocktype);
54315431 "weak candidate...........................: %s\n"
54325432 "MAC ACCESS POINT.........................: %02x%02x%02x%02x%02x%02x (incremented on every new client)\n"
54335433 "MAC CLIENT...............................: %02x%02x%02x%02x%02x%02x\n"
5434 "REPLAYCOUNT..............................: %" PRIu64 "\n"
5434 "REPLAYCOUNT..............................: %" PRIu64 "\n"
54355435 "ANONCE...................................: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n"
54365436 "SNONCE...................................: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n"
54375437 , basename(pcaporgname), versionmajor, versionminor,
751751
752752 static const char *word[] =
753753 {
754 "amaranth", "amber", "amethyst", "apricot", "aqua", "aquamarine", "azure",
755 "baby", "beige", "brick", "black", "blue", "blush", "bronze", "brown",
756 "burgundy", "byzantium",
757 "carmine", "cerise", "cerulean", "champagne", "chartreuse", "chestnut", "chocolate", "cobalt",
758 "coffee", "copper", "cordovan", "coral", "crimson", "cyan",
759 "desert",
760 "electric", "emerald", "erin",
761 "garnet", "gold", "gray", "green",
762 "harlequin",
763 "indigo", "ivory",
764 "jade", "jungle",
765 "lavender", "lemon", "lilac", "lime",
766 "magenta", "maroon", "mauve",
767 "navy",
768 "ochre", "olive", "orange", "orchid",
769 "peach", "pear", "periwinkle", "persian", "pink", "plum", "prussian", "puce",
770 "purple",
771 "raspberry", "red", "rose", "ruby",
772 "sage", "salmon", "sangria", "sapphire", "scarlet", "sepia", "silver", "slate",
773 "spring",
774 "tan", "taupe", "teal", "turquoise",
775 "ultramarine",
776 "violet", "viridian",
777 "white",
778 "yellow"
754 "amber", "aqua",
755 "brick", "bronze", "burgundy",
756 "chestnut", "cobalt", "copper", "coral", "cordovan", "crimson", "cyan",
757 "emerald",
758 "garnet", "gold", "green", "grey",
759 "indigo",
760 "lavender", "lemon",
761 "magenta",
762 "olive", "orchid",
763 "peach", "periwinkle", "pewter", "plum", "purple",
764 "rose",
765 "sage", "sepia", "silver",
766 "teal", "turquoise"
779767 };
780768
781769 for (w = 0; w < (sizeof(word) / sizeof(char *)); w++ )
784772 {
785773 for (j = 0; j < 10000; j++)
786774 {
787 // 2-2
775 // 2-2 test
776 /*
788777 if (i < 100 && j < 100)
789778 {
790779 fprintf(fhout, "%s-%02d-%02d\n", word[w], i, j);
780 fprintf(fhout, "%02d-%s-%02d\n", i, word[w], j);
781 fprintf(fhout, "%02d-%02d-%s\n", i, j, word[w]);
791782 }
792 // 2-3
783 */
784 // 2-3 test
785 /*
793786 if (i < 100 && j < 1000)
794787 {
795788 fprintf(fhout, "%s-%02d-%03d\n", word[w], i, j);
796 /*
797 fprintf(fhout, "%02d-%s-%03d\n", i, word[w], j); // test
798 fprintf(fhout, "%02d-%03d-%s\n", i, j, word[w]); // test
799 */
789 fprintf(fhout, "%02d-%s-%03d\n", i, word[w], j);
790 fprintf(fhout, "%02d-%03d-%s\n", i, j, word[w]);
800791 }
792 */
801793 // 2-4
802794 if (i < 100 && j < 10000)
803795 {
804 fprintf(fhout, "%s-%02d-%04d\n", word[w], i, j);
796 //fprintf(fhout, "%s-%02d-%04d\n", word[w], i, j); // test
805797 fprintf(fhout, "%02d-%s-%04d\n", i, word[w], j);
806 fprintf(fhout, "%02d-%04d-%s\n", i, j, word[w]);
798 //fprintf(fhout, "%02d-%04d-%s\n", i, j, word[w]); // test
807799 }
808800 // 3-2 test
809801 /*
826818 {
827819 fprintf(fhout, "%s-%04d-%02d\n", word[w], i, j);
828820 fprintf(fhout, "%04d-%s-%02d\n", i, word[w], j);
829 fprintf(fhout, "%04d-%02d-%s\n", i, j, word[w]);
821 //fprintf(fhout, "%04d-%02d-%s\n", i, j, word[w]); // test
830822 }
831823 }
832824
20622054 {
20632055 for(k6 = 0; k6 <= 0x0f; k6++)
20642056 {
2065 for(k7 = 0; k7 < 100; k7++)
2066 {
2067 fprintf(fhout, "%c%d%c%02d%02d%02d%02d%d%02d%02d\n", k1, k2, k3, k4, hextable[k5], hextable[k6], k7, k2, k8, k9);
2068 }
2057 for(k7 = 0; k7 < 100; k7++) fprintf(fhout, "%c%d%c%02d%02d%02d%02d%d%02d%02d\n", k1, k2, k3, k4, hextable[k5], hextable[k6], k7, k2, k8, k9);
20692058 }
20702059 }
20712060 }
22552244 pin = (macaddr & 0xffffff) % 10000000;
22562245 pin = ((pin * 10) + wpspinchecksum(pin));
22572246 fprintf(fhout, "%08d\n", pin);
2247
2248 pin = (((macaddr >> 24) &0xff) *256 *256) +(((macaddr >> 16) &0xff) *256) + ((macaddr >> 8) &0xff);
2249 pin = pin % 10000000;
2250 pin = ((pin * 10) + wpspinchecksum(pin));
2251 fprintf(fhout, "%08d\n", pin);
22582252 return;
22592253 }
22602254 /*===========================================================================*/
23432337 static int me;
23442338 static char pskstring[PSKSTRING_LEN_MAX] = {};
23452339
2346 fprintf(stdout, "%012llX\n", macaddr &0xffffffffff);
2340 fprintf(fhout, "%012llX\n", macaddr &0xffffffffff);
23472341
23482342 nici = ~macaddr &0xffffff;
23492343 fprintf(fhout, "wlan%06x\n", nici);