scapy.layers.bluetooth module

Bluetooth layers, sockets and send/receive functions.

class scapy.layers.bluetooth.ATT_Error_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Error_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Error_Response).request>, <Field (ATT_Error_Response).handle>, <Field (ATT_Error_Response).ecode>]
class scapy.layers.bluetooth.ATT_Exchange_MTU_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Exchange_MTU_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Exchange_MTU_Request).mtu>]
class scapy.layers.bluetooth.ATT_Exchange_MTU_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Exchange_MTU_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Exchange_MTU_Response).mtu>]
class scapy.layers.bluetooth.ATT_Execute_Write_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Execute_Write_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Execute_Write_Request).flags>]
class scapy.layers.bluetooth.ATT_Execute_Write_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Execute_Write_Response'>, <class 'scapy.packet.Packet'>]
class scapy.layers.bluetooth.ATT_Find_By_Type_Value_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Find_By_Type_Value_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Find_By_Type_Value_Request).start>, <Field (ATT_Find_By_Type_Value_Request).end>, <Field (ATT_Find_By_Type_Value_Request).uuid>, <Field (ATT_Find_By_Type_Value_Request).data>]
class scapy.layers.bluetooth.ATT_Find_By_Type_Value_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Find_By_Type_Value_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Find_By_Type_Value_Response).handles>]
class scapy.layers.bluetooth.ATT_Find_Information_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Find_Information_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Find_Information_Request).start>, <Field (ATT_Find_Information_Request).end>]
class scapy.layers.bluetooth.ATT_Find_Information_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Find_Information_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Find_Information_Response).format>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]
class scapy.layers.bluetooth.ATT_Handle

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Handle'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (ATT_Handle).handle>, <Field (ATT_Handle).value>]
class scapy.layers.bluetooth.ATT_Handle_UUID128

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Handle_UUID128'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (ATT_Handle_UUID128).handle>, <Field (ATT_Handle_UUID128).value>]
class scapy.layers.bluetooth.ATT_Handle_Value_Indication

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Handle_Value_Indication'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Handle_Value_Indication).gatt_handle>, <Field (ATT_Handle_Value_Indication).value>]
class scapy.layers.bluetooth.ATT_Handle_Value_Notification

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Handle_Value_Notification'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Handle_Value_Notification).gatt_handle>, <Field (ATT_Handle_Value_Notification).value>]
class scapy.layers.bluetooth.ATT_Handle_Variable(_pkt=b'', val_length=2, **kwargs)

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Handle_Variable'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (ATT_Handle_Variable).handle>, <Field (ATT_Handle_Variable).value>]
val_length
class scapy.layers.bluetooth.ATT_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Hdr).opcode>]
payload_guess = [({'opcode': 1}, <class 'scapy.layers.bluetooth.ATT_Error_Response'>), ({'opcode': 2}, <class 'scapy.layers.bluetooth.ATT_Exchange_MTU_Request'>), ({'opcode': 3}, <class 'scapy.layers.bluetooth.ATT_Exchange_MTU_Response'>), ({'opcode': 4}, <class 'scapy.layers.bluetooth.ATT_Find_Information_Request'>), ({'opcode': 5}, <class 'scapy.layers.bluetooth.ATT_Find_Information_Response'>), ({'opcode': 6}, <class 'scapy.layers.bluetooth.ATT_Find_By_Type_Value_Request'>), ({'opcode': 7}, <class 'scapy.layers.bluetooth.ATT_Find_By_Type_Value_Response'>), ({'opcode': 8}, <class 'scapy.layers.bluetooth.ATT_Read_By_Type_Request_128bit'>), ({'opcode': 8}, <class 'scapy.layers.bluetooth.ATT_Read_By_Type_Request'>), ({'opcode': 9}, <class 'scapy.layers.bluetooth.ATT_Read_By_Type_Response'>), ({'opcode': 10}, <class 'scapy.layers.bluetooth.ATT_Read_Request'>), ({'opcode': 11}, <class 'scapy.layers.bluetooth.ATT_Read_Response'>), ({'opcode': 12}, <class 'scapy.layers.bluetooth.ATT_Read_Blob_Request'>), ({'opcode': 13}, <class 'scapy.layers.bluetooth.ATT_Read_Blob_Response'>), ({'opcode': 14}, <class 'scapy.layers.bluetooth.ATT_Read_Multiple_Request'>), ({'opcode': 15}, <class 'scapy.layers.bluetooth.ATT_Read_Multiple_Response'>), ({'opcode': 16}, <class 'scapy.layers.bluetooth.ATT_Read_By_Group_Type_Request'>), ({'opcode': 17}, <class 'scapy.layers.bluetooth.ATT_Read_By_Group_Type_Response'>), ({'opcode': 18}, <class 'scapy.layers.bluetooth.ATT_Write_Request'>), ({'opcode': 19}, <class 'scapy.layers.bluetooth.ATT_Write_Response'>), ({'opcode': 22}, <class 'scapy.layers.bluetooth.ATT_Prepare_Write_Request'>), ({'opcode': 23}, <class 'scapy.layers.bluetooth.ATT_Prepare_Write_Response'>), ({'opcode': 24}, <class 'scapy.layers.bluetooth.ATT_Execute_Write_Request'>), ({'opcode': 25}, <class 'scapy.layers.bluetooth.ATT_Execute_Write_Response'>), ({'opcode': 82}, <class 'scapy.layers.bluetooth.ATT_Write_Command'>), ({'opcode': 27}, <class 'scapy.layers.bluetooth.ATT_Handle_Value_Notification'>), ({'opcode': 29}, <class 'scapy.layers.bluetooth.ATT_Handle_Value_Indication'>)]
class scapy.layers.bluetooth.ATT_Prepare_Write_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Prepare_Write_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Prepare_Write_Request,ATT_Prepare_Write_Response).gatt_handle>, <Field (ATT_Prepare_Write_Request,ATT_Prepare_Write_Response).offset>, <Field (ATT_Prepare_Write_Request,ATT_Prepare_Write_Response).data>]
class scapy.layers.bluetooth.ATT_Prepare_Write_Response

