--- scapy.py 2008-03-26 09:33:50.000000000 +0000 +++ my_scapy.py 2008-03-23 17:00:52.000000000 +0000 @@ -6388,6 +6388,30 @@ return self.sprintf("EAPOL %EAPOL.type%") +class WPA_key(Packet): + name = "WPA_key" + fields_desc = [ ByteField("descriptor_type", 1), + ShortField("key_info",0), + LenField("len", None, "H"), + StrFixedLenField("replay_counter", "", 8), + StrFixedLenField("nonce", "", 32), + StrFixedLenField("key_iv", "", 16), + StrFixedLenField("wpa_key_rsc", "", 8), + StrFixedLenField("wpa_key_id", "", 8), + StrFixedLenField("wpa_key_mic", "", 16), + LenField("wpa_key_length", None, "H"), + StrLenField("wpa_key", "", length_from=lambda pkt:pkt.wpa_key_length) ] + def extract_padding(self, s): + l = self.len + return s[:l],s[l:] + def hashret(self): + return chr(self.type)+self.payload.hashret() + def answers(self, other): + if isinstance(other,WPA_key): + return 1 + return 0 + + class EAP(Packet): name = "EAP" fields_desc = [ ByteEnumField("code", 4, {1:"REQUEST",2:"RESPONSE",3:"SUCCESS",4:"FAILURE"}), @@ -9571,6 +9595,7 @@ bind_layers( GRE, EAPOL, proto=34958) bind_layers( PPPoE, PPP, code=0) bind_layers( EAPOL, EAP, type=0) +bind_layers( EAPOL, WPA_key, type=3) bind_layers( LLC, STP, dsap=66, ssap=66, ctrl=3) bind_layers( LLC, SNAP, dsap=170, ssap=170, ctrl=3) bind_layers( SNAP, Dot1Q, code=33024)