-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot11.py
3090 lines (2505 loc) · 109 KB
/
dot11.py
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
# Impacket - Collection of Python classes for working with network protocols.
#
# SECUREAUTH LABS. Copyright (C) 2021 SecureAuth Corporation. All rights reserved.
#
# This software is provided under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Description:
# IEEE 802.11 Network packet codecs.
#
# Author:
# Gustavo Moreira
#
import struct
from binascii import crc32
from impacket.ImpactPacket import ProtocolPacket, array_tobytes
from impacket.Dot11Crypto import RC4
frequency = {
2412: 1, 2417: 2, 2422: 3, 2427: 4, 2432: 5, 2437: 6, 2442: 7, 2447: 8, 2452: 9,
2457: 10, 2462: 11, 2467: 12, 2472: 13, 2484: 14, 5170: 34, 5180: 36, 5190: 38, 5200: 40,
5210: 42, 5220: 44, 5230: 46, 5240: 48, 5260: 52, 5280: 56, 5300: 60, 5320: 64, 5500: 100,
5510: 102, 5520: 104, 5530: 106, 5540: 108, 5550: 110, 5560: 112, 5570: 114, 5580: 116, 5590: 118,
5600: 120, 5610: 122, 5620: 124, 5630: 126, 5640: 128, 5650: 130, 5660: 132, 5670: 134, 5680: 136,
5690: 138, 5700: 140, 5745: 149, 5765: 153, 5785: 157, 5805: 161, 5825: 165, 5855: 170, 5860: 172,
5865: 173, 5870: 174, 5875: 175, 5880: 176, 5885: 177, 5890: 178, 5895: 179, 5900: 180, 5905: 181,
5910: 182, 5915: 183, 5920: 184,
}
class Dot11ManagementCapabilities():
#
# Capability Information
# 0 1 2 3 4 5 6 7 8 9 A B C D E F
# +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
# | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
# +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
# | | | | | | | | | | | | | | | |
# | | | | | | | | | | | | | | |---+-- Reserved
# | | | | | | | | | | | | | |
# | | | | | | | | | | | | | |---------- DSSS-OFDM
# | | | | | | | | | | | | |
# | | | | | | | | | | | |---+-------------- Reserved
# | | | | | | | | | | |
# | | | | | | | | | | |---------------------- Short slot time
# | | | | | | | | | |
# | | | | | | | | |---+-------------------------- Reserved
# | | | | | | | |
# | | | | | | | |---------------------------------- Channel agility (802.11b)
# | | | | | | |
# | | | | | | |-------------------------------------- PBCC (802.11b)
# | | | | | |
# | | | | | |------------------------------------------ Short preamble (802.11b)
# | | | | |
# | | | | |---------------------------------------------- Privacy
# | | | |
# | | | |-------------------------------------------------- CF-Poll request
# | | |
# | | |------------------------------------------------------ CF-Pollable
# | |
# | |---------------------------------------------------------- IBSS
# |
# |-------------------------------------------------------------- ESS
#
CAPABILITY_RESERVED_1 = int("1000000000000000", 2)
CAPABILITY_RESERVED_2 = int("0100000000000000", 2)
CAPABILITY_DSSS_OFDM = int("0010000000000000", 2)
CAPABILITY_RESERVED_3 = int("0001000000000000", 2)
CAPABILITY_RESERVED_4 = int("0000100000000000", 2)
CAPABILITY_SHORT_SLOT_TIME = int("0000010000000000", 2)
CAPABILITY_RESERVED_5 = int("0000001000000000", 2)
CAPABILITY_RESERVED_6 = int("0000000100000000", 2)
CAPABILITY_CH_AGILITY = int("0000000010000000", 2)
CAPABILITY_PBCC = int("0000000001000000", 2)
CAPABILITY_SHORT_PREAMBLE = int("0000000000100000", 2)
CAPABILITY_PRIVACY = int("0000000000010000", 2)
CAPABILITY_CF_POLL_REQ = int("0000000000001000", 2)
CAPABILITY_CF_POLLABLE = int("0000000000000100", 2)
CAPABILITY_IBSS = int("0000000000000010", 2)
CAPABILITY_ESS = int("0000000000000001", 2)
class Dot11Types():
# Management Types/SubTypes
DOT11_TYPE_MANAGEMENT = int("00",2)
DOT11_SUBTYPE_MANAGEMENT_ASSOCIATION_REQUEST = int("0000",2)
DOT11_SUBTYPE_MANAGEMENT_ASSOCIATION_RESPONSE = int("0001",2)
DOT11_SUBTYPE_MANAGEMENT_REASSOCIATION_REQUEST = int("0010",2)
DOT11_SUBTYPE_MANAGEMENT_REASSOCIATION_RESPONSE = int("0011",2)
DOT11_SUBTYPE_MANAGEMENT_PROBE_REQUEST = int("0100",2)
DOT11_SUBTYPE_MANAGEMENT_PROBE_RESPONSE = int("0101",2)
DOT11_SUBTYPE_MANAGEMENT_RESERVED1 = int("0110",2)
DOT11_SUBTYPE_MANAGEMENT_RESERVED2 = int("0111",2)
DOT11_SUBTYPE_MANAGEMENT_BEACON = int("1000",2)
DOT11_SUBTYPE_MANAGEMENT_ATIM = int("1001",2)
DOT11_SUBTYPE_MANAGEMENT_DISASSOCIATION = int("1010",2)
DOT11_SUBTYPE_MANAGEMENT_AUTHENTICATION = int("1011",2)
DOT11_SUBTYPE_MANAGEMENT_DEAUTHENTICATION = int("1100",2)
DOT11_SUBTYPE_MANAGEMENT_ACTION = int("1101",2)
DOT11_SUBTYPE_MANAGEMENT_RESERVED3 = int("1110",2)
DOT11_SUBTYPE_MANAGEMENT_RESERVED4 = int("1111",2)
DOT11_TYPE_MANAGEMENT_SUBTYPE_ASSOCIATION_REQUEST = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_ASSOCIATION_REQUEST<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_ASSOCIATION_RESPONSE = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_ASSOCIATION_RESPONSE<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_REASSOCIATION_REQUEST = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_REASSOCIATION_REQUEST<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_REASSOCIATION_RESPONSE = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_REASSOCIATION_RESPONSE<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_PROBE_REQUEST = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_PROBE_REQUEST<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_PROBE_RESPONSE = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_PROBE_RESPONSE<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_RESERVED1 = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_RESERVED1<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_RESERVED2 = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_RESERVED2<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_BEACON = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_BEACON<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_ATIM = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_ATIM<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_DISASSOCIATION = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_DISASSOCIATION<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_AUTHENTICATION = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_AUTHENTICATION<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_DEAUTHENTICATION = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_DEAUTHENTICATION<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_ACTION = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_ACTION<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_RESERVED3 = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_RESERVED3<<2
DOT11_TYPE_MANAGEMENT_SUBTYPE_RESERVED4 = \
DOT11_TYPE_MANAGEMENT|DOT11_SUBTYPE_MANAGEMENT_RESERVED4<<2
# Control Types/SubTypes
DOT11_TYPE_CONTROL = int("01",2)
DOT11_SUBTYPE_CONTROL_RESERVED1 = int("0000",2)
DOT11_SUBTYPE_CONTROL_RESERVED2 = int("0001",2)
DOT11_SUBTYPE_CONTROL_RESERVED3 = int("0010",2)
DOT11_SUBTYPE_CONTROL_RESERVED4 = int("0011",2)
DOT11_SUBTYPE_CONTROL_RESERVED5 = int("0100",2)
DOT11_SUBTYPE_CONTROL_RESERVED6 = int("0101",2)
DOT11_SUBTYPE_CONTROL_RESERVED7 = int("0110",2)
DOT11_SUBTYPE_CONTROL_RESERVED8 = int("0111",2)
DOT11_SUBTYPE_CONTROL_BLOCK_ACK_REQUEST = int("1000",2)
DOT11_SUBTYPE_CONTROL_BLOCK_ACK = int("1001",2)
DOT11_SUBTYPE_CONTROL_POWERSAVE_POLL = int("1010",2)
DOT11_SUBTYPE_CONTROL_REQUEST_TO_SEND = int("1011",2)
DOT11_SUBTYPE_CONTROL_CLEAR_TO_SEND = int("1100",2)
DOT11_SUBTYPE_CONTROL_ACKNOWLEDGMENT = int("1101",2)
DOT11_SUBTYPE_CONTROL_CF_END = int("1110",2)
DOT11_SUBTYPE_CONTROL_CF_END_CF_ACK = int("1111",2)
DOT11_TYPE_CONTROL_SUBTYPE_RESERVED1 = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_RESERVED1<<2
DOT11_TYPE_CONTROL_SUBTYPE_RESERVED2 = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_RESERVED2<<2
DOT11_TYPE_CONTROL_SUBTYPE_RESERVED3 = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_RESERVED3<<2
DOT11_TYPE_CONTROL_SUBTYPE_RESERVED4 = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_RESERVED4<<2
DOT11_TYPE_CONTROL_SUBTYPE_RESERVED5 = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_RESERVED5<<2
DOT11_TYPE_CONTROL_SUBTYPE_RESERVED6 = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_RESERVED6<<2
DOT11_TYPE_CONTROL_SUBTYPE_RESERVED7 = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_RESERVED7<<2
DOT11_TYPE_CONTROL_SUBTYPE_BLOCK_ACK_REQUEST = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_BLOCK_ACK_REQUEST<<2
DOT11_TYPE_CONTROL_SUBTYPE_BLOCK_ACK = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_BLOCK_ACK<<2
DOT11_TYPE_CONTROL_SUBTYPE_POWERSAVE_POLL = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_POWERSAVE_POLL<<2
DOT11_TYPE_CONTROL_SUBTYPE_REQUEST_TO_SEND = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_REQUEST_TO_SEND<<2
DOT11_TYPE_CONTROL_SUBTYPE_CLEAR_TO_SEND = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_CLEAR_TO_SEND<<2
DOT11_TYPE_CONTROL_SUBTYPE_ACKNOWLEDGMENT = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_ACKNOWLEDGMENT<<2
DOT11_TYPE_CONTROL_SUBTYPE_CF_END = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_CF_END<<2
DOT11_TYPE_CONTROL_SUBTYPE_CF_END_CF_ACK = \
DOT11_TYPE_CONTROL|DOT11_SUBTYPE_CONTROL_CF_END_CF_ACK<<2
# Data Types/SubTypes
DOT11_TYPE_DATA = int("10",2)
DOT11_SUBTYPE_DATA = int("0000",2)
DOT11_SUBTYPE_DATA_CF_ACK = int("0001",2)
DOT11_SUBTYPE_DATA_CF_POLL = int("0010",2)
DOT11_SUBTYPE_DATA_CF_ACK_CF_POLL = int("0011",2)
DOT11_SUBTYPE_DATA_NULL_NO_DATA = int("0100",2)
DOT11_SUBTYPE_DATA_CF_ACK_NO_DATA = int("0101",2)
DOT11_SUBTYPE_DATA_CF_POLL_NO_DATA = int("0110",2)
DOT11_SUBTYPE_DATA_CF_ACK_CF_POLL_NO_DATA = int("0111",2)
DOT11_SUBTYPE_DATA_QOS_DATA = int("1000",2)
DOT11_SUBTYPE_DATA_QOS_DATA_CF_ACK = int("1001",2)
DOT11_SUBTYPE_DATA_QOS_DATA_CF_POLL = int("1010",2)
DOT11_SUBTYPE_DATA_QOS_DATA_CF_ACK_CF_POLL = int("1011",2)
DOT11_SUBTYPE_DATA_QOS_NULL_NO_DATA = int("1100",2)
DOT11_SUBTYPE_DATA_RESERVED1 = int("1101",2)
DOT11_SUBTYPE_DATA_QOS_CF_POLL_NO_DATA = int("1110",2)
DOT11_SUBTYPE_DATA_QOS_CF_ACK_CF_POLL_NO_DATA = int("1111",2)
DOT11_TYPE_DATA_SUBTYPE_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA<<2
DOT11_TYPE_DATA_SUBTYPE_CF_ACK = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_CF_ACK<<2
DOT11_TYPE_DATA_SUBTYPE_CF_POLL = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_CF_POLL<<2
DOT11_TYPE_DATA_SUBTYPE_CF_ACK_CF_POLL = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_CF_ACK_CF_POLL<<2
DOT11_TYPE_DATA_SUBTYPE_NULL_NO_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_NULL_NO_DATA<<2
DOT11_TYPE_DATA_SUBTYPE_CF_ACK_NO_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_CF_POLL_NO_DATA<<2
DOT11_TYPE_DATA_SUBTYPE_CF_ACK_CF_POLL_NO_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_CF_ACK_CF_POLL_NO_DATA<<2
DOT11_TYPE_DATA_SUBTYPE_QOS_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_QOS_DATA<<2
DOT11_TYPE_DATA_SUBTYPE_QOS_DATA_CF_ACK = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_QOS_DATA_CF_ACK<<2
DOT11_TYPE_DATA_SUBTYPE_QOS_DATA_CF_POLL = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_QOS_DATA_CF_POLL<<2
DOT11_TYPE_DATA_SUBTYPE_QOS_DATA_CF_ACK_CF_POLL = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_QOS_DATA_CF_ACK_CF_POLL<<2
DOT11_TYPE_DATA_SUBTYPE_QOS_NULL_NO_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_QOS_NULL_NO_DATA<<2
DOT11_TYPE_DATA_SUBTYPE_RESERVED1 = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_RESERVED1<<2
DOT11_TYPE_DATA_SUBTYPE_QOS_CF_POLL_NO_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_QOS_CF_POLL_NO_DATA<<2
DOT11_TYPE_DATA_SUBTYPE_QOS_CF_ACK_CF_POLL_NO_DATA = \
DOT11_TYPE_DATA|DOT11_SUBTYPE_DATA_QOS_CF_ACK_CF_POLL_NO_DATA<<2
# Reserved Types/SubTypes
DOT11_TYPE_RESERVED = int("11",2)
DOT11_SUBTYPE_RESERVED_RESERVED1 = int("0000",2)
DOT11_SUBTYPE_RESERVED_RESERVED2 = int("0001",2)
DOT11_SUBTYPE_RESERVED_RESERVED3 = int("0010",2)
DOT11_SUBTYPE_RESERVED_RESERVED4 = int("0011",2)
DOT11_SUBTYPE_RESERVED_RESERVED5 = int("0100",2)
DOT11_SUBTYPE_RESERVED_RESERVED6 = int("0101",2)
DOT11_SUBTYPE_RESERVED_RESERVED7 = int("0110",2)
DOT11_SUBTYPE_RESERVED_RESERVED8 = int("0111",2)
DOT11_SUBTYPE_RESERVED_RESERVED9 = int("1000",2)
DOT11_SUBTYPE_RESERVED_RESERVED10 = int("1001",2)
DOT11_SUBTYPE_RESERVED_RESERVED11 = int("1010",2)
DOT11_SUBTYPE_RESERVED_RESERVED12 = int("1011",2)
DOT11_SUBTYPE_RESERVED_RESERVED13 = int("1100",2)
DOT11_SUBTYPE_RESERVED_RESERVED14 = int("1101",2)
DOT11_SUBTYPE_RESERVED_RESERVED15 = int("1110",2)
DOT11_SUBTYPE_RESERVED_RESERVED16 = int("1111",2)
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED1 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED1<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED2 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED2<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED3 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED3<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED4 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED4<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED5 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED5<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED6 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED6<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED7 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED7<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED8 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED8<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED9 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED9<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED10 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED10<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED11 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED11<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED12 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED12<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED13 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED13<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED14 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED14<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED15 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED15<<2
DOT11_TYPE_RESERVED_SUBTYPE_RESERVED16 = \
DOT11_TYPE_RESERVED|DOT11_SUBTYPE_RESERVED_RESERVED16<<2
class Dot11(ProtocolPacket):
def __init__(self, aBuffer = None, FCS_at_end = True):
header_size = 2
self.__FCS_at_end=not not FCS_at_end # Is Boolean
if self.__FCS_at_end:
tail_size = 4
else:
tail_size = 0
ProtocolPacket.__init__(self, header_size,tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_order(self):
"Return 802.11 frame 'Order' field"
b = self.header.get_byte(1)
return ((b >> 7) & 0x01)
def set_order(self, value):
"Set 802.11 frame 'Order' field"
# clear the bits
mask = (~0x80) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | ((value & 0x01) << 7)
self.header.set_byte(1, nb)
def get_protectedFrame(self):
"Return 802.11 frame 'Protected' field"
b = self.header.get_byte(1)
return ((b >> 6) & 0x01)
def set_protectedFrame(self, value):
"Set 802.11 frame 'Protected Frame' field"
# clear the bits
mask = (~0x40) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | ((value & 0x01) << 6)
self.header.set_byte(1, nb)
def get_moreData(self):
"Return 802.11 frame 'More Data' field"
b = self.header.get_byte(1)
return ((b >> 5) & 0x01)
def set_moreData(self, value):
"Set 802.11 frame 'More Data' field"
# clear the bits
mask = (~0x20) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | ((value & 0x01) << 5)
self.header.set_byte(1, nb)
def get_powerManagement(self):
"Return 802.11 frame 'Power Management' field"
b = self.header.get_byte(1)
return ((b >> 4) & 0x01)
def set_powerManagement(self, value):
"Set 802.11 frame 'Power Management' field"
# clear the bits
mask = (~0x10) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | ((value & 0x01) << 4)
self.header.set_byte(1, nb)
def get_retry(self):
"Return 802.11 frame 'Retry' field"
b = self.header.get_byte(1)
return ((b >> 3) & 0x01)
def set_retry(self, value):
"Set 802.11 frame 'Retry' field"
# clear the bits
mask = (~0x08) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | ((value & 0x01) << 3)
self.header.set_byte(1, nb)
def get_moreFrag(self):
"Return 802.11 frame 'More Fragments' field"
b = self.header.get_byte(1)
return ((b >> 2) & 0x01)
def set_moreFrag(self, value):
"Set 802.11 frame 'More Fragments' field"
# clear the bits
mask = (~0x04) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | ((value & 0x01) << 2)
self.header.set_byte(1, nb)
def get_fromDS(self):
"Return 802.11 frame 'from DS' field"
b = self.header.get_byte(1)
return ((b >> 1) & 0x01)
def set_fromDS(self, value):
"Set 802.11 frame 'from DS' field"
# clear the bits
mask = (~0x02) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | ((value & 0x01) << 1)
self.header.set_byte(1, nb)
def get_toDS(self):
"Return 802.11 frame 'to DS' field"
b = self.header.get_byte(1)
return (b & 0x01)
def set_toDS(self, value):
"Set 802.11 frame 'to DS' field"
# clear the bits
mask = (~0x01) & 0xFF
masked = self.header.get_byte(1) & mask
# set the bits
nb = masked | (value & 0x01)
self.header.set_byte(1, nb)
def get_subtype(self):
"Return 802.11 frame 'subtype' field"
b = self.header.get_byte(0)
return ((b >> 4) & 0x0F)
def set_subtype(self, value):
"Set 802.11 frame 'subtype' field"
# clear the bits
mask = (~0xF0)&0xFF
masked = self.header.get_byte(0) & mask
# set the bits
nb = masked | ((value << 4) & 0xF0)
self.header.set_byte(0, nb)
def get_type(self):
"Return 802.11 frame 'type' field"
b = self.header.get_byte(0)
return ((b >> 2) & 0x03)
def set_type(self, value):
"Set 802.11 frame 'type' field"
# clear the bits
mask = (~0x0C)&0xFF
masked = self.header.get_byte(0) & mask
# set the bits
nb = masked | ((value << 2) & 0x0C)
self.header.set_byte(0, nb)
def get_type_n_subtype(self):
"Return 802.11 frame 'Type and Subtype' field"
b = self.header.get_byte(0)
return ((b >> 2) & 0x3F)
def set_type_n_subtype(self, value):
"Set 802.11 frame 'Type and Subtype' field"
# clear the bits
mask = (~0xFC)&0xFF
masked = self.header.get_byte(0) & mask
# set the bits
nb = masked | ((value << 2) & 0xFC)
self.header.set_byte(0, nb)
def get_version(self):
"Return 802.11 frame control 'Protocol version' field"
b = self.header.get_byte(0)
return (b & 0x03)
def set_version(self, value):
"Set the 802.11 frame control 'Protocol version' field"
# clear the bits
mask = (~0x03)&0xFF
masked = self.header.get_byte(0) & mask
# set the bits
nb = masked | (value & 0x03)
self.header.set_byte(0, nb)
def compute_checksum(self,bytes):
crcle=crc32(bytes)&0xffffffff
# ggrr this crc32 is in little endian, convert it to big endian
crc=struct.pack('<L', crcle)
# Convert to long
(crc_long,) = struct.unpack('!L', crc)
return crc_long
def is_QoS_frame(self):
"Return 'True' if is an QoS data frame type"
b = self.header.get_byte(0)
return (b & 0x80) and True
def is_no_framebody_frame(self):
"Return 'True' if it frame contain no Frame Body"
b = self.header.get_byte(0)
return (b & 0x40) and True
def is_cf_poll_frame(self):
"Return 'True' if it frame is a CF_POLL frame"
b = self.header.get_byte(0)
return (b & 0x20) and True
def is_cf_ack_frame(self):
"Return 'True' if it frame is a CF_ACK frame"
b = self.header.get_byte(0)
return (b & 0x10) and True
def get_fcs(self):
"Return 802.11 'FCS' field"
if not self.__FCS_at_end:
return None
b = self.tail.get_long(-4, ">")
return b
def set_fcs(self, value = None):
"Set the 802.11 CTS control frame 'FCS' field. If value is None, is auto_checksum"
if not self.__FCS_at_end:
return
# calculate the FCS
if value is None:
payload = self.get_body_as_string()
crc32=self.compute_checksum(payload)
value=crc32
# set the bits
nb = value & 0xFFFFFFFF
self.tail.set_long(-4, nb)
class Dot11ControlFrameCTS(ProtocolPacket):
"802.11 Clear-To-Send Control Frame"
def __init__(self, aBuffer = None):
header_size = 8
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_duration(self):
"Return 802.11 CTS control frame 'Duration' field"
b = self.header.get_word(0, "<")
return b
def set_duration(self, value):
"Set the 802.11 CTS control frame 'Duration' field"
# set the bits
nb = value & 0xFFFF
self.header.set_word(0, nb, "<")
def get_ra(self):
"Return 802.11 CTS control frame 48 bit 'Receiver Address' field as a 6 bytes array"
return self.header.get_bytes()[2:8]
def set_ra(self, value):
"Set 802.11 CTS control frame 48 bit 'Receiver Address' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(2+i, value[i])
class Dot11ControlFrameACK(ProtocolPacket):
"802.11 Acknowledgement Control Frame"
def __init__(self, aBuffer = None):
header_size = 8
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_duration(self):
"Return 802.11 ACK control frame 'Duration' field"
b = self.header.get_word(0, "<")
return b
def set_duration(self, value):
"Set the 802.11 ACK control frame 'Duration' field"
# set the bits
nb = value & 0xFFFF
self.header.set_word(0, nb, "<")
def get_ra(self):
"Return 802.11 ACK control frame 48 bit 'Receiver Address' field as a 6 bytes array"
return self.header.get_bytes()[2:8]
def set_ra(self, value):
"Set 802.11 ACK control frame 48 bit 'Receiver Address' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(2+i, value[i])
class Dot11ControlFrameRTS(ProtocolPacket):
"802.11 Request-To-Send Control Frame"
def __init__(self, aBuffer = None):
header_size = 14
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_duration(self):
"Return 802.11 RTS control frame 'Duration' field"
b = self.header.get_word(0, "<")
return b
def set_duration(self, value):
"Set the 802.11 RTS control frame 'Duration' field"
# set the bits
nb = value & 0xFFFF
self.header.set_word(0, nb, "<")
def get_ra(self):
"Return 802.11 RTS control frame 48 bit 'Receiver Address' field as a 6 bytes array"
return self.header.get_bytes()[2:8]
def set_ra(self, value):
"Set 802.11 RTS control frame 48 bit 'Receiver Address' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(2+i, value[i])
def get_ta(self):
"Return 802.11 RTS control frame 48 bit 'Transmitter Address' field as a 6 bytes array"
return self.header.get_bytes()[8:14]
def set_ta(self, value):
"Set 802.11 RTS control frame 48 bit 'Transmitter Address' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(8+i, value[i])
class Dot11ControlFramePSPoll(ProtocolPacket):
"802.11 Power-Save Poll Control Frame"
def __init__(self, aBuffer = None):
header_size = 14
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_aid(self):
"Return 802.11 PSPoll control frame 'AID' field"
# the spec says "The AID value always has its two MSBs each set to 1."
# TODO: Should we do check/modify it? Wireshark shows the only MSB to 0
b = self.header.get_word(0, "<")
return b
def set_aid(self, value):
"Set the 802.11 PSPoll control frame 'AID' field"
# set the bits
nb = value & 0xFFFF
# the spec says "The AID value always has its two MSBs each set to 1."
# TODO: Should we do check/modify it? Wireshark shows the only MSB to 0
self.header.set_word(0, nb, "<")
def get_bssid(self):
"Return 802.11 PSPoll control frame 48 bit 'BSS ID' field as a 6 bytes array"
return self.header.get_bytes()[2:8]
def set_bssid(self, value):
"Set 802.11 PSPoll control frame 48 bit 'BSS ID' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(2+i, value[i])
def get_ta(self):
"Return 802.11 PSPoll control frame 48 bit 'Transmitter Address' field as a 6 bytes array"
return self.header.get_bytes()[8:14]
def set_ta(self, value):
"Set 802.11 PSPoll control frame 48 bit 'Transmitter Address' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(8+i, value[i])
class Dot11ControlFrameCFEnd(ProtocolPacket):
"802.11 'Contention Free End' Control Frame"
def __init__(self, aBuffer = None):
header_size = 14
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_duration(self):
"Return 802.11 CF-End control frame 'Duration' field"
b = self.header.get_word(0, "<")
return b
def set_duration(self, value):
"Set the 802.11 CF-End control frame 'Duration' field"
# set the bits
nb = value & 0xFFFF
self.header.set_word(0, nb, "<")
def get_ra(self):
"Return 802.11 CF-End control frame 48 bit 'Receiver Address' field as a 6 bytes array"
return self.header.get_bytes()[2:8]
def set_ra(self, value):
"Set 802.11 CF-End control frame 48 bit 'Receiver Address' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(2+i, value[i])
def get_bssid(self):
"Return 802.11 CF-End control frame 48 bit 'BSS ID' field as a 6 bytes array"
return self.header.get_bytes()[8:14]
def set_bssid(self, value):
"Set 802.11 CF-End control frame 48 bit 'BSS ID' field as a 6 bytes array"
for i in range(0, 6):
self.header.set_byte(8+i, value[i])
class Dot11ControlFrameCFEndCFACK(ProtocolPacket):
'802.11 \'CF-End + CF-ACK\' Control Frame'
def __init__(self, aBuffer = None):
header_size = 14
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_duration(self):
'Return 802.11 \'CF-End+CF-ACK\' control frame \'Duration\' field'
b = self.header.get_word(0, "<")
return b
def set_duration(self, value):
'Set the 802.11 \'CF-End+CF-ACK\' control frame \'Duration\' field'
# set the bits
nb = value & 0xFFFF
self.header.set_word(0, nb, "<")
def get_ra(self):
'Return 802.11 \'CF-End+CF-ACK\' control frame 48 bit \'Receiver Address\' field as a 6 bytes array'
return self.header.get_bytes()[2:8]
def set_ra(self, value):
'Set 802.11 \'CF-End+CF-ACK\' control frame 48 bit \'Receiver Address\' field as a 6 bytes array'
for i in range(0, 6):
self.header.set_byte(2+i, value[i])
def get_bssid(self):
'Return 802.11 \'CF-End+CF-ACK\' control frame 48 bit \'BSS ID\' field as a 6 bytes array'
return self.header.get_bytes()[8:16]
def set_bssid(self, value):
'Set 802.11 \'CF-End+CF-ACK\' control frame 48 bit \'BSS ID\' field as a 6 bytes array'
for i in range(0, 6):
self.header.set_byte(8+i, value[i])
class Dot11DataFrame(ProtocolPacket):
'802.11 Data Frame'
def __init__(self, aBuffer = None):
header_size = 22
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_duration(self):
'Return 802.11 \'Data\' data frame \'Duration\' field'
b = self.header.get_word(0, "<")
return b
def set_duration(self, value):
'Set the 802.11 \'Data\' data frame \'Duration\' field'
# set the bits
nb = value & 0xFFFF
self.header.set_word(0, nb, "<")
def get_address1(self):
'Return 802.11 \'Data\' data frame 48 bit \'Address1\' field as a 6 bytes array'
return self.header.get_bytes()[2:8]
def set_address1(self, value):
'Set 802.11 \'Data\' data frame 48 bit \'Address1\' field as a 6 bytes array'
for i in range(0, 6):
self.header.set_byte(2+i, value[i])
def get_address2(self):
'Return 802.11 \'Data\' data frame 48 bit \'Address2\' field as a 6 bytes array'
return self.header.get_bytes()[8:14]
def set_address2(self, value):
'Set 802.11 \'Data\' data frame 48 bit \'Address2\' field as a 6 bytes array'
for i in range(0, 6):
self.header.set_byte(8+i, value[i])
def get_address3(self):
'Return 802.11 \'Data\' data frame 48 bit \'Address3\' field as a 6 bytes array'
return self.header.get_bytes()[14: 20]
def set_address3(self, value):
'Set 802.11 \'Data\' data frame 48 bit \'Address3\' field as a 6 bytes array'
for i in range(0, 6):
self.header.set_byte(14+i, value[i])
def get_sequence_control(self):
'Return 802.11 \'Data\' data frame \'Sequence Control\' field'
b = self.header.get_word(20, "<")
return b
def set_sequence_control(self, value):
'Set the 802.11 \'Data\' data frame \'Sequence Control\' field'
# set the bits
nb = value & 0xFFFF
self.header.set_word(20, nb, "<")
def get_fragment_number(self):
'Return 802.11 \'Data\' data frame \'Fragment Number\' subfield'
b = self.header.get_word(20, "<")
return (b&0x000F)
def set_fragment_number(self, value):
'Set the 802.11 \'Data\' data frame \'Fragment Number\' subfield'
# clear the bits
mask = (~0x000F) & 0xFFFF
masked = self.header.get_word(20, "<") & mask
# set the bits
nb = masked | (value & 0x000F)
self.header.set_word(20, nb, "<")
def get_sequence_number(self):
'Return 802.11 \'Data\' data frame \'Sequence Number\' subfield'
b = self.header.get_word(20, "<")
return ((b>>4) & 0xFFF)
def set_sequence_number(self, value):
'Set the 802.11 \'Data\' data frame \'Sequence Number\' subfield'
# clear the bits
mask = (~0xFFF0) & 0xFFFF
masked = self.header.get_word(20, "<") & mask
# set the bits
nb = masked | ((value & 0x0FFF ) << 4 )
self.header.set_word(20, nb, "<")
def get_frame_body(self):
'Return 802.11 \'Data\' data frame \'Frame Body\' field'
return self.get_body_as_string()
def set_frame_body(self, data):
'Set 802.11 \'Data\' data frame \'Frame Body\' field'
self.load_body(data)
class Dot11DataQoSFrame(Dot11DataFrame):
'802.11 Data QoS Frame'
def __init__(self, aBuffer = None):
header_size = 24
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_QoS(self):
'Return 802.11 \'Data\' data frame \'QoS\' field'
b = self.header.get_word(22, "<")
return b
def set_QoS(self, value):
'Set the 802.11 \'Data\' data frame \'QoS\' field'
# set the bits
nb = value & 0xFFFF
self.header.set_word(22, nb, "<")
class Dot11DataAddr4Frame(Dot11DataFrame):
'802.11 Data With ToDS From DS Flags (With Addr 4) Frame'
def __init__(self, aBuffer = None):
header_size = 28
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_address4(self):
'Return 802.11 \'Data\' data frame 48 bit \'Address4\' field as a 6 bytes array'
return self.header.get_bytes()[22:28]
def set_address4(self, value):
'Set 802.11 \'Data\' data frame 48 bit \'Address4\' field as a 6 bytes array'
for i in range(0, 6):
self.header.set_byte(22+i, value[i])
class Dot11DataAddr4QoSFrame(Dot11DataAddr4Frame):
'802.11 Data With ToDS From DS Flags (With Addr 4) and QoS Frame'
def __init__(self, aBuffer = None):
header_size = 30
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_QoS(self):
'Return 802.11 \'Data\' data frame \'QoS\' field'
b = self.header.get_word(28, "<")
return b
def set_QoS(self, value):
'Set the 802.11 \'Data\' data frame \'QoS\' field'
# set the bits
nb = value & 0xFFFF
self.header.set_word(28, nb, "<")
class SAPTypes():
NULL = 0x00
LLC_SLMGMT = 0x02
SNA_PATHCTRL = 0x04
IP = 0x06
SNA1 = 0x08
SNA2 = 0x0C
PROWAY_NM_INIT = 0x0E
NETWARE1 = 0x10
OSINL1 = 0x14
TI = 0x18
OSINL2 = 0x20
OSINL3 = 0x34
SNA3 = 0x40
BPDU = 0x42
RS511 = 0x4E
OSINL4 = 0x54
X25 = 0x7E
XNS = 0x80
BACNET = 0x82
NESTAR = 0x86
PROWAY_ASLM = 0x8E
ARP = 0x98
SNAP = 0xAA
HPJD = 0xB4
VINES1 = 0xBA
VINES2 = 0xBC
NETWARE2 = 0xE0
NETBIOS = 0xF0
IBMNM = 0xF4
HPEXT = 0xF8
UB = 0xFA
RPL = 0xFC
OSINL5 = 0xFE
GLOBAL = 0xFF
class LLC(ProtocolPacket):
'802.2 Logical Link Control (LLC) Frame'
DLC_UNNUMBERED_FRAMES = 0x03
def __init__(self, aBuffer = None):
header_size = 3
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)
def get_DSAP(self):
"Get the Destination Service Access Point (SAP) from LLC frame"
return self.header.get_byte(0)
def set_DSAP(self, value):
"Set the Destination Service Access Point (SAP) of LLC frame"
self.header.set_byte(0, value)
def get_SSAP(self):
"Get the Source Service Access Point (SAP) from LLC frame"
return self.header.get_byte(1)
def set_SSAP(self, value):
"Set the Source Service Access Point (SAP) of LLC frame"
self.header.set_byte(1, value)
def get_control(self):
"Get the Control field from LLC frame"
return self.header.get_byte(2)
def set_control(self, value):
"Set the Control field of LLC frame"
self.header.set_byte(2, value)
class SNAP(ProtocolPacket):
'802.2 SubNetwork Access Protocol (SNAP) Frame'
def __init__(self, aBuffer = None):
header_size = 5
tail_size = 0
ProtocolPacket.__init__(self, header_size, tail_size)
if(aBuffer):
self.load_packet(aBuffer)