Bases: scapy.layers.bluetooth.ATT_Prepare_Write_Request

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Prepare_Write_Response'>, <class 'scapy.layers.bluetooth.ATT_Prepare_Write_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Prepare_Write_Request,ATT_Prepare_Write_Response).gatt_handle>, <Field (ATT_Prepare_Write_Request,ATT_Prepare_Write_Response).offset>, <Field (ATT_Prepare_Write_Request,ATT_Prepare_Write_Response).data>]
class scapy.layers.bluetooth.ATT_Read_Blob_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_Blob_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_Blob_Request).gatt_handle>, <Field (ATT_Read_Blob_Request).offset>]
class scapy.layers.bluetooth.ATT_Read_Blob_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_Blob_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_Blob_Response).value>]
class scapy.layers.bluetooth.ATT_Read_By_Group_Type_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_By_Group_Type_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_By_Group_Type_Request).start>, <Field (ATT_Read_By_Group_Type_Request).end>, <Field (ATT_Read_By_Group_Type_Request).uuid>]
class scapy.layers.bluetooth.ATT_Read_By_Group_Type_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_By_Group_Type_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_By_Group_Type_Response).length>, <Field (ATT_Read_By_Group_Type_Response).data>]
class scapy.layers.bluetooth.ATT_Read_By_Type_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_By_Type_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_By_Type_Request).start>, <Field (ATT_Read_By_Type_Request).end>, <Field (ATT_Read_By_Type_Request).uuid>]
class scapy.layers.bluetooth.ATT_Read_By_Type_Request_128bit

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_By_Type_Request_128bit'>, <class 'scapy.packet.Packet'>]
classmethod dispatch_hook(_pkt=None, *args, **kargs)
fields_desc = [<Field (ATT_Read_By_Type_Request_128bit).start>, <Field (ATT_Read_By_Type_Request_128bit).end>, <Field (ATT_Read_By_Type_Request_128bit).uuid1>, <Field (ATT_Read_By_Type_Request_128bit).uuid2>]
class scapy.layers.bluetooth.ATT_Read_By_Type_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_By_Type_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_By_Type_Response).len>, <Field (ATT_Read_By_Type_Response).handles>]
class scapy.layers.bluetooth.ATT_Read_Multiple_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_Multiple_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_Multiple_Request).handles>]
class scapy.layers.bluetooth.ATT_Read_Multiple_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_Multiple_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_Multiple_Response).values>]
class scapy.layers.bluetooth.ATT_Read_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_Request).gatt_handle>]
class scapy.layers.bluetooth.ATT_Read_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Read_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Read_Response).value>]
class scapy.layers.bluetooth.ATT_Write_Command

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Write_Command'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Write_Command).gatt_handle>, <Field (ATT_Write_Command).data>]
class scapy.layers.bluetooth.ATT_Write_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Write_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (ATT_Write_Request).gatt_handle>, <Field (ATT_Write_Request).data>]
class scapy.layers.bluetooth.ATT_Write_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.ATT_Write_Response'>, <class 'scapy.packet.Packet'>]
exception scapy.layers.bluetooth.BluetoothCommandError

Bases: BaseException

class scapy.layers.bluetooth.BluetoothHCISocket(iface=65536, type=None)

Bases: scapy.supersocket.SuperSocket

desc = 'read/write on a BlueTooth HCI socket'
recv(x=65535)
class scapy.layers.bluetooth.BluetoothL2CAPSocket(bt_address)

Bases: scapy.supersocket.SuperSocket

desc = 'read/write packets on a connected L2CAP socket'
recv(x=65535)
class scapy.layers.bluetooth.BluetoothRFCommSocket(bt_address, port=0)

Bases: scapy.layers.bluetooth.BluetoothL2CAPSocket

read/write packets on a connected RFCOMM socket

exception scapy.layers.bluetooth.BluetoothSocketError

Bases: BaseException

class scapy.layers.bluetooth.BluetoothUserSocket(adapter_index=0)

Bases: scapy.supersocket.SuperSocket

close()
desc = 'read/write H4 over a Bluetooth user channel'
flush()
readable(timeout=0)
recv(x=65535)
send_command(cmd)
class scapy.layers.bluetooth.EIR_CompleteList128BitServiceUUIDs

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_CompleteList128BitServiceUUIDs'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_CompleteList128BitServiceUUIDs,EIR_IncompleteList128BitServiceUUIDs).svc_uuids>]
class scapy.layers.bluetooth.EIR_CompleteList16BitServiceUUIDs

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_CompleteList16BitServiceUUIDs'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_CompleteList16BitServiceUUIDs,EIR_IncompleteList16BitServiceUUIDs).svc_uuids>]
class scapy.layers.bluetooth.EIR_CompleteLocalName

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_CompleteLocalName'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_CompleteLocalName,EIR_ShortenedLocalName).local_name>]
class scapy.layers.bluetooth.EIR_Device_ID

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_Device_ID'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_Device_ID).vendor_id_source>, <Field (EIR_Device_ID).vendor_id>, <Field (EIR_Device_ID).product_id>, <Field (EIR_Device_ID).version>]
class scapy.layers.bluetooth.EIR_Element

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
static length_from(pkt)
class scapy.layers.bluetooth.EIR_Flags

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_Flags'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_Flags).flags>]
class scapy.layers.bluetooth.EIR_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.EIR_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_Hdr).len>, <Field (EIR_Hdr).type>]
mysummary()

