scapy
scapy copied to clipboard
Invalid argument when sending Bluetooth packets through srbt()
Hi, I'm trying to send a Bluetooth packet to a known mac address, I tried the function srbt(), as the code below:
pkts=HCI_Hdr(type=2)/HCI_ACL_Hdr(handle=0x040, PB=0, BC=0)/L2CAP_Hdr(cid=0x0004)/
ATT_Hdr(opcode=0x52)/ATT_Write_Command(gatt_handle=0x000d,data=bytes(data.buf))
srbt('e8:32:2a:d2:a8:79', pkts, inter=0.1)
But it always has this bug:
Traceback (most recent call last):
File "get.py", line 48, in <module>
srbt('e8:32:2a:d2:a8:79', pkts, inter=0.1)
File "/usr/local/lib/python3.7/dist-packages/scapy/layers/bluetooth.py", line 1580, in srbt
s = conf.BTsocket(bt_address=bt_address)
File "/usr/local/lib/python3.7/dist-packages/scapy/layers/bluetooth.py", line 1451, in __init__
s.connect((bt_address, port))
OSError: [Errno 22] Invalid argument
How can I solve this problem? Or is there another way to send Bluetooth packets to a known mac address? Thank you very much!
Hi! :) Please provide additional information, such as:
- OS type (Windows/Linux/MacOS)
- Are you using admin privileges to run scapy with
./run_scapy?