diff --git a/scapy/layers/dot11.py b/scapy/layers/dot11.py index 7f7caff3460255da524159a619b254d256cb1f4b..a1cd53aa6cb91cc462bba712659480c8416a45de 100644 --- a/scapy/layers/dot11.py +++ b/scapy/layers/dot11.py @@ -101,7 +101,7 @@ class PPI(Packet): name = "Per-Packet Information header (partial)" fields_desc = [ ByteField("version", 0), ByteField("flags", 0), - FieldLenField("len", None, fmt="<H", length_of="fields", adjust=lambda pkt,x:x+8), + FieldLenField("len", None, fmt="<H", length_of="notdecoded", adjust=lambda pkt,x:x+8), LEIntField("dlt", 0), StrLenField("notdecoded", "", length_from = lambda pkt:pkt.len-8) ] @@ -323,7 +323,7 @@ class Dot11WEP(Packet): return p[:4] + e.update(pay) + e.finalize() + icv else: warning("No WEP key set (conf.wepkey).. strange results expected..") - return None + return "" def post_build(self, p, pay): if self.wepdata is None: diff --git a/test/regression.uts b/test/regression.uts index 16301c152eee7b8f4534634afbdbd1d2c0686c0a..01d149119096ca2c03af3cff3356a5ffafa9ac3b 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -8547,7 +8547,31 @@ query = Dot11(type=0, subtype=0) Dot11(type=0, subtype=1).answers(query) == True = Dot11 - misc -Dot11Elt(info="scapy").summary() == "SSID='scapy'" +assert Dot11Elt(info="scapy").summary() == "SSID='scapy'" +assert Dot11Elt(ID=1).mysummary() == "" + += Dot11WEP - build +~ crypto +conf.wepkey = "" +assert str(PPI()/Dot11(FCfield=0x40)/Dot11WEP()) == b'\x00\x00\x08\x00i\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +conf.wepkey = "test123" +assert str(PPI()/Dot11(type=2, subtype=8, FCfield=0x40)/Dot11QoS()/Dot11WEP()) == b'\x00\x00\x08\x00i\x00\x00\x00\x88@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x008(^a' + += Dot11WEP - dissect +~ crypto +conf.wepkey = "test123" +a = PPI(b'\x00\x00\x08\x00i\x00\x00\x00\x88@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x008(^a') +assert a[Dot11QoS][Dot11WEP].icv == 942169697 + += Dot11 - answers +a = Dot11()/Dot11Auth(seqnum=1) +b = Dot11()/Dot11Auth(seqnum=2) +assert b.answers(a) +assert not a.answers(b) + +assert not (Dot11()/Dot11Ack()).answers(Dot11()) +assert (Dot11()/LLC(dsap=2, ctrl=4)).answers(Dot11()/LLC(dsap=1, ctrl=5)) + ############ ############