DEV: can be overloaded to return a string that summarizes the layer. Only one mysummary() is used in a whole packet summary: the one of the upper layer, # noqa: E501 except if a mysummary() also returns (as a couple) a list of layers whose # noqa: E501 mysummary() must be called if they are present.

payload_guess = [({'type': 1}, <class 'scapy.layers.bluetooth.EIR_Flags'>), ({'type': 2}, <class 'scapy.layers.bluetooth.EIR_IncompleteList16BitServiceUUIDs'>), ({'type': 3}, <class 'scapy.layers.bluetooth.EIR_CompleteList16BitServiceUUIDs'>), ({'type': 6}, <class 'scapy.layers.bluetooth.EIR_IncompleteList128BitServiceUUIDs'>), ({'type': 7}, <class 'scapy.layers.bluetooth.EIR_CompleteList128BitServiceUUIDs'>), ({'type': 8}, <class 'scapy.layers.bluetooth.EIR_ShortenedLocalName'>), ({'type': 9}, <class 'scapy.layers.bluetooth.EIR_CompleteLocalName'>), ({'type': 16}, <class 'scapy.layers.bluetooth.EIR_Device_ID'>), ({'type': 10}, <class 'scapy.layers.bluetooth.EIR_TX_Power_Level'>), ({'type': 22}, <class 'scapy.layers.bluetooth.EIR_ServiceData16BitUUID'>), ({'type': 255}, <class 'scapy.layers.bluetooth.EIR_Manufacturer_Specific_Data'>), ({}, <class 'scapy.layers.bluetooth.EIR_Raw'>)]
class scapy.layers.bluetooth.EIR_IncompleteList128BitServiceUUIDs

Bases: scapy.layers.bluetooth.EIR_CompleteList128BitServiceUUIDs

aliastypes = [<class 'scapy.layers.bluetooth.EIR_IncompleteList128BitServiceUUIDs'>, <class 'scapy.layers.bluetooth.EIR_CompleteList128BitServiceUUIDs'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_CompleteList128BitServiceUUIDs,EIR_IncompleteList128BitServiceUUIDs).svc_uuids>]
class scapy.layers.bluetooth.EIR_IncompleteList16BitServiceUUIDs

Bases: scapy.layers.bluetooth.EIR_CompleteList16BitServiceUUIDs

aliastypes = [<class 'scapy.layers.bluetooth.EIR_IncompleteList16BitServiceUUIDs'>, <class 'scapy.layers.bluetooth.EIR_CompleteList16BitServiceUUIDs'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_CompleteList16BitServiceUUIDs,EIR_IncompleteList16BitServiceUUIDs).svc_uuids>]
class scapy.layers.bluetooth.EIR_Manufacturer_Specific_Data

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_Manufacturer_Specific_Data'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
default_payload_class(payload)

DEV: Returns the default payload class if nothing has been found by the guess_payload_class() method.

Parameters:payload (str) – the layer’s payload
Returns:the default payload class define inside the configuration file
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (EIR_Manufacturer_Specific_Data).company_id>]
payload_guess = [({'company_id': 76}, <class 'scapy.contrib.ibeacon.Apple_BLE_Frame'>)]
classmethod register_magic_payload(payload_cls, magic_check=None)

Registers a payload type that uses magic data.

Traditional payloads require registration of a Bluetooth Company ID (requires company membership of the Bluetooth SIG), or a Bluetooth Short UUID (requires a once-off payment).

There are alternatives which don’t require registration (such as 128-bit UUIDs), but the biggest consumer of energy in a beacon is the radio – so the energy consumption of a beacon is proportional to the number of bytes in a beacon frame.

Some beacon formats side-step this issue by using the Company ID of their beacon hardware manufacturer, and adding a “magic data sequence” at the start of the Manufacturer Specific Data field.

Examples of this are AltBeacon and GeoBeacon.

For an example of this method in use, see scapy.contrib.altbeacon.

Parameters:
  • payload_cls (Type[scapy.packet.Packet]) – A reference to a Packet subclass to register as a payload.
  • bool] magic_check (Callable[[bytes],) – (optional) callable to use to if a payload should be associated with this type. If not supplied, payload_cls.magic_check is used instead.
Raises:

TypeError – If magic_check is not specified, and payload_cls.magic_check is not implemented.

registered_magic_payloads = {<class 'scapy.contrib.altbeacon.AltBeacon'>: <bound method AltBeacon.magic_check of <class 'scapy.contrib.altbeacon.AltBeacon'>>}
class scapy.layers.bluetooth.EIR_Raw

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_Raw'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_Raw).data>]
class scapy.layers.bluetooth.EIR_ServiceData16BitUUID

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_ServiceData16BitUUID'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (EIR_ServiceData16BitUUID).svc_uuid>]
payload_guess = [({'svc_uuid': 65194}, <class 'scapy.contrib.eddystone.Eddystone_Frame'>)]
class scapy.layers.bluetooth.EIR_ShortenedLocalName

Bases: scapy.layers.bluetooth.EIR_CompleteLocalName

aliastypes = [<class 'scapy.layers.bluetooth.EIR_ShortenedLocalName'>, <class 'scapy.layers.bluetooth.EIR_CompleteLocalName'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_CompleteLocalName,EIR_ShortenedLocalName).local_name>]
class scapy.layers.bluetooth.EIR_TX_Power_Level

