Ticket #104: wpa_dissector.patch

File wpa_dissector.patch, 1.7 kB (added by anonymous, 8 months ago)
  • scapy.py

    old new  
    63886388        return self.sprintf("EAPOL %EAPOL.type%") 
    63896389              
    63906390 
     6391class WPA_key(Packet): 
     6392    name = "WPA_key" 
     6393    fields_desc = [ ByteField("descriptor_type", 1), 
     6394                    ShortField("key_info",0), 
     6395                    LenField("len", None, "H"), 
     6396                    StrFixedLenField("replay_counter", "", 8), 
     6397                    StrFixedLenField("nonce", "", 32), 
     6398                    StrFixedLenField("key_iv", "", 16), 
     6399                    StrFixedLenField("wpa_key_rsc", "", 8),  
     6400                    StrFixedLenField("wpa_key_id", "", 8), 
     6401                    StrFixedLenField("wpa_key_mic", "", 16), 
     6402                    LenField("wpa_key_length", None, "H"), 
     6403                    StrLenField("wpa_key", "", length_from=lambda pkt:pkt.wpa_key_length) ] 
     6404    def extract_padding(self, s): 
     6405        l = self.len 
     6406        return s[:l],s[l:] 
     6407    def hashret(self): 
     6408        return chr(self.type)+self.payload.hashret() 
     6409    def answers(self, other): 
     6410        if isinstance(other,WPA_key): 
     6411               return 1 
     6412        return 0 
     6413              
     6414 
    63916415class EAP(Packet): 
    63926416    name = "EAP" 
    63936417    fields_desc = [ ByteEnumField("code", 4, {1:"REQUEST",2:"RESPONSE",3:"SUCCESS",4:"FAILURE"}), 
     
    95719595bind_layers( GRE,           EAPOL,         proto=34958) 
    95729596bind_layers( PPPoE,         PPP,           code=0) 
    95739597bind_layers( EAPOL,         EAP,           type=0) 
     9598bind_layers( EAPOL,         WPA_key,       type=3) 
    95749599bind_layers( LLC,           STP,           dsap=66, ssap=66, ctrl=3) 
    95759600bind_layers( LLC,           SNAP,          dsap=170, ssap=170, ctrl=3) 
    95769601bind_layers( SNAP,          Dot1Q,         code=33024)