scapy.layers.bluetooth4LE module

Bluetooth 4LE layer

class scapy.layers.bluetooth4LE.BDAddrField(name, default, resolve=False)

Bases: scapy.fields.MACField

i2m(pkt, x)

Convert internal value to machine value

m2i(pkt, x)

Convert machine value to internal value

class scapy.layers.bluetooth4LE.BTLE

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE'>, <class 'scapy.packet.Packet'>]
static compute_crc(pdu, init=5592405)
fields_desc = [<Field (BTLE).access_addr>, <Field (BTLE).crc>]
hashret()

DEV: returns a string that has the same value for a request and its answer.

payload_guess = [({'access_addr': 2391391958}, <class 'scapy.layers.bluetooth4LE.BTLE_ADV'>), ({}, <class 'scapy.layers.bluetooth4LE.BTLE_DATA'>)]
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.bluetooth4LE.BTLEChanMapField(name, default)

Bases: scapy.fields.XByteField

addfield(pkt, s, val)

Add an internal value to a string

Copy the network representation of field val (belonging to layer pkt) to the raw string packet s, and return the new string packet.

getfield(pkt, s)

Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal representation.

class scapy.layers.bluetooth4LE.BTLE_ADV

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_ADV'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_ADV).RxAdd>, <Field (BTLE_ADV).TxAdd>, <Field (BTLE_ADV).RFU>, <Field (BTLE_ADV).PDU_type>, <Field (BTLE_ADV).unused>, <Field (BTLE_ADV).Length>]
payload_guess = [({'PDU_type': 0}, <class 'scapy.layers.bluetooth4LE.BTLE_ADV_IND'>), ({'PDU_type': 1}, <class 'scapy.layers.bluetooth4LE.BTLE_ADV_DIRECT_IND'>), ({'PDU_type': 2}, <class 'scapy.layers.bluetooth4LE.BTLE_ADV_NONCONN_IND'>), ({'PDU_type': 3}, <class 'scapy.layers.bluetooth4LE.BTLE_SCAN_REQ'>), ({'PDU_type': 4}, <class 'scapy.layers.bluetooth4LE.BTLE_SCAN_RSP'>), ({'PDU_type': 5}, <class 'scapy.layers.bluetooth4LE.BTLE_CONNECT_REQ'>), ({'PDU_type': 6}, <class 'scapy.layers.bluetooth4LE.BTLE_ADV_SCAN_IND'>)]
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.bluetooth4LE.BTLE_ADV_DIRECT_IND

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_ADV_DIRECT_IND'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_ADV_DIRECT_IND).AdvA>, <Field (BTLE_ADV_DIRECT_IND).InitA>]
class scapy.layers.bluetooth4LE.BTLE_ADV_IND

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_ADV_IND'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_ADV_IND,BTLE_ADV_NONCONN_IND,BTLE_ADV_SCAN_IND).AdvA>, <Field (BTLE_ADV_IND,BTLE_ADV_NONCONN_IND,BTLE_ADV_SCAN_IND).data>]
class scapy.layers.bluetooth4LE.BTLE_ADV_NONCONN_IND

Bases: scapy.layers.bluetooth4LE.BTLE_ADV_IND

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_ADV_NONCONN_IND'>, <class 'scapy.layers.bluetooth4LE.BTLE_ADV_IND'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_ADV_IND,BTLE_ADV_NONCONN_IND,BTLE_ADV_SCAN_IND).AdvA>, <Field (BTLE_ADV_IND,BTLE_ADV_NONCONN_IND,BTLE_ADV_SCAN_IND).data>]
class scapy.layers.bluetooth4LE.BTLE_ADV_SCAN_IND