Bases: scapy.layers.bluetooth.EIR_Element

aliastypes = [<class 'scapy.layers.bluetooth.EIR_TX_Power_Level'>, <class 'scapy.layers.bluetooth.EIR_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EIR_TX_Power_Level).level>]
class scapy.layers.bluetooth.HCI_ACL_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_ACL_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_ACL_Hdr).BC>, <Field (HCI_ACL_Hdr).PB>, <Field (HCI_ACL_Hdr).handle>, <Field (HCI_ACL_Hdr).len>]
payload_guess = [({}, <class 'scapy.layers.bluetooth.L2CAP_Hdr'>)]
post_build(p, pay)

DEV: called right after the current layer is build.

Parameters:
  • pkt (str) – the current packet (build by self_buil function)
  • pay (str) – the packet payload (build by do_build_payload function)
Returns:

a string of the packet with the payload

post_dissect(s)

DEV: is called right after the current layer has been dissected

pre_dissect(s)

DEV: is called right before the current layer is dissected

class scapy.layers.bluetooth.HCI_Cmd_Complete_LE_Read_White_List_Size

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Complete_LE_Read_White_List_Size'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Complete_LE_Read_White_List_Size).status>, <Field (HCI_Cmd_Complete_LE_Read_White_List_Size).size>]
class scapy.layers.bluetooth.HCI_Cmd_Complete_Read_BD_Addr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Complete_Read_BD_Addr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Complete_Read_BD_Addr).addr>]
class scapy.layers.bluetooth.HCI_Cmd_Connect_Accept_Timeout

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Connect_Accept_Timeout'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Connect_Accept_Timeout).timeout>]
class scapy.layers.bluetooth.HCI_Cmd_Disconnect

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Disconnect'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Disconnect).handle>, <Field (HCI_Cmd_Disconnect).reason>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Add_Device_To_White_List

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Add_Device_To_White_List'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Add_Device_To_White_List,HCI_Cmd_LE_Remove_Device_From_White_List).atype>, <Field (HCI_Cmd_LE_Add_Device_To_White_List,HCI_Cmd_LE_Remove_Device_From_White_List).address>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Clear_White_List

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Clear_White_List'>, <class 'scapy.packet.Packet'>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Connection_Update

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Connection_Update'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Connection_Update).handle>, <Field (HCI_Cmd_LE_Connection_Update).min_interval>, <Field (HCI_Cmd_LE_Connection_Update).max_interval>, <Field (HCI_Cmd_LE_Connection_Update).latency>, <Field (HCI_Cmd_LE_Connection_Update).timeout>, <Field (HCI_Cmd_LE_Connection_Update).min_ce>, <Field (HCI_Cmd_LE_Connection_Update).max_ce>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Create_Connection

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Create_Connection'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Create_Connection).interval>, <Field (HCI_Cmd_LE_Create_Connection).window>, <Field (HCI_Cmd_LE_Create_Connection).filter>, <Field (HCI_Cmd_LE_Create_Connection).patype>, <Field (HCI_Cmd_LE_Create_Connection).paddr>, <Field (HCI_Cmd_LE_Create_Connection).atype>, <Field (HCI_Cmd_LE_Create_Connection).min_interval>, <Field (HCI_Cmd_LE_Create_Connection).max_interval>, <Field (HCI_Cmd_LE_Create_Connection).latency>, <Field (HCI_Cmd_LE_Create_Connection).timeout>, <Field (HCI_Cmd_LE_Create_Connection).min_ce>, <Field (HCI_Cmd_LE_Create_Connection).max_ce>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Create_Connection_Cancel

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Create_Connection_Cancel'>, <class 'scapy.packet.Packet'>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Host_Supported

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Host_Supported'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Host_Supported).supported>, <Field (HCI_Cmd_LE_Host_Supported).simultaneous>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply).handle>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Long_Term_Key_Request_Reply

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Long_Term_Key_Request_Reply'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Long_Term_Key_Request_Reply).handle>, <Field (HCI_Cmd_LE_Long_Term_Key_Request_Reply).ltk>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Read_Buffer_Size

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Read_Buffer_Size'>, <class 'scapy.packet.Packet'>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Read_Remote_Used_Features

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Read_Remote_Used_Features'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Read_Remote_Used_Features).handle>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Read_White_List_Size

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Read_White_List_Size'>, <class 'scapy.packet.Packet'>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Remove_Device_From_White_List

