forked from ZerBea/hcxtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hcxhashtool.c
2805 lines (2665 loc) · 89.7 KB
/
hcxhashtool.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#define _GNU_SOURCE
#include <fcntl.h>
#include <errno.h>
#include <getopt.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <time.h>
#include <limits.h>
#include <inttypes.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <curl/curl.h>
#include <arpa/inet.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/crypto.h>
#include <openssl/evp.h>
#include <openssl/ssl.h>
#if defined (__APPLE__) || defined(__OpenBSD__)
#include <libgen.h>
#include <sys/socket.h>
#else
#include <stdio_ext.h>
#endif
#ifdef __linux__
#include <linux/limits.h>
#endif
#include "include/hcxhashtool.h"
#include "include/strings.c"
#include "include/fileops.c"
#include "include/ieee80211.h"
#include "include/byteops.c"
/*===========================================================================*/
/* global var */
static const char *usedoui;
static int ouicount;
static int ouilistcount;
static ouilist_t *ouilist;
static hashlist_t *hashlist;
static long int pbkdf2count;
static long int pbkdf2readerrorcount;
static long int hashlistcount;
static long int readcount;
static long int readerrorcount;
static long int pmkideapolcount;
static long int pmkidcount;
static long int eapolcount;
static long int pmkidwrittencount;
static long int eapolwrittencount;
static long int essidwrittencount;
static long int essidrawwrittencount;
static long int hccapxwrittencount;
static long int hccapwrittencount;
static long int johnpmkidwrittencount;
static long int johneapolwrittencount;
static EVP_MAC *hmac;
static EVP_MAC *cmac;
static EVP_MAC_CTX *ctxhmac;
static EVP_MAC_CTX *ctxcmac;
static OSSL_PARAM paramsmd5[3];
static OSSL_PARAM paramssha1[3];
static OSSL_PARAM paramssha256[3];
static OSSL_PARAM paramsaes128[3];
static int hashtype;
static int essidlen;
static int essidlenmin;
static int essidlenmax;
static int filteressidlen;
static char *filteressidptr;
static int filteressidpartlen;
static char *filteressidpartptr;
static char *filtervendorptr;
static char *filtervendorapptr;
static char *filtervendorclientptr;
static bool flagpsk;
static bool flagpmk;
static bool flagessidgroup;
static bool flagmacapgroup;
static bool flagmacclientgroup;
static bool flagouigroup;
static bool flagvendorout;
static bool flaghccapsingleout;
static bool caseflag;
static bool flagfiltermacap;
static uint8_t filtermacap[6];
static bool flagfiltermacclient;
static uint8_t filtermacclient[6];
static bool flagfilterouiap;
static uint8_t filterouiap[3];
static bool flagfilterouiclient;
static uint8_t filterouiclient[3];
static bool flagfilterauthorized;
static bool flagfilterchallenge;
static bool flagfilterrcchecked;
static bool flagfilterrcnotchecked;
static bool flagfilterapless;
static int pskptrlen;
static char *pskptr;
static uint8_t pmk[32];
/*===========================================================================*/
static void closelists()
{
if(hashlist != NULL) free(hashlist);
if(ouilist != NULL) free(ouilist);
if(ctxhmac != NULL)
{
EVP_MAC_CTX_free(ctxhmac);
EVP_MAC_free(hmac);
}
if(ctxcmac != NULL)
{
EVP_MAC_CTX_free(ctxcmac);
EVP_MAC_free(cmac);
}
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
return;
}
/*===========================================================================*/
static bool initlists()
{
ouicount = 0;
ouilistcount = OUILIST_MAX;
hashlistcount = HASHLIST_MAX;
readcount = 0;
readerrorcount = 0;
pmkideapolcount = 0;
pmkidcount = 0;
eapolcount = 0;
pmkidwrittencount = 0;
eapolwrittencount = 0;
essidwrittencount = 0;
essidrawwrittencount = 0;
johnpmkidwrittencount = 0;
johneapolwrittencount = 0;
hccapxwrittencount = 0;
hccapwrittencount = 0;
if((hashlist = (hashlist_t*)calloc(hashlistcount, HASHLIST_SIZE)) == NULL) return false;
if((ouilist = (ouilist_t*)calloc(ouilistcount, OUILIST_SIZE)) == NULL) return false;
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
hmac = NULL;
ctxhmac = NULL;
cmac = NULL;
ctxcmac = NULL;
hmac = EVP_MAC_fetch(NULL, "hmac", NULL);
if(hmac == NULL) return false;
cmac = EVP_MAC_fetch(NULL, "cmac", NULL);
if(cmac == NULL) return false;
paramsmd5[0] = OSSL_PARAM_construct_utf8_string("digest", "md5", 0);
paramsmd5[1] = OSSL_PARAM_construct_end();
paramssha1[0] = OSSL_PARAM_construct_utf8_string("digest", "sha1", 0);
paramssha1[1] = OSSL_PARAM_construct_end();
paramssha256[0] = OSSL_PARAM_construct_utf8_string("digest", "sha256", 0);
paramssha256[1] = OSSL_PARAM_construct_end();
paramsaes128[0] = OSSL_PARAM_construct_utf8_string("cipher", "aes-128-cbc", 0);
paramsaes128[1] = OSSL_PARAM_construct_end();
ctxhmac = EVP_MAC_CTX_new(hmac);
if(ctxhmac == NULL) return false;
ctxcmac = EVP_MAC_CTX_new(cmac);
if(ctxcmac == NULL) return false;
return true;
}
/*===========================================================================*/
static char *getvendor(uint8_t *mac)
{
static ouilist_t * zeiger;
static char *unknown = "Unknown";
for(zeiger = ouilist; zeiger < ouilist +ouicount; zeiger++)
{
if(memcmp(zeiger->oui, mac, 3) == 0) return zeiger->vendor;
if(memcmp(zeiger->oui, mac, 3) > 0) return unknown;
}
return unknown;
}
/*===========================================================================*/
static void printstatus()
{
static char *vendor;
fprintf(stdout, "\nOUI information file..........: %s\n", usedoui);
if(ouicount > 0) fprintf(stdout, "OUI entries...................: %d\n", ouicount);
if(readcount > 0) fprintf(stdout, "total lines read..............: %ld\n", readcount);
if(flagvendorout == true)
{
fprintf(stdout, "\n");
return;
}
if(pbkdf2count > 0) fprintf(stdout, "PBKDF2 lines..................: %ld\n", pbkdf2count);
if(pbkdf2readerrorcount > 0) fprintf(stdout, "PBKDF2 errors.................: %ld\n", pbkdf2readerrorcount);
if(readerrorcount > 0) fprintf(stdout, "read errors...................: %ld\n", readerrorcount);
if(pmkideapolcount > 0) fprintf(stdout, "valid hash lines..............: %ld\n", pmkideapolcount);
if(pmkidcount > 0) fprintf(stdout, "PMKID hash lines..............: %ld\n", pmkidcount);
if(eapolcount > 0) fprintf(stdout, "EAPOL hash lines..............: %ld\n", eapolcount);
if(essidlenmin != 0) fprintf(stdout, "filter by ESSID len min.......: %d\n", essidlenmin);
if(essidlenmax != 32) fprintf(stdout, "filter by ESSID len max.......: %d\n", essidlenmax);
if(filteressidptr != NULL) fprintf(stdout, "filter by ESSID...............: %s\n", filteressidptr);
if(filteressidpartptr != NULL) fprintf(stdout, "filter by part of ESSID.......: %s\n", filteressidpartptr);
if(flagfiltermacap == true)
{
vendor = getvendor(filtermacap);
fprintf(stdout, "filter by MAC.................: %02x%02x%02x%02x%02x%02x (%s)\n", filtermacap[0], filtermacap[1], filtermacap[2], filtermacap[3], filtermacap[4], filtermacap[5], vendor);
}
if(flagfiltermacclient == true)
{
vendor = getvendor(filtermacclient);
fprintf(stdout, "filter by MAC.................: %02x%02x%02x%02x%02x%02x (%s)\n", filtermacclient[0], filtermacclient[1], filtermacclient[2], filtermacclient[3], filtermacclient[4], filtermacclient[5], vendor);
}
if(flagfilterouiap == true)
{
vendor = getvendor(filterouiap);
fprintf(stdout, "filter AP by OUI..............: %02x%02x%02x (%s)\n", filterouiap[0], filterouiap[1], filterouiap[2], vendor);
}
if(filtervendorptr != NULL) fprintf(stdout, "filter AP and CLIENT by VENDOR: %s\n", filtervendorptr);
if(filtervendorapptr != NULL) fprintf(stdout, "filter AP by VENDOR...........: %s\n", filtervendorapptr);
if(filtervendorclientptr != NULL) fprintf(stdout, "filter CLIENT by VENDOR.......: %s\n", filtervendorclientptr);
if(flagfilterouiclient == true)
{
vendor = getvendor(filterouiclient);
fprintf(stdout, "filter CLIENT by OUI..........: %02x%02x%02x (%s)\n", filterouiclient[0], filterouiclient[1], filterouiclient[2], vendor);
}
if(flagfilterapless == true) fprintf(stdout, "filter by M2..................: requested from client (AP-LESS)\n");
if(flagfilterrcchecked == true) fprintf(stdout, "filter by replaycount.........: checked\n");
if(flagfilterrcnotchecked == true) fprintf(stdout, "filter by replaycount.........: not checked\n");
if(flagfilterauthorized == true) fprintf(stdout, "filter by status..............: authorized (M1M4, M2M3 or M3M4)\n");
if(flagfilterchallenge == true) fprintf(stdout, "filter by status..............: challenge (M1M2)\n");
if(pmkidwrittencount > 0) fprintf(stdout, "PMKID written.................: %ld\n", pmkidwrittencount);
if(eapolwrittencount > 0) fprintf(stdout, "EAPOL written.................: %ld\n", eapolwrittencount);
if(johnpmkidwrittencount > 0) fprintf(stdout, "PMKID written to john.........: %ld\n", johnpmkidwrittencount);
if(johneapolwrittencount > 0) fprintf(stdout, "EAPOL written to john.........: %ld\n", johneapolwrittencount);
if(hccapxwrittencount > 0) fprintf(stdout, "EAPOL written to hccapx.......: %ld\n", hccapxwrittencount);
if(hccapwrittencount > 0) fprintf(stdout, "EAPOL written to hccap........: %ld\n", hccapwrittencount);
if(essidwrittencount > 0) fprintf(stdout, "ESSID (unique) written........: %ld\n", essidwrittencount);
if(essidrawwrittencount > 0) fprintf(stdout, "ESSID written.................: %ld\n", essidrawwrittencount);
fprintf(stdout, "\n");
return;
}
/*===========================================================================*/
static void testeapolpmk(hashlist_t *zeiger)
{
static int keyver;
static int p;
static wpakey_t *wpak;
static uint8_t *pkeptr;
static uint8_t eapoltmp[1024];
static uint8_t pkedata[102];
wpak = (wpakey_t*)&zeiger->eapol[EAPAUTH_SIZE];
keyver = ntohs(wpak->keyinfo) & WPA_KEY_INFO_TYPE_MASK;
if((keyver == 1) || (keyver == 2))
{
memset(&pkedata, 0, sizeof(pkedata));
pkeptr = pkedata;
memcpy(pkeptr, "Pairwise key expansion", 23);
if(memcmp(zeiger->ap, zeiger->client, 6) < 0)
{
memcpy(pkeptr +23, zeiger->ap, 6);
memcpy(pkeptr +29, zeiger->client, 6);
}
else
{
memcpy(pkeptr +23, zeiger->client, 6);
memcpy(pkeptr +29, zeiger->ap, 6);
}
if(memcmp(zeiger->nonce, wpak->nonce, 32) < 0)
{
memcpy (pkeptr +35, zeiger->nonce, 32);
memcpy (pkeptr +67, wpak->nonce, 32);
}
else
{
memcpy (pkeptr +35, wpak->nonce, 32);
memcpy (pkeptr +67, zeiger->nonce, 32);
}
if(!EVP_MAC_init(ctxhmac, pmk, 32, paramssha1)) return;
if(!EVP_MAC_update(ctxhmac, pkedata, 100)) return;
if(!EVP_MAC_final(ctxhmac, pkedata, NULL, 100)) return;
fprintf(stdout, "\n");
if(keyver == 2)
{
memset(eapoltmp, 0, 1024);
memcpy(eapoltmp, zeiger->eapol, zeiger->eapauthlen);
if(!EVP_MAC_init(ctxhmac, pkedata, 16, paramssha1)) return;
if(!EVP_MAC_update(ctxhmac, eapoltmp, zeiger->eapauthlen)) return;
if(!EVP_MAC_final(ctxhmac, eapoltmp, NULL, zeiger->eapauthlen)) return;
}
if(keyver == 1)
{
memset(eapoltmp, 0, 1024);
memcpy(eapoltmp, zeiger->eapol, zeiger->eapauthlen);
if(!EVP_MAC_init(ctxhmac, pkedata, 16, paramsmd5)) return;
if(!EVP_MAC_update(ctxhmac, eapoltmp, zeiger->eapauthlen)) return;
if(!EVP_MAC_final(ctxhmac, eapoltmp, NULL, zeiger->eapauthlen)) return;
}
}
else if(keyver == 3)
{
memset(&pkedata, 0, sizeof(pkedata));
pkedata[0] = 1;
pkedata[1] = 0;
pkeptr = pkedata +2;
memcpy(pkeptr, "Pairwise key expansion", 22);
if(memcmp(zeiger->ap, zeiger->client, 6) < 0)
{
memcpy(pkeptr +22, zeiger->ap, 6);
memcpy(pkeptr +28, zeiger->client, 6);
}
else
{
memcpy(pkeptr +22, zeiger->client, 6);
memcpy(pkeptr +28, zeiger->ap, 6);
}
if(memcmp(zeiger->nonce, wpak->nonce, 32) < 0)
{
memcpy (pkeptr +34, zeiger->nonce, 32);
memcpy (pkeptr +66, wpak->nonce, 32);
}
else
{
memcpy (pkeptr +34, wpak->nonce, 32);
memcpy (pkeptr +66, zeiger->nonce, 32);
}
pkedata[100] = 0x80;
pkedata[101] = 1;
if(!EVP_MAC_init(ctxhmac, pmk, 32, paramssha256)) return;
if(!EVP_MAC_update(ctxhmac, pkedata, 102)) return;
if(!EVP_MAC_final(ctxhmac, pkedata, NULL, 102)) return;
memset(eapoltmp, 0, 1024);
memcpy(eapoltmp, zeiger->eapol, zeiger->eapauthlen);
if(!EVP_MAC_init(ctxcmac, pkedata, 16, paramsaes128)) return;
if(!EVP_MAC_update(ctxcmac, eapoltmp, zeiger->eapauthlen)) return;
if(!EVP_MAC_final(ctxcmac, eapoltmp, NULL, zeiger->eapauthlen)) return;
}
else return;
if(memcmp(eapoltmp, zeiger->hash, 16) == 0)
{
for(p = 0; p < 6; p++) fprintf(stdout, "%02x", zeiger->client[p]);
fprintf(stdout, ":");
for(p = 0; p < 6; p++) fprintf(stdout, "%02x", zeiger->ap[p]);
if(zeiger->essidlen != 0)
{
if(ispotfilestring(zeiger->essidlen, (char*)zeiger->essid) == true) fprintf(stdout, ":%.*s", zeiger->essidlen, zeiger->essid);
else
{
fprintf(stdout, ":$HEX[");
for(p = 0; p < zeiger->essidlen; p++) fprintf(stdout, "%02x", zeiger->essid[p]);
fprintf(stdout, "]");
}
}
else fprintf(stdout, ":");
fprintf(stdout, ":%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",
pmk[0], pmk[1], pmk[2], pmk[3], pmk[4], pmk[5], pmk[6], pmk[7],
pmk[8], pmk[9], pmk[10], pmk[11], pmk[12], pmk[13], pmk[14], pmk[15],
pmk[16], pmk[17], pmk[18], pmk[19], pmk[20], pmk[21], pmk[22], pmk[23],
pmk[24], pmk[25], pmk[26], pmk[27], pmk[28], pmk[29], pmk[30], pmk[31]);
if(pskptr != NULL)
{
if(ispotfilestring(pskptrlen, pskptr) == true) fprintf(stdout, ":%s", pskptr);
else
{
fprintf(stdout, ":$HEX[");
for(p = 0; p < pskptrlen; p++) fprintf(stdout, "%02x", pskptr[p]);
fprintf(stdout, "]");
}
}
fprintf(stdout, "\n");
}
return;
}
/*===========================================================================*/
static void testpmkidpmk(hashlist_t *zeiger)
{
static int p;
static char *pmkname = "PMK Name";
static uint8_t message[20];
memcpy(message, pmkname, 8);
memcpy(&message[8], zeiger->ap, 6);
memcpy(&message[14], zeiger->client, 6);
if(!EVP_MAC_init(ctxhmac, pmk, 32, paramssha1)) return;
if(!EVP_MAC_update(ctxhmac, message, 20)) return;
if(!EVP_MAC_final(ctxhmac, message, NULL, 20)) return;
if(memcmp(message, zeiger->hash, 16) == 0)
{
for(p = 0; p < 6; p++) fprintf(stdout, "%02x", zeiger->client[p]);
fprintf(stdout, ":");
for(p = 0; p < 6; p++) fprintf(stdout, "%02x", zeiger->ap[p]);
if(zeiger->essidlen != 0)
{
if(ispotfilestring(zeiger->essidlen, (char*)zeiger->essid) == true) fprintf(stdout, ":%.*s", zeiger->essidlen, zeiger->essid);
else
{
fprintf(stdout, ":$HEX[");
for(p = 0; p < zeiger->essidlen; p++) fprintf(stdout, "%02x", zeiger->essid[p]);
fprintf(stdout, "]");
}
}
else fprintf(stdout, ":");
fprintf(stdout, ":%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",
pmk[0], pmk[1], pmk[2], pmk[3], pmk[4], pmk[5], pmk[6], pmk[7],
pmk[8], pmk[9], pmk[10], pmk[11], pmk[12], pmk[13], pmk[14], pmk[15],
pmk[16], pmk[17], pmk[18], pmk[19], pmk[20], pmk[21], pmk[22], pmk[23],
pmk[24], pmk[25], pmk[26], pmk[27], pmk[28], pmk[29], pmk[30], pmk[31]);
if(pskptr != NULL)
{
if(ispotfilestring(pskptrlen, pskptr) == true) fprintf(stdout, ":%s", pskptr);
else
{
fprintf(stdout, ":$HEX[");
for(p = 0; p < pskptrlen; p++) fprintf(stdout, "%02x", pskptr[p]);
fprintf(stdout, "]");
}
}
fprintf(stdout, "\n");
}
return;
}
/*===========================================================================*/
static void testhashfilepmk()
{
static hashlist_t *zeiger;
for(zeiger = hashlist; zeiger < hashlist +pmkideapolcount; zeiger++)
{
if(zeiger->type == HCX_TYPE_PMKID) testpmkidpmk(zeiger);
else if (zeiger->type == HCX_TYPE_EAPOL) testeapolpmk(zeiger);
}
return;
}
/*===========================================================================*/
static bool dopbkdf2(int psklen, char *psk, int essidlen, uint8_t *essid)
{
if(PKCS5_PBKDF2_HMAC_SHA1(psk, psklen, essid, essidlen, 4096, 32, pmk) == 0) return false;
return true;
}
/*===========================================================================*/
static void testhashfilepsk()
{
static hashlist_t *zeiger, *zeigerold;
zeigerold = hashlist;
if(dopbkdf2(pskptrlen, pskptr, zeigerold->essidlen, zeigerold->essid) == true)
{
if(zeigerold->type == HCX_TYPE_PMKID) testpmkidpmk(zeigerold);
if(zeigerold->type == HCX_TYPE_EAPOL) testeapolpmk(zeigerold);
}
for(zeiger = hashlist +1; zeiger < hashlist +pmkideapolcount; zeiger++)
{
if((zeigerold->essidlen == zeiger->essidlen) && (memcmp(zeigerold->essid, zeiger->essid, zeigerold->essidlen) == 0))
{
if(zeiger->type == HCX_TYPE_PMKID) testpmkidpmk(zeiger);
if(zeiger->type == HCX_TYPE_EAPOL) testeapolpmk(zeiger);
}
else
{
if(dopbkdf2(pskptrlen, pskptr, zeiger->essidlen, zeiger->essid) == true)
{
if(zeiger->type == HCX_TYPE_PMKID) testpmkidpmk(zeiger);
if(zeiger->type == HCX_TYPE_EAPOL) testeapolpmk(zeiger);
}
}
zeigerold = zeiger;
}
return;
}
/*===========================================================================*/
static bool isoui(uint8_t *macap, uint8_t *macclient)
{
static ouilist_t *zeiger;
for(zeiger = ouilist; zeiger < ouilist +ouicount; zeiger++)
{
if(((zeiger->type &TYPE_AP) == TYPE_AP) && (memcmp(macap, zeiger->oui, 3) == 0)) return true;
if(((zeiger->type &TYPE_CLIENT) == TYPE_CLIENT) && (memcmp(macclient, zeiger->oui, 3) == 0)) return true;
}
return false;
}
/*===========================================================================*/
static bool ispartof(int plen, uint8_t *pbuff, int slen, uint8_t *sbuff)
{
static int p;
static uint8_t buffers[32];
static uint8_t bufferp[32];
if(plen > slen) return false;
if(caseflag == false)
{
for(p = 0; p <= slen -plen; p++)
{
if(memcmp(&sbuff[p], pbuff, plen) == 0) return true;
}
return false;
}
else
{
memset(buffers, 0, 32);
for(p = 0; p < slen; p++)
{
if(isupper(sbuff[p])) buffers[p] = tolower(sbuff[p]);
else buffers[p] = sbuff[p];
}
memset(bufferp, 0, 32);
for(p = 0; p < plen; p++)
{
if(isupper(pbuff[p])) bufferp[p] = tolower(pbuff[p]);
else bufferp[p] = pbuff[p];
}
for(p = 0; p <= slen -plen; p++)
{
if(memcmp(&buffers[p], bufferp, plen) == 0) return true;
}
return false;
}
return false;
}
/*===========================================================================*/
static void hccap2base(unsigned char *in, unsigned char b, FILE *fh_john)
{
static const char itoa64[64] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
fprintf(fh_john, "%c", (itoa64[in[0] >> 2]));
fprintf(fh_john, "%c", (itoa64[((in[0] & 0x03) << 4) | (in[1] >> 4)]));
if(b)
{
fprintf(fh_john, "%c", (itoa64[((in[1] & 0x0f) << 2) | (in[2] >> 6)]));
fprintf(fh_john, "%c", (itoa64[in[2] & 0x3f]));
}
else fprintf(fh_john, "%c", (itoa64[((in[1] & 0x0f) << 2)]));
return;
}
/*===========================================================================*/
static void writejohnrecord(FILE *fh_john, hashlist_t *zeiger)
{
struct hccap_s
{
char essid[36];
unsigned char ap[6];
unsigned char client[6];
unsigned char snonce[32];
unsigned char anonce[32];
unsigned char eapol[256];
int eapol_size;
int keyver;
unsigned char keymic[16];
};
typedef struct hccap_s hccap_t;
#define HCCAP_SIZE (sizeof(hccap_t))
static wpakey_t *wpak;
static int i;
static unsigned char *hcpos;
static hccap_t hccap;
if((zeiger->essidlen < essidlenmin) || (zeiger->essidlen > essidlenmax)) return;
if(((zeiger->type &hashtype) != HCX_TYPE_PMKID) && ((zeiger->type &hashtype) != HCX_TYPE_EAPOL)) return;
if(flagfiltermacap == true) if(memcmp(&filtermacap, zeiger->ap, 6) != 0) return;
if(flagfiltermacclient == true) if(memcmp(&filtermacclient, zeiger->client, 6) != 0) return;
if(flagfilterouiap == true) if(memcmp(&filterouiap, zeiger->ap, 3) != 0) return;
if(flagfilterouiclient == true) if(memcmp(&filterouiclient, zeiger->client, 3) != 0) return;
if(filteressidptr != NULL)
{
if(zeiger->essidlen != filteressidlen) return;
if(memcmp(zeiger->essid, filteressidptr, zeiger->essidlen) != 0) return;
}
if(filteressidpartptr != NULL)
{
if(ispartof(filteressidpartlen, (uint8_t*)filteressidpartptr, zeiger->essidlen, zeiger->essid) == false) return;
}
if((filtervendorptr != NULL) || (filtervendorapptr != NULL) || (filtervendorclientptr != NULL))
{
if(isoui(zeiger->ap, zeiger->client) == false) return;
}
if((flagfilterapless == true) && ((zeiger->mp &0x10) != 0x10)) return;
if((flagfilterrcchecked == true) && ((zeiger->mp &0x80) == 0x80)) return;
if((flagfilterrcnotchecked == true) && ((zeiger->mp &0x80) != 0x80)) return;
if((flagfilterauthorized == true) && ((zeiger->mp &0x07) == 0x00)) return;
if((flagfilterchallenge == true) && ((zeiger->mp &0x07) != 0x01)) return;
if(zeiger->type == HCX_TYPE_PMKID)
{
fprintf(fh_john, "%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*",
zeiger->hash[0], zeiger->hash[1], zeiger->hash[2], zeiger->hash[3], zeiger->hash[4], zeiger->hash[5], zeiger->hash[6], zeiger->hash[7],
zeiger->hash[8], zeiger->hash[9], zeiger->hash[10], zeiger->hash[11], zeiger->hash[12], zeiger->hash[13], zeiger->hash[14], zeiger->hash[15],
zeiger->ap[0], zeiger->ap[1], zeiger->ap[2], zeiger->ap[3], zeiger->ap[4], zeiger->ap[5],
zeiger->client[0], zeiger->client[1], zeiger->client[2], zeiger->client[3], zeiger->client[4], zeiger->client[5]);
for(i = 0; i < zeiger->essidlen; i++) fprintf(fh_john, "%02x", zeiger->essid[i]);
fprintf(fh_john, "\n");
johnpmkidwrittencount++;
return;
}
wpak = (wpakey_t*)(zeiger->eapol +EAPAUTH_SIZE);
memset(&hccap, 0, sizeof(hccap_t));
memcpy(&hccap.essid, zeiger->essid, zeiger->essidlen);
memcpy(&hccap.ap, zeiger->ap, 6);
memcpy(&hccap.client, zeiger->client, 6);
memcpy(&hccap.anonce, zeiger->nonce, 32);
memcpy(&hccap.snonce, wpak->nonce, 32);
memcpy(&hccap.keymic, zeiger->hash, 16);
hccap.keyver = ntohs(wpak->keyinfo) & WPA_KEY_INFO_TYPE_MASK;
hccap.eapol_size = zeiger->eapauthlen;
memcpy(&hccap.eapol, zeiger->eapol, zeiger->eapauthlen);
#ifdef BIG_ENDIAN_HOST
hccap.eapol_size = byte_swap_16(hccap.eapol_size);
#endif
fprintf(fh_john, "%.*s:$WPAPSK$%.*s#", zeiger->essidlen, zeiger->essid, zeiger->essidlen, zeiger->essid);
hcpos = (unsigned char*)&hccap;
for (i = 36; i + 3 < (int)HCCAP_SIZE; i += 3) hccap2base(&hcpos[i], 1, fh_john);
hccap2base(&hcpos[i], 0, fh_john);
fprintf(fh_john, ":%02x-%02x-%02x-%02x-%02x-%02x:%02x-%02x-%02x-%02x-%02x-%02x:%02x%02x%02x%02x%02x%02x",
zeiger->client[0], zeiger->client[1], zeiger->client[2], zeiger->client[3], zeiger->client[4], zeiger->client[5],
zeiger->ap[0], zeiger->ap[1], zeiger->ap[2], zeiger->ap[3], zeiger->ap[4], zeiger->ap[5],
zeiger->ap[0], zeiger->ap[1], zeiger->ap[2], zeiger->ap[3], zeiger->ap[4], zeiger->ap[5]);
if(hccap.keyver == 1) fprintf(fh_john, "::WPA");
else fprintf(fh_john, "::WPA2");
if((zeiger->mp &0x7) == 0) fprintf(fh_john, ":not verified");
else fprintf(fh_john, ":verified");
fprintf(fh_john, ":converted by hcxhastool\n");
johneapolwrittencount++;
return;
}
/*===========================================================================*/
static void writejohnfile(char *johnoutname)
{
static FILE *fh_john;
static hashlist_t *zeiger;
static struct stat statinfo;
if(johnoutname != NULL)
{
if((fh_john = fopen(johnoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", johnoutname, strerror(errno));
return;
}
}
for(zeiger = hashlist; zeiger < hashlist +pmkideapolcount; zeiger++) writejohnrecord(fh_john, zeiger);
if(fh_john != NULL) fclose(fh_john);
if(johnoutname != NULL)
{
if(stat(johnoutname, &statinfo) == 0)
{
if(statinfo.st_size == 0) remove(johnoutname);
}
}
return;
}
/*===========================================================================*/
static void writehccaprecord(FILE *fh_hccap, hashlist_t *zeiger)
{
struct hccap_s
{
char essid[36];
unsigned char ap[6];
unsigned char client[6];
unsigned char snonce[32];
unsigned char anonce[32];
unsigned char eapol[256];
int eapol_size;
int keyver;
unsigned char keymic[16];
};
typedef struct hccap_s hccap_t;
#define HCCAP_SIZE (sizeof(hccap_t))
static wpakey_t *wpak;
static hccap_t hccap;
if(zeiger->type == HCX_TYPE_PMKID) return;
if((zeiger->essidlen < essidlenmin) || (zeiger->essidlen > essidlenmax)) return;
if(((zeiger->type &hashtype) != HCX_TYPE_PMKID) && ((zeiger->type &hashtype) != HCX_TYPE_EAPOL)) return;
if(flagfiltermacap == true) if(memcmp(&filtermacap, zeiger->ap, 6) != 0) return;
if(flagfiltermacclient == true) if(memcmp(&filtermacclient, zeiger->client, 6) != 0) return;
if(flagfilterouiap == true) if(memcmp(&filterouiap, zeiger->ap, 3) != 0) return;
if(flagfilterouiclient == true) if(memcmp(&filterouiclient, zeiger->client, 3) != 0) return;
if(filteressidptr != NULL)
{
if(zeiger->essidlen != filteressidlen) return;
if(memcmp(zeiger->essid, filteressidptr, zeiger->essidlen) != 0) return;
}
if(filteressidpartptr != NULL)
{
if(ispartof(filteressidpartlen, (uint8_t*)filteressidpartptr, zeiger->essidlen, zeiger->essid) == false) return;
}
if((filtervendorptr != NULL) || (filtervendorapptr != NULL) || (filtervendorclientptr != NULL))
{
if(isoui(zeiger->ap, zeiger->client) == false) return;
}
if((flagfilterapless == true) && ((zeiger->mp &0x10) != 0x10)) return;
if((flagfilterrcchecked == true) && ((zeiger->mp &0x80) == 0x80)) return;
if((flagfilterrcnotchecked == true) && ((zeiger->mp &0x80) != 0x80)) return;
if((flagfilterauthorized == true) && ((zeiger->mp &0x07) == 0x00)) return;
if((flagfilterchallenge == true) && ((zeiger->mp &0x07) != 0x01)) return;
wpak = (wpakey_t*)(zeiger->eapol +EAPAUTH_SIZE);
memset(&hccap, 0, sizeof(hccap_t));
memcpy(&hccap.essid, zeiger->essid, zeiger->essidlen);
memcpy(&hccap.ap, zeiger->ap, 6);
memcpy(&hccap.client, zeiger->client, 6);
memcpy(&hccap.anonce, zeiger->nonce, 32);
memcpy(&hccap.snonce, wpak->nonce, 32);
memcpy(&hccap.keymic, zeiger->hash, 16);
hccap.keyver = ntohs(wpak->keyinfo) & WPA_KEY_INFO_TYPE_MASK;
hccap.eapol_size = zeiger->eapauthlen;
memcpy(&hccap.eapol, zeiger->eapol, zeiger->eapauthlen);
#ifdef BIG_ENDIAN_HOST
hccap.eapol_size = byte_swap_16(hccap.eapol_size);
#endif
fwrite(&hccap, HCCAP_SIZE, 1, fh_hccap);
hccapwrittencount++;
return;
}
/*===========================================================================*/
static void writehccapsinglefile()
{
static int c;
static FILE *fh_hccap;
static hashlist_t *zeiger;
static struct stat statinfo;
static char groupoutname[PATH_MAX];
for(zeiger = hashlist; zeiger < hashlist +pmkideapolcount; zeiger++)
{
c = 0;
do
{
snprintf(groupoutname, PATH_MAX -1, "%02x%02x%02x%02x%02x%02x-%04d.hccap", zeiger->ap[0], zeiger->ap[1], zeiger->ap[2], zeiger->ap[3], zeiger->ap[4], zeiger->ap[5], c);
c++;
}
while (stat(groupoutname, &statinfo) == 0);
if((fh_hccap = fopen(groupoutname, "a")) == NULL) continue;
writehccaprecord(fh_hccap, zeiger);
if(fh_hccap != NULL) fclose(fh_hccap);
if(stat(groupoutname, &statinfo) == 0)
{
if(statinfo.st_size == 0) remove(groupoutname);
}
}
return;
}
/*===========================================================================*/
static void writehccapfile(char *hccapoutname)
{
static FILE *fh_hccap;
static hashlist_t *zeiger;
static struct stat statinfo;
if(hccapoutname != NULL)
{
if((fh_hccap = fopen(hccapoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", hccapoutname, strerror(errno));
return;
}
}
for(zeiger = hashlist; zeiger < hashlist +pmkideapolcount; zeiger++) writehccaprecord(fh_hccap, zeiger);
if(fh_hccap != NULL) fclose(fh_hccap);
if(hccapoutname != NULL)
{
if(stat(hccapoutname, &statinfo) == 0)
{
if(statinfo.st_size == 0) remove(hccapoutname);
}
}
return;
}
/*===========================================================================*/
static void writehccapxrecord(FILE *fh_hccapx, hashlist_t *zeiger)
{
struct hccapx_s
{
uint32_t signature;
#define HCCAPX_SIGNATURE 0x58504348
uint32_t version;
#define HCCAPX_VERSION 4
uint8_t message_pair;
uint8_t essid_len;
uint8_t essid[32];
uint8_t keyver;
uint8_t keymic[16];
uint8_t ap[6];
uint8_t anonce[32];
uint8_t client[6];
uint8_t snonce[32];
uint16_t eapol_len;
uint8_t eapol[256];
} __attribute__((packed));
typedef struct hccapx_s hccapx_t;
#define HCCAPX_SIZE (sizeof(hccapx_t))
static wpakey_t *wpak;
static hccapx_t hccapx;
if(zeiger->type == HCX_TYPE_PMKID) return;
if((zeiger->essidlen < essidlenmin) || (zeiger->essidlen > essidlenmax)) return;
if(((zeiger->type &hashtype) != HCX_TYPE_PMKID) && ((zeiger->type &hashtype) != HCX_TYPE_EAPOL)) return;
if(flagfiltermacap == true) if(memcmp(&filtermacap, zeiger->ap, 6) != 0) return;
if(flagfiltermacclient == true) if(memcmp(&filtermacclient, zeiger->client, 6) != 0) return;
if(flagfilterouiap == true) if(memcmp(&filterouiap, zeiger->ap, 3) != 0) return;
if(flagfilterouiclient == true) if(memcmp(&filterouiclient, zeiger->client, 3) != 0) return;
if(filteressidptr != NULL)
{
if(zeiger->essidlen != filteressidlen) return;
if(memcmp(zeiger->essid, filteressidptr, zeiger->essidlen) != 0) return;
}
if(filteressidpartptr != NULL)
{
if(ispartof(filteressidpartlen, (uint8_t*)filteressidpartptr, zeiger->essidlen, zeiger->essid) == false) return;
}
if((filtervendorptr != NULL) || (filtervendorapptr != NULL) || (filtervendorclientptr != NULL))
{
if(isoui(zeiger->ap, zeiger->client) == false) return;
}
if((flagfilterapless == true) && ((zeiger->mp &0x10) != 0x10)) return;
if((flagfilterrcchecked == true) && ((zeiger->mp &0x80) == 0x80)) return;
if((flagfilterrcnotchecked == true) && ((zeiger->mp &0x80) != 0x80)) return;
if((flagfilterauthorized == true) && ((zeiger->mp &0x07) == 0x00)) return;
if((flagfilterchallenge == true) && ((zeiger->mp &0x07) != 0x01)) return;
wpak = (wpakey_t*)(zeiger->eapol +EAPAUTH_SIZE);
memset (&hccapx, 0, sizeof(hccapx_t));
hccapx.signature = HCCAPX_SIGNATURE;
hccapx.version = HCCAPX_VERSION;
hccapx.message_pair = zeiger->mp;
hccapx.essid_len = zeiger->essidlen;
memcpy(&hccapx.essid, zeiger->essid, zeiger->essidlen);
memcpy(&hccapx.ap, zeiger->ap, 6);
memcpy(&hccapx.client, zeiger->client, 6);
memcpy(&hccapx.anonce, zeiger->nonce, 32);
memcpy(&hccapx.snonce, wpak->nonce, 32);
hccapx.eapol_len = zeiger->eapauthlen;
memcpy(&hccapx.eapol, zeiger->eapol, zeiger->eapauthlen);
hccapx.keyver = ntohs(wpak->keyinfo) & WPA_KEY_INFO_TYPE_MASK;
memcpy(&hccapx.keymic, zeiger->hash, 16);
#ifdef BIG_ENDIAN_HOST
hccapx.signature = byte_swap_32(hccapx.signature);
hccapx.version = byte_swap_32(hccapx.version);
hccapx.eapol_len = byte_swap_16(hccapx.eapol_len);
#endif
fwrite (&hccapx, sizeof(hccapx_t), 1, fh_hccapx);
hccapxwrittencount++;
return;
}
/*===========================================================================*/
static void writehccapxfile(char *hccapxoutname)
{
static FILE *fh_hccapx;
static hashlist_t *zeiger;
static struct stat statinfo;
if(hccapxoutname != NULL)
{
if((fh_hccapx = fopen(hccapxoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", hccapxoutname, strerror(errno));
return;
}
}
for(zeiger = hashlist; zeiger < hashlist +pmkideapolcount; zeiger++) writehccapxrecord(fh_hccapx, zeiger);
if(fh_hccapx != NULL) fclose(fh_hccapx);
if(hccapxoutname != NULL)
{
if(stat(hccapxoutname, &statinfo) == 0)
{
if(statinfo.st_size == 0) remove(hccapxoutname);
}
}
return;
}
/*===========================================================================*/
static void processessidraw(char *essidrawoutname)
{
static long int pc;
static hashlist_t *zeiger;
static FILE *fh_essid;
static struct stat statinfo;
if((fh_essid = fopen(essidrawoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", essidrawoutname, strerror(errno));
return;
}
for(pc = 0; pc < pmkideapolcount; pc++)
{
zeiger = hashlist +pc;
fwriteessidstr(zeiger->essidlen, zeiger->essid, fh_essid);
essidrawwrittencount++;
}
fclose(fh_essid);
if(stat(essidrawoutname, &statinfo) == 0)
{
if(statinfo.st_size == 0) remove(essidrawoutname);
}
return;
}
/*===========================================================================*/
static void processessid(char *essidoutname)
{
static long int pc;
static hashlist_t *zeiger, *zeigerold;
static FILE *fh_essid;
static struct stat statinfo;
if((fh_essid = fopen(essidoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", essidoutname, strerror(errno));
return;
}
zeigerold = NULL;
qsort(hashlist, pmkideapolcount, HASHLIST_SIZE, sort_hashlist_by_essid);
for(pc = 0; pc < pmkideapolcount; pc++)
{
zeiger = hashlist +pc;
if(zeigerold != NULL)
{
if(memcmp(zeiger->essid, zeigerold->essid, ESSID_LEN_MAX) == 0) continue;
}
fwriteessidstr(zeiger->essidlen, zeiger->essid, fh_essid);
essidwrittencount++;
zeigerold = zeiger;
}
fclose(fh_essid);
if(stat(essidoutname, &statinfo) == 0)
{
if(statinfo.st_size == 0) remove(essidoutname);
}
return;
}
/*===========================================================================*/
static void writepmkideapolhashline(FILE *fh_pmkideapol, hashlist_t *zeiger)
{
static int p;
if((zeiger->essidlen < essidlenmin) || (zeiger->essidlen > essidlenmax)) return;
if(((zeiger->type &hashtype) != HCX_TYPE_PMKID) && ((zeiger->type &hashtype) != HCX_TYPE_EAPOL)) return;
if(flagfiltermacap == true) if(memcmp(&filtermacap, zeiger->ap, 6) != 0) return;
if(flagfiltermacclient == true) if(memcmp(&filtermacclient, zeiger->client, 6) != 0) return;
if(flagfilterouiap == true) if(memcmp(&filterouiap, zeiger->ap, 3) != 0) return;
if(flagfilterouiclient == true) if(memcmp(&filterouiclient, zeiger->client, 3) != 0) return;
if(filteressidptr != NULL)
{
if(zeiger->essidlen != filteressidlen) return;
if(memcmp(zeiger->essid, filteressidptr, zeiger->essidlen) != 0) return;
}
if(filteressidpartptr != NULL)
{
if(ispartof(filteressidpartlen, (uint8_t*)filteressidpartptr, zeiger->essidlen, zeiger->essid) == false) return;
}
if((filtervendorptr != NULL) || (filtervendorapptr != NULL) || (filtervendorclientptr != NULL))
{
if(isoui(zeiger->ap, zeiger->client) == false) return;
}
if((flagfilterapless == true) && ((zeiger->mp &0x10) != 0x10)) return;
if((flagfilterrcchecked == true) && ((zeiger->mp &0x80) == 0x80)) return;
if((flagfilterrcnotchecked == true) && ((zeiger->mp &0x80) != 0x80)) return;
if((flagfilterauthorized == true) && ((zeiger->mp &0x07) == 0x00)) return;
if((flagfilterchallenge == true) && ((zeiger->mp &0x07) != 0x01)) return;
if(zeiger->type == HCX_TYPE_PMKID)
{
fprintf(fh_pmkideapol, "WPA*%02d*%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*",
zeiger->type,
zeiger->hash[0], zeiger->hash[1], zeiger->hash[2], zeiger->hash[3], zeiger->hash[4], zeiger->hash[5], zeiger->hash[6], zeiger->hash[7],
zeiger->hash[8], zeiger->hash[9], zeiger->hash[10], zeiger->hash[11], zeiger->hash[12], zeiger->hash[13], zeiger->hash[14], zeiger->hash[15],
zeiger->ap[0], zeiger->ap[1], zeiger->ap[2], zeiger->ap[3], zeiger->ap[4], zeiger->ap[5],
zeiger->client[0], zeiger->client[1], zeiger->client[2], zeiger->client[3], zeiger->client[4], zeiger->client[5]);
for(p = 0; p < zeiger->essidlen; p++) fprintf(fh_pmkideapol, "%02x", zeiger->essid[p]);
fprintf(fh_pmkideapol, "***\n");
pmkidwrittencount++;
return;
}