Skip to content

Commit b5cf025

Browse files
committed
Rename unaccessible FCfields
This fixes #4628
1 parent ef72e1d commit b5cf025

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

scapy/layers/dot11.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ class Dot11(Packet):
708708
[
709709
(
710710
FlagsField("FCfield", 0, 4,
711-
["pw-mgt", "MD", "protected", "order"]),
711+
["pw_mgt", "MD", "protected", "order"]),
712712
lambda pkt: (pkt.type, pkt.subtype) == (1, 6)
713713
),
714714
(
@@ -718,8 +718,8 @@ class Dot11(Packet):
718718
)
719719
],
720720
FlagsField("FCfield", 0, 8,
721-
["to-DS", "from-DS", "MF", "retry",
722-
"pw-mgt", "MD", "protected", "order"])
721+
["to_DS", "from_DS", "MF", "retry",
722+
"pw_mgt", "MD", "protected", "order"])
723723
),
724724
ConditionalField(
725725
BitField("FCfield_bw", 0, 3),
@@ -746,7 +746,7 @@ class Dot11(Packet):
746746
ConditionalField(
747747
_Dot11MacField("addr4", ETHER_ANY, 4),
748748
lambda pkt: (pkt.type == 2 and
749-
pkt.FCfield & 3 == 3), # from-DS+to-DS
749+
pkt.FCfield & 3 == 3), # from_DS+to_DS
750750
)
751751
]
752752

@@ -2116,7 +2116,7 @@ def make_reply(self, p):
21162116
tcp = p.getlayer(TCP)
21172117
pay = raw(tcp.payload)
21182118
p[IP].underlayer.remove_payload()
2119-
p.FCfield = "from-DS"
2119+
p.FCfield = "from_DS"
21202120
p.addr1, p.addr2 = p.addr2, p.addr1
21212121
p /= IP(src=ip.dst, dst=ip.src)
21222122
p /= TCP(sport=tcp.dport, dport=tcp.sport,

scapy/modules/krack/automaton.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def build_GTK_KDE(self):
332332
])
333333

334334
def send_wpa_enc(self, data, iv, seqnum, dest, mic_key,
335-
key_idx=0, additionnal_flag=["from-DS"],
335+
key_idx=0, additionnal_flag=["from_DS"],
336336
encrypt_key=None):
337337
"""Send an encrypted packet with content @data, using IV @iv,
338338
sequence number @seqnum, MIC key @mic_key
@@ -551,7 +551,7 @@ def send_wpa_handshake_1(self):
551551
addr1=self.client,
552552
addr2=self.mac,
553553
addr3=self.mac,
554-
FCfield='from-DS',
554+
FCfield='from_DS',
555555
SC=(next(self.seq_num) << 4),
556556
)
557557
rep /= LLC(dsap=0xaa, ssap=0xaa, ctrl=3)
@@ -595,7 +595,7 @@ def send_wpa_handshake_3(self, pkt):
595595
addr1=self.client,
596596
addr2=self.mac,
597597
addr3=self.mac,
598-
FCfield='from-DS',
598+
FCfield='from_DS',
599599
SC=(next(self.seq_num) << 4),
600600
)
601601

@@ -652,7 +652,7 @@ def krack_proceed(self, send_3handshake=False, send_gtk=False):
652652
addr1=self.client,
653653
addr2=self.mac,
654654
addr3=self.mac,
655-
FCfield='from-DS',
655+
FCfield='from_DS',
656656
SC=(next(self.seq_num) << 4),
657657
subtype=0,
658658
type="Data",

test/answering_machines.uts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def check_WiFi_am_reply(packet):
261261
assert isinstance(packet, list) and len(packet) == 2
262262
assert TCP in packet[0] and Raw in packet[0] and raw(packet[0][Raw]) == b"5c4pY"
263263

264-
test_WiFi_am(Dot11(FCfield="to-DS")/IP()/TCP()/"Scapy",
264+
test_WiFi_am(Dot11(FCfield="to_DS")/IP()/TCP()/"Scapy",
265265
check_WiFi_am_reply,
266266
iffrom="scapy0", ifto="scapy1", replace="5c4pY", pattern="Scapy")
267267

test/scapy/layers/dot11.uts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ assert raw(PPI()/Dot11(type=2, subtype=8, FCfield=0x40)/Dot11QoS()/Dot11WEP()) =
9999
conf.wepkey = "test123"
100100
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')
101101
assert a[Dot11QoS][Dot11WEP].icv == 942169697
102+
assert not a[Dot11].FCfield.to_DS
102103

103104
= Dot11TKIP - dissection
104105

0 commit comments

Comments
 (0)