Bases: scapy.layers.bluetooth.HCI_Cmd_LE_Add_Device_To_White_List

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Remove_Device_From_White_List'>, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Add_Device_To_White_List'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Add_Device_To_White_List,HCI_Cmd_LE_Remove_Device_From_White_List).atype>, <Field (HCI_Cmd_LE_Add_Device_To_White_List,HCI_Cmd_LE_Remove_Device_From_White_List).address>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertise_Enable

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertise_Enable'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Set_Advertise_Enable).enable>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertising_Data

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertising_Data'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Set_Advertising_Data).len>, <scapy.fields.PadField object>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertising_Parameters

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertising_Parameters'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Set_Advertising_Parameters).interval_min>, <Field (HCI_Cmd_LE_Set_Advertising_Parameters).interval_max>, <Field (HCI_Cmd_LE_Set_Advertising_Parameters).adv_type>, <Field (HCI_Cmd_LE_Set_Advertising_Parameters).oatype>, <Field (HCI_Cmd_LE_Set_Advertising_Parameters).datype>, <Field (HCI_Cmd_LE_Set_Advertising_Parameters).daddr>, <Field (HCI_Cmd_LE_Set_Advertising_Parameters).channel_map>, <Field (HCI_Cmd_LE_Set_Advertising_Parameters).filter_policy>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Set_Random_Address

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Random_Address'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Set_Random_Address).address>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Enable

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Enable'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Set_Scan_Enable).enable>, <Field (HCI_Cmd_LE_Set_Scan_Enable).filter_dups>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Parameters

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Parameters'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Set_Scan_Parameters).type>, <Field (HCI_Cmd_LE_Set_Scan_Parameters).interval>, <Field (HCI_Cmd_LE_Set_Scan_Parameters).window>, <Field (HCI_Cmd_LE_Set_Scan_Parameters).atype>, <Field (HCI_Cmd_LE_Set_Scan_Parameters).policy>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Response_Data

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Response_Data'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Set_Scan_Response_Data).len>, <Field (HCI_Cmd_LE_Set_Scan_Response_Data).data>]
class scapy.layers.bluetooth.HCI_Cmd_LE_Start_Encryption_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_LE_Start_Encryption_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_LE_Start_Encryption_Request).handle>, <Field (HCI_Cmd_LE_Start_Encryption_Request).rand>, <Field (HCI_Cmd_LE_Start_Encryption_Request).ediv>, <Field (HCI_Cmd_LE_Start_Encryption_Request).ltk>]
class scapy.layers.bluetooth.HCI_Cmd_Read_BD_Addr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Read_BD_Addr'>, <class 'scapy.packet.Packet'>]
class scapy.layers.bluetooth.HCI_Cmd_Reset

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Reset'>, <class 'scapy.packet.Packet'>]
class scapy.layers.bluetooth.HCI_Cmd_Set_Event_Filter

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Set_Event_Filter'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Set_Event_Filter).type>]
class scapy.layers.bluetooth.HCI_Cmd_Set_Event_Mask

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Set_Event_Mask'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Set_Event_Mask).mask>]
class scapy.layers.bluetooth.HCI_Cmd_Write_Extended_Inquiry_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Write_Extended_Inquiry_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Write_Extended_Inquiry_Response).fec_required>, <Field (HCI_Cmd_Write_Extended_Inquiry_Response).eir_data>]
class scapy.layers.bluetooth.HCI_Cmd_Write_Local_Name

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Cmd_Write_Local_Name'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Cmd_Write_Local_Name).name>]
class scapy.layers.bluetooth.HCI_Command_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Command_Hdr'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (HCI_Command_Hdr).opcode>, <Field (HCI_Command_Hdr).len>]
payload_guess = [({'opcode': 3075}, <class 'scapy.layers.bluetooth.HCI_Cmd_Reset'>), ({'opcode': 3073}, <class 'scapy.layers.bluetooth.HCI_Cmd_Set_Event_Mask'>), ({'opcode': 3077}, <class 'scapy.layers.bluetooth.HCI_Cmd_Set_Event_Filter'>), ({'opcode': 3094}, <class 'scapy.layers.bluetooth.HCI_Cmd_Connect_Accept_Timeout'>), ({'opcode': 3181}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Host_Supported'>), ({'opcode': 3154}, <class 'scapy.layers.bluetooth.HCI_Cmd_Write_Extended_Inquiry_Response'>), ({'opcode': 4105}, <class 'scapy.layers.bluetooth.HCI_Cmd_Read_BD_Addr'>), ({'opcode': 3091}, <class 'scapy.layers.bluetooth.HCI_Cmd_Write_Local_Name'>), ({'opcode': 8194}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Read_Buffer_Size'>), ({'opcode': 8197}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Random_Address'>), ({'opcode': 8198}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertising_Parameters'>), ({'opcode': 8200}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertising_Data'>), ({'opcode': 8201}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Response_Data'>), ({'opcode': 8202}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Advertise_Enable'>), ({'opcode': 8203}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Parameters'>), ({'opcode': 8204}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Set_Scan_Enable'>), ({'opcode': 1030}, <class 'scapy.layers.bluetooth.HCI_Cmd_Disconnect'>), ({'opcode': 8205}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Create_Connection'>), ({'opcode': 8206}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Create_Connection_Cancel'>), ({'opcode': 8207}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Read_White_List_Size'>), ({'opcode': 8208}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Clear_White_List'>), ({'opcode': 8209}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Add_Device_To_White_List'>), ({'opcode': 8210}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Remove_Device_From_White_List'>), ({'opcode': 8211}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Connection_Update'>), ({'opcode': 8214}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Read_Remote_Used_Features'>), ({'opcode': 8217}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Start_Encryption_Request'>), ({'opcode': 8217}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Start_Encryption_Request'>), ({'opcode': 8218}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Long_Term_Key_Request_Reply'>), ({'opcode': 8219}, <class 'scapy.layers.bluetooth.HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply'>)]
post_build(p, pay)

DEV: called right after the current layer is build.

Parameters:
  • pkt (str) – the current packet (build by self_buil function)
  • pay (str) – the packet payload (build by do_build_payload function)
Returns:

a string of the packet with the payload

