forked from auracaster/bumble_mirror
format
This commit is contained in:
@@ -976,9 +976,6 @@ class AdvertisingData:
|
|||||||
if ad_type == AdvertisingData.MANUFACTURER_SPECIFIC_DATA:
|
if ad_type == AdvertisingData.MANUFACTURER_SPECIFIC_DATA:
|
||||||
return (cast(int, struct.unpack_from('<H', ad_data, 0)[0]), ad_data[2:])
|
return (cast(int, struct.unpack_from('<H', ad_data, 0)[0]), ad_data[2:])
|
||||||
|
|
||||||
if ad_type == AdvertisingData.LE_BLUETOOTH_DEVICE_ADDRESS:
|
|
||||||
return Address(ad_data)
|
|
||||||
|
|
||||||
return ad_data
|
return ad_data
|
||||||
|
|
||||||
def append(self, data):
|
def append(self, data):
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ class OobData:
|
|||||||
elif ad_type == AdvertisingData.LE_ROLE:
|
elif ad_type == AdvertisingData.LE_ROLE:
|
||||||
instance.role = LeRole(ad_data[0])
|
instance.role = LeRole(ad_data[0])
|
||||||
elif ad_type == AdvertisingData.LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE:
|
elif ad_type == AdvertisingData.LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE:
|
||||||
shared_data_c: Optional[bytes] = AdvertisingData.ad_data_to_object(
|
shared_data_c = AdvertisingData.ad_data_to_object(
|
||||||
ad_type, ad_data
|
ad_type, ad_data
|
||||||
)
|
)
|
||||||
elif ad_type == AdvertisingData.LE_SECURE_CONNECTIONS_RANDOM_VALUE:
|
elif ad_type == AdvertisingData.LE_SECURE_CONNECTIONS_RANDOM_VALUE:
|
||||||
shared_data_r: bytes = AdvertisingData.ad_data_to_object(
|
shared_data_r = AdvertisingData.ad_data_to_object(
|
||||||
ad_type, ad_data
|
ad_type, ad_data
|
||||||
)
|
)
|
||||||
elif ad_type == AdvertisingData.SECURITY_MANAGER_TK_VALUE:
|
elif ad_type == AdvertisingData.SECURITY_MANAGER_TK_VALUE:
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ from bumble.smp import (
|
|||||||
SMP_PAIRING_NOT_SUPPORTED_ERROR,
|
SMP_PAIRING_NOT_SUPPORTED_ERROR,
|
||||||
SMP_CONFIRM_VALUE_FAILED_ERROR,
|
SMP_CONFIRM_VALUE_FAILED_ERROR,
|
||||||
OobContext,
|
OobContext,
|
||||||
OobLegacyContext
|
OobLegacyContext,
|
||||||
)
|
)
|
||||||
from bumble.core import ProtocolError
|
from bumble.core import ProtocolError
|
||||||
from bumble.hci import HCI_AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P_256_TYPE
|
from bumble.hci import HCI_AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P_256_TYPE
|
||||||
@@ -587,14 +587,14 @@ async def test_self_smp_oob_sc():
|
|||||||
mitm=True,
|
mitm=True,
|
||||||
sc=True,
|
sc=True,
|
||||||
bonding=True,
|
bonding=True,
|
||||||
oob=PairingConfig.OobConfig(oob_context_1, oob_context_2.share(), None)
|
oob=PairingConfig.OobConfig(oob_context_1, oob_context_2.share(), None),
|
||||||
)
|
)
|
||||||
|
|
||||||
pairing_config_2 = PairingConfig(
|
pairing_config_2 = PairingConfig(
|
||||||
mitm=True,
|
mitm=True,
|
||||||
sc=True,
|
sc=True,
|
||||||
bonding=True,
|
bonding=True,
|
||||||
oob=PairingConfig.OobConfig(oob_context_2, oob_context_1.share(), None)
|
oob=PairingConfig.OobConfig(oob_context_2, oob_context_1.share(), None),
|
||||||
)
|
)
|
||||||
|
|
||||||
await _test_self_smp_with_configs(pairing_config_1, pairing_config_2)
|
await _test_self_smp_with_configs(pairing_config_1, pairing_config_2)
|
||||||
@@ -603,7 +603,7 @@ async def test_self_smp_oob_sc():
|
|||||||
mitm=True,
|
mitm=True,
|
||||||
sc=True,
|
sc=True,
|
||||||
bonding=True,
|
bonding=True,
|
||||||
oob=PairingConfig.OobConfig(oob_context_2, None, None)
|
oob=PairingConfig.OobConfig(oob_context_2, None, None),
|
||||||
)
|
)
|
||||||
|
|
||||||
await _test_self_smp_with_configs(pairing_config_1, pairing_config_3)
|
await _test_self_smp_with_configs(pairing_config_1, pairing_config_3)
|
||||||
@@ -613,7 +613,7 @@ async def test_self_smp_oob_sc():
|
|||||||
mitm=True,
|
mitm=True,
|
||||||
sc=True,
|
sc=True,
|
||||||
bonding=True,
|
bonding=True,
|
||||||
oob=PairingConfig.OobConfig(oob_context_2, oob_context_2.share(), None)
|
oob=PairingConfig.OobConfig(oob_context_2, oob_context_2.share(), None),
|
||||||
)
|
)
|
||||||
|
|
||||||
with pytest.raises(ProtocolError) as error:
|
with pytest.raises(ProtocolError) as error:
|
||||||
@@ -634,14 +634,14 @@ async def test_self_smp_oob_legacy():
|
|||||||
mitm=True,
|
mitm=True,
|
||||||
sc=False,
|
sc=False,
|
||||||
bonding=True,
|
bonding=True,
|
||||||
oob=PairingConfig.OobConfig(None, None, legacy_context)
|
oob=PairingConfig.OobConfig(None, None, legacy_context),
|
||||||
)
|
)
|
||||||
|
|
||||||
pairing_config_2 = PairingConfig(
|
pairing_config_2 = PairingConfig(
|
||||||
mitm=True,
|
mitm=True,
|
||||||
sc=True,
|
sc=True,
|
||||||
bonding=True,
|
bonding=True,
|
||||||
oob=PairingConfig.OobConfig(OobContext(), None, legacy_context)
|
oob=PairingConfig.OobConfig(OobContext(), None, legacy_context),
|
||||||
)
|
)
|
||||||
|
|
||||||
await _test_self_smp_with_configs(pairing_config_1, pairing_config_2)
|
await _test_self_smp_with_configs(pairing_config_1, pairing_config_2)
|
||||||
|
|||||||
Reference in New Issue
Block a user