diff --git a/scapy/layers/bluetooth.py b/scapy/layers/bluetooth.py index c608181423f6502864c202dbe30fad714007b10c..56310becd8deedfeca0ed79a2e31810a2ded330b 100644 --- a/scapy/layers/bluetooth.py +++ b/scapy/layers/bluetooth.py @@ -464,6 +464,11 @@ class HCI_Cmd_LE_Set_Scan_Enable(Packet): fields_desc = [ ByteField("enable", 1), ByteField("filter_dups", 1), ] +class HCI_Cmd_Disconnect(Packet): + name = "Disconnect" + fields_desc = [ XLEShortField("handle", 0), + ByteField("reason", 0x13), ] + class HCI_Cmd_LE_Create_Connection(Packet): name = "LE Create Connection" fields_desc = [ LEShortField("interval", 96), @@ -613,6 +618,7 @@ bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Advertising_Data, opcode=0x2008) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Advertise_Enable, opcode=0x200a) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Scan_Parameters, opcode=0x200b) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Scan_Enable, opcode=0x200c) +bind_layers( HCI_Command_Hdr, HCI_Cmd_Disconnect, opcode=0x406) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Create_Connection, opcode=0x200d) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Create_Connection_Cancel, opcode=0x200e) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Long_Term_Key_Request_Reply, opcode=0x201a) diff --git a/test/bluetooth.uts b/test/bluetooth.uts index 0f3e8c02562e18a33042dd3d07ecb7fd85f2e468..65c46449e99fa1260a870eeaeb8ff4b95c9b8cc9 100644 --- a/test/bluetooth.uts +++ b/test/bluetooth.uts @@ -7,6 +7,11 @@ expected_cmd_raw_data = "010e2000".decode('hex') cmd_raw_data = str(HCI_Hdr() / HCI_Command_Hdr() / HCI_Cmd_LE_Create_Connection_Cancel()) assert(expected_cmd_raw_data == cmd_raw_data) += Disconnect +expected_cmd_raw_data = "01060403341213".decode('hex') +cmd_raw_data = str(HCI_Hdr() / HCI_Command_Hdr() / HCI_Cmd_Disconnect(handle=0x1234)) +assert(expected_cmd_raw_data == cmd_raw_data) + + Bluetooth LE Advertising / Scan Response Data Parsing = Parse EIR_Flags, EIR_CompleteList16BitServiceUUIDs, EIR_CompleteLocalName and EIR_TX_Power_Level