class scapy.layers.bluetooth.HCI_Event_Command_Complete

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Event_Command_Complete'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (HCI_Event_Command_Complete).number>, <Field (HCI_Event_Command_Complete).opcode>, <Field (HCI_Event_Command_Complete).status>]
payload_guess = [({'opcode': 4105}, <class 'scapy.layers.bluetooth.HCI_Cmd_Complete_Read_BD_Addr'>), ({'opcode': 8207}, <class 'scapy.layers.bluetooth.HCI_Cmd_Complete_LE_Read_White_List_Size'>)]
class scapy.layers.bluetooth.HCI_Event_Command_Status

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Event_Command_Status'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (HCI_Event_Command_Status).status>, <Field (HCI_Event_Command_Status).number>, <Field (HCI_Event_Command_Status).opcode>]
class scapy.layers.bluetooth.HCI_Event_Disconnection_Complete

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Event_Disconnection_Complete'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Event_Disconnection_Complete).status>, <Field (HCI_Event_Disconnection_Complete).handle>, <Field (HCI_Event_Disconnection_Complete).reason>]
class scapy.layers.bluetooth.HCI_Event_Encryption_Change

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Event_Encryption_Change'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Event_Encryption_Change).status>, <Field (HCI_Event_Encryption_Change).handle>, <Field (HCI_Event_Encryption_Change).enabled>]
class scapy.layers.bluetooth.HCI_Event_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Event_Hdr'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (HCI_Event_Hdr).code>, <Field (HCI_Event_Hdr).len>]
payload_guess = [({'code': 5}, <class 'scapy.layers.bluetooth.HCI_Event_Disconnection_Complete'>), ({'code': 8}, <class 'scapy.layers.bluetooth.HCI_Event_Encryption_Change'>), ({'code': 14}, <class 'scapy.layers.bluetooth.HCI_Event_Command_Complete'>), ({'code': 15}, <class 'scapy.layers.bluetooth.HCI_Event_Command_Status'>), ({'code': 19}, <class 'scapy.layers.bluetooth.HCI_Event_Number_Of_Completed_Packets'>), ({'code': 62}, <class 'scapy.layers.bluetooth.HCI_Event_LE_Meta'>)]
class scapy.layers.bluetooth.HCI_Event_LE_Meta

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Event_LE_Meta'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (HCI_Event_LE_Meta).event>]
payload_guess = [({'event': 1}, <class 'scapy.layers.bluetooth.HCI_LE_Meta_Connection_Complete'>), ({'event': 2}, <class 'scapy.layers.bluetooth.HCI_LE_Meta_Advertising_Reports'>), ({'event': 3}, <class 'scapy.layers.bluetooth.HCI_LE_Meta_Connection_Update_Complete'>), ({'event': 5}, <class 'scapy.layers.bluetooth.HCI_LE_Meta_Long_Term_Key_Request'>)]
class scapy.layers.bluetooth.HCI_Event_Number_Of_Completed_Packets

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Event_Number_Of_Completed_Packets'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Event_Number_Of_Completed_Packets).number>]
class scapy.layers.bluetooth.HCI_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_Hdr).type>]
mysummary()

DEV: can be overloaded to return a string that summarizes the layer. Only one mysummary() is used in a whole packet summary: the one of the upper layer, # noqa: E501 except if a mysummary() also returns (as a couple) a list of layers whose # noqa: E501 mysummary() must be called if they are present.

payload_guess = [({'type': 1}, <class 'scapy.layers.bluetooth.HCI_Command_Hdr'>), ({'type': 2}, <class 'scapy.layers.bluetooth.HCI_ACL_Hdr'>), ({'type': 4}, <class 'scapy.layers.bluetooth.HCI_Event_Hdr'>), ({}, <class 'scapy.packet.Raw'>)]
class scapy.layers.bluetooth.HCI_LE_Meta_Advertising_Report

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_LE_Meta_Advertising_Report'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (HCI_LE_Meta_Advertising_Report).type>, <Field (HCI_LE_Meta_Advertising_Report).atype>, <Field (HCI_LE_Meta_Advertising_Report).addr>, <Field (HCI_LE_Meta_Advertising_Report).len>, <Field (HCI_LE_Meta_Advertising_Report).data>, <Field (HCI_LE_Meta_Advertising_Report).rssi>]
class scapy.layers.bluetooth.HCI_LE_Meta_Advertising_Reports

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_LE_Meta_Advertising_Reports'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_LE_Meta_Advertising_Reports).len>, <Field (HCI_LE_Meta_Advertising_Reports).reports>]
class scapy.layers.bluetooth.HCI_LE_Meta_Connection_Complete

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_LE_Meta_Connection_Complete'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (HCI_LE_Meta_Connection_Complete).status>, <Field (HCI_LE_Meta_Connection_Complete).handle>, <Field (HCI_LE_Meta_Connection_Complete).role>, <Field (HCI_LE_Meta_Connection_Complete).patype>, <Field (HCI_LE_Meta_Connection_Complete).paddr>, <Field (HCI_LE_Meta_Connection_Complete).interval>, <Field (HCI_LE_Meta_Connection_Complete).latency>, <Field (HCI_LE_Meta_Connection_Complete).supervision>, <Field (HCI_LE_Meta_Connection_Complete).clock_latency>]
class scapy.layers.bluetooth.HCI_LE_Meta_Connection_Update_Complete

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_LE_Meta_Connection_Update_Complete'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_LE_Meta_Connection_Update_Complete).status>, <Field (HCI_LE_Meta_Connection_Update_Complete).handle>, <Field (HCI_LE_Meta_Connection_Update_Complete).interval>, <Field (HCI_LE_Meta_Connection_Update_Complete).latency>, <Field (HCI_LE_Meta_Connection_Update_Complete).timeout>]
class scapy.layers.bluetooth.HCI_LE_Meta_Long_Term_Key_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_LE_Meta_Long_Term_Key_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_LE_Meta_Long_Term_Key_Request).handle>, <Field (HCI_LE_Meta_Long_Term_Key_Request).rand>, <Field (HCI_LE_Meta_Long_Term_Key_Request).ediv>]
class scapy.layers.bluetooth.HCI_PHDR_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.HCI_PHDR_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (HCI_PHDR_Hdr).direction>]
payload_guess = [({}, <class 'scapy.layers.bluetooth.HCI_Hdr'>)]
class scapy.layers.bluetooth.L2CAP_CmdHdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_CmdHdr'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (L2CAP_CmdHdr).code>, <Field (L2CAP_CmdHdr).id>, <Field (L2CAP_CmdHdr).len>]
payload_guess = [({'code': 1}, <class 'scapy.layers.bluetooth.L2CAP_CmdRej'>), ({'code': 2}, <class 'scapy.layers.bluetooth.L2CAP_ConnReq'>), ({'code': 3}, <class 'scapy.layers.bluetooth.L2CAP_ConnResp'>), ({'code': 4}, <class 'scapy.layers.bluetooth.L2CAP_ConfReq'>), ({'code': 5}, <class 'scapy.layers.bluetooth.L2CAP_ConfResp'>), ({'code': 6}, <class 'scapy.layers.bluetooth.L2CAP_DisconnReq'>), ({'code': 7}, <class 'scapy.layers.bluetooth.L2CAP_DisconnResp'>), ({'code': 10}, <class 'scapy.layers.bluetooth.L2CAP_InfoReq'>), ({'code': 11}, <class 'scapy.layers.bluetooth.L2CAP_InfoResp'>), ({'code': 18}, <class 'scapy.layers.bluetooth.L2CAP_Connection_Parameter_Update_Request'>), ({'code': 19}, <class 'scapy.layers.bluetooth.L2CAP_Connection_Parameter_Update_Response'>)]
post_build(p, pay)