Bases: scapy.layers.bluetooth4LE.BTLE_ADV_IND

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_ADV_SCAN_IND'>, <class 'scapy.layers.bluetooth4LE.BTLE_ADV_IND'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_ADV_IND,BTLE_ADV_NONCONN_IND,BTLE_ADV_SCAN_IND).AdvA>, <Field (BTLE_ADV_IND,BTLE_ADV_NONCONN_IND,BTLE_ADV_SCAN_IND).data>]
class scapy.layers.bluetooth4LE.BTLE_CONNECT_REQ

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_CONNECT_REQ'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_CONNECT_REQ).InitA>, <Field (BTLE_CONNECT_REQ).AdvA>, <Field (BTLE_CONNECT_REQ).AA>, <Field (BTLE_CONNECT_REQ).crc_init>, <Field (BTLE_CONNECT_REQ).win_size>, <Field (BTLE_CONNECT_REQ).win_offset>, <Field (BTLE_CONNECT_REQ).interval>, <Field (BTLE_CONNECT_REQ).latency>, <Field (BTLE_CONNECT_REQ).timeout>, <Field (BTLE_CONNECT_REQ).chM>, <Field (BTLE_CONNECT_REQ).SCA>, <Field (BTLE_CONNECT_REQ).hop>]
class scapy.layers.bluetooth4LE.BTLE_DATA

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_DATA'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_DATA).RFU>, <Field (BTLE_DATA).MD>, <Field (BTLE_DATA).SN>, <Field (BTLE_DATA).NESN>, <Field (BTLE_DATA).LLID>, <Field (BTLE_DATA).len>]
payload_guess = [({'LLID': 2}, <class 'scapy.layers.bluetooth.L2CAP_Hdr'>), ({'LLID': 3}, <class 'scapy.layers.bluetooth4LE.CtrlPDU'>)]
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.bluetooth4LE.BTLE_PPI

Bases: scapy.layers.ppi.PPI_Element

Cooked BTLE PPI header

See ppi_btle_t in https://github.com/greatscottgadgets/libbtbb/blob/master/lib/src/pcap.c

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_PPI'>, <class 'scapy.layers.ppi.PPI_Element'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_PPI).btle_version>, <Field (BTLE_PPI).btle_channel>, <Field (BTLE_PPI).btle_clkn_high>, <Field (BTLE_PPI).btle_clk_100ns>, <Field (BTLE_PPI).rssi_max>, <Field (BTLE_PPI).rssi_min>, <Field (BTLE_PPI).rssi_avg>, <Field (BTLE_PPI).rssi_count>]
class scapy.layers.bluetooth4LE.BTLE_RF

Bases: scapy.packet.Packet

Cooked BTLE link-layer pseudoheader.

http://www.whiterocker.com/bt/LINKTYPE_BLUETOOTH_LE_LL_WITH_PHDR.html

aliastypes = [<class 'scapy.layers.bluetooth4LE.BTLE_RF'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (BTLE_RF).rf_channel>, <Field (BTLE_RF).signal>, <Field (BTLE_RF).noise>, <Field (BTLE_RF).access_address_offenses>, <Field (BTLE_RF).reference_access_address>, <Field (BTLE_RF).flags>]
payload_guess = [({}, <class 'scapy.layers.bluetooth4LE.BTLE'>)]
class scapy.layers.bluetooth4LE.BTLE_SCAN_REQ

Bases: scapy.packet.Packet

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

DEV: true if self is an answer from other

fields_desc = [<Field (BTLE_SCAN_REQ).ScanA>, <Field (BTLE_SCAN_REQ).AdvA>]
class scapy.layers.bluetooth4LE.BTLE_SCAN_RSP

Bases: scapy.packet.Packet

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

DEV: true if self is an answer from other

fields_desc = [<Field (BTLE_SCAN_RSP).AdvA>, <Field (BTLE_SCAN_RSP).data>]
class scapy.layers.bluetooth4LE.CtrlPDU

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.layers.bluetooth4LE.CtrlPDU'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (CtrlPDU).optcode>, <Field (CtrlPDU).version>, <Field (CtrlPDU).Company>, <Field (CtrlPDU).subversion>]