File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 56
56
XLEIntField ,
57
57
LEMACField ,
58
58
BitEnumField ,
59
+ LEThreeBytesField ,
59
60
)
60
61
from scapy .supersocket import SuperSocket
61
62
from scapy .sendrecv import sndrcv
@@ -1266,7 +1267,19 @@ class EIR_PublicTargetAddress(EIR_Element):
1266
1267
class EIR_AdvertisingInterval (EIR_Element ):
1267
1268
name = "Advertising Interval"
1268
1269
fields_desc = [
1269
- LEShortField ("advertising_interval" , 0 )
1270
+ MultipleTypeField (
1271
+ [
1272
+ (ByteField ("advertising_interval" , 0 ),
1273
+ lambda p : p .underlayer .len - 1 == 1 ),
1274
+ (LEShortField ("advertising_interval" , 0 ),
1275
+ lambda p : p .underlayer .len - 1 == 2 ),
1276
+ (LEThreeBytesField ("advertising_interval" , 0 ),
1277
+ lambda p : p .underlayer .len - 1 == 3 ),
1278
+ (LEIntField ("advertising_interval" , 0 ),
1279
+ lambda p : p .underlayer .len - 1 == 4 ),
1280
+ ],
1281
+ LEShortField ("advertising_interval" , 0 )
1282
+ )
1270
1283
]
1271
1284
1272
1285
Original file line number Diff line number Diff line change @@ -481,6 +481,10 @@ p = HCI_Event_Hdr(hex_bytes('3e23020100002e4961121110170201060f0954656c655361742
481
481
assert EIR_AdvertisingInterval in p
482
482
assert p[EIR_AdvertisingInterval].advertising_interval == 400
483
483
484
+ p = BTLE(hex_bytes('d6be898e20234fe761e5b754021a1803030a18020ace12fffa07104a2b010000000054b7e561e74f00000000'))
485
+ assert EIR_AdvertisingInterval in p
486
+ assert p[EIR_AdvertisingInterval].advertising_interval == 24
487
+
484
488
= Parse EIR_LEBluetoothDeviceAddress
485
489
p = HCI_Event_Hdr(hex_bytes("3e2a02010000d93519d7ba4c1e0201020affc4000734151317fd80081b00d93519d7ba4c0303b9fe020ad4ad"))
486
490
assert EIR_LEBluetoothDeviceAddress in p
You can’t perform that action at this time.
0 commit comments