DEV: called right after the current layer is build.

Parameters:
  • pkt (str) – the current packet (build by self_buil function)
  • pay (str) – the packet payload (build by do_build_payload function)
Returns:

a string of the packet with the payload

class scapy.layers.bluetooth.L2CAP_CmdRej

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_CmdRej'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_CmdRej).reason>]
class scapy.layers.bluetooth.L2CAP_ConfReq

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_ConfReq'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_ConfReq).dcid>, <Field (L2CAP_ConfReq).flags>]
class scapy.layers.bluetooth.L2CAP_ConfResp

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_ConfResp'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (L2CAP_ConfResp).scid>, <Field (L2CAP_ConfResp).flags>, <Field (L2CAP_ConfResp).result>]
class scapy.layers.bluetooth.L2CAP_ConnReq

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_ConnReq'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_ConnReq).psm>, <Field (L2CAP_ConnReq).scid>]
class scapy.layers.bluetooth.L2CAP_ConnResp

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_ConnResp'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (L2CAP_ConnResp).dcid>, <Field (L2CAP_ConnResp).scid>, <Field (L2CAP_ConnResp).result>, <Field (L2CAP_ConnResp).status>]
class scapy.layers.bluetooth.L2CAP_Connection_Parameter_Update_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_Connection_Parameter_Update_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_Connection_Parameter_Update_Request).min_interval>, <Field (L2CAP_Connection_Parameter_Update_Request).max_interval>, <Field (L2CAP_Connection_Parameter_Update_Request).slave_latency>, <Field (L2CAP_Connection_Parameter_Update_Request).timeout_mult>]
class scapy.layers.bluetooth.L2CAP_Connection_Parameter_Update_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_Connection_Parameter_Update_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_Connection_Parameter_Update_Response).move_result>]
class scapy.layers.bluetooth.L2CAP_DisconnReq

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_DisconnReq'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_DisconnReq).dcid>, <Field (L2CAP_DisconnReq).scid>]
class scapy.layers.bluetooth.L2CAP_DisconnResp

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_DisconnResp'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (L2CAP_DisconnResp).dcid>, <Field (L2CAP_DisconnResp).scid>]
class scapy.layers.bluetooth.L2CAP_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_Hdr).len>, <Field (L2CAP_Hdr).cid>]
payload_guess = [({'cid': 1}, <class 'scapy.layers.bluetooth.L2CAP_CmdHdr'>), ({'cid': 5}, <class 'scapy.layers.bluetooth.L2CAP_CmdHdr'>), ({'cid': 4}, <class 'scapy.layers.bluetooth.ATT_Hdr'>), ({'cid': 6}, <class 'scapy.layers.bluetooth.SM_Hdr'>)]
post_build(p, pay)

DEV: called right after the current layer is build.

Parameters:
  • pkt (str) – the current packet (build by self_buil function)
  • pay (str) – the packet payload (build by do_build_payload function)
Returns:

a string of the packet with the payload

class scapy.layers.bluetooth.L2CAP_InfoReq

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_InfoReq'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (L2CAP_InfoReq).type>, <Field (L2CAP_InfoReq).data>]
class scapy.layers.bluetooth.L2CAP_InfoResp

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.L2CAP_InfoResp'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

fields_desc = [<Field (L2CAP_InfoResp).type>, <Field (L2CAP_InfoResp).result>, <Field (L2CAP_InfoResp).data>]
class scapy.layers.bluetooth.LEMACField(name, default)

Bases: scapy.fields.Field

any2i(pkt, x)

Try to understand the most input values possible and make an internal value from them

i2m(pkt, x)

Convert internal value to machine value

i2repr(pkt, x)

Convert internal value to a nice representation

m2i(pkt, x)

Convert machine value to internal value

randval()

Return a volatile object whose value is both random and suitable for this field

class scapy.layers.bluetooth.LowEnergyBeaconHelper

Bases: object

Helpers for building packets for Bluetooth Low Energy Beacons.

Implementors provide a build_eir() implementation.

This is designed to be used as a mix-in – see scapy.contrib.eddystone and scapy.contrib.ibeacon for examples.

base_eir = [<EIR_Hdr type=flags |<EIR_Flags flags=general_disc_mode+br_edr_not_supported |>>]
build_advertising_report()

Builds a HCI_LE_Meta_Advertising_Report containing this frame.

Return type:scapy.bluetooth.HCI_LE_Meta_Advertising_Report
build_eir()

Builds a list of EIR messages to wrap this frame.

Users of this helper must implement this method.

Returns:List of HCI_Hdr with payloads that describe this beacon type
Return type:list[scapy.bluetooth.HCI_Hdr]
build_set_advertising_data()

Builds a HCI_Cmd_LE_Set_Advertising_Data containing this frame.

This includes the HCI_Hdr and HCI_Command_Hdr layers.

Return type:scapy.bluetooth.HCI_Hdr
class scapy.layers.bluetooth.SM_Confirm

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Confirm'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Confirm).confirm>]
class scapy.layers.bluetooth.SM_DHKey_Check

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_DHKey_Check'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_DHKey_Check).dhkey_check>]
class scapy.layers.bluetooth.SM_Encryption_Information

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Encryption_Information'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Encryption_Information).ltk>]
class scapy.layers.bluetooth.SM_Failed

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Failed'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Failed).reason>]
class scapy.layers.bluetooth.SM_Hdr

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Hdr).sm_command>]
payload_guess = [({'sm_command': 1}, <class 'scapy.layers.bluetooth.SM_Pairing_Request'>), ({'sm_command': 2}, <class 'scapy.layers.bluetooth.SM_Pairing_Response'>), ({'sm_command': 3}, <class 'scapy.layers.bluetooth.SM_Confirm'>), ({'sm_command': 4}, <class 'scapy.layers.bluetooth.SM_Random'>), ({'sm_command': 5}, <class 'scapy.layers.bluetooth.SM_Failed'>), ({'sm_command': 6}, <class 'scapy.layers.bluetooth.SM_Encryption_Information'>), ({'sm_command': 7}, <class 'scapy.layers.bluetooth.SM_Master_Identification'>), ({'sm_command': 8}, <class 'scapy.layers.bluetooth.SM_Identity_Information'>), ({'sm_command': 9}, <class 'scapy.layers.bluetooth.SM_Identity_Address_Information'>), ({'sm_command': 10}, <class 'scapy.layers.bluetooth.SM_Signing_Information'>), ({'sm_command': 12}, <class 'scapy.layers.bluetooth.SM_Public_Key'>), ({'sm_command': 13}, <class 'scapy.layers.bluetooth.SM_DHKey_Check'>)]
class scapy.layers.bluetooth.SM_Identity_Address_Information

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Identity_Address_Information'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Identity_Address_Information).atype>, <Field (SM_Identity_Address_Information).address>]
class scapy.layers.bluetooth.SM_Identity_Information

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Identity_Information'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Identity_Information).irk>]
class scapy.layers.bluetooth.SM_Master_Identification

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Master_Identification'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Master_Identification).ediv>, <Field (SM_Master_Identification).rand>]
class scapy.layers.bluetooth.SM_Pairing_Request

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Pairing_Request'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Pairing_Request).iocap>, <Field (SM_Pairing_Request).oob>, <Field (SM_Pairing_Request).authentication>, <Field (SM_Pairing_Request).max_key_size>, <Field (SM_Pairing_Request).initiator_key_distribution>, <Field (SM_Pairing_Request).responder_key_distribution>]
class scapy.layers.bluetooth.SM_Pairing_Response

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Pairing_Response'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Pairing_Response).iocap>, <Field (SM_Pairing_Response).oob>, <Field (SM_Pairing_Response).authentication>, <Field (SM_Pairing_Response).max_key_size>, <Field (SM_Pairing_Response).initiator_key_distribution>, <Field (SM_Pairing_Response).responder_key_distribution>]
class scapy.layers.bluetooth.SM_Public_Key

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Public_Key'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Public_Key).key_x>, <Field (SM_Public_Key).key_y>]
class scapy.layers.bluetooth.SM_Random

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Random'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Random).random>]
class scapy.layers.bluetooth.SM_Signing_Information

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth.SM_Signing_Information'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (SM_Signing_Information).csrk>]
class scapy.layers.bluetooth.XLEShortField(name, default)

Bases: scapy.fields.LEShortField

i2repr(pkt, x)

Convert internal value to a nice representation

class scapy.layers.bluetooth.sockaddr_hci

Bases: _ctypes.Structure

hci_channel

Structure/Union member

hci_dev

Structure/Union member

sin_family

Structure/Union member

scapy.layers.bluetooth.srbt(bt_address, pkts, inter=0.1, *args, **kargs)

send and receive using a bluetooth socket

scapy.layers.bluetooth.srbt1(bt_address, pkts, *args, **kargs)

send and receive 1 packet using a bluetooth socket