-
Notifications
You must be signed in to change notification settings - Fork 1
/
BLUFFS.py
30 lines (25 loc) · 1.14 KB
/
BLUFFS.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
# $t@$h
# Doesn't modify your system. Just notifies you of new BLE connections
# Keep this running, remediate yourself, and follow these suggestions:
# Update firmware on BLE devices
# Only pair with trusted devices and use secure networks
# Use secure-connections-only mode when possible. Avoid legacy
# Turn bluetooth OFF when not in use. Should do this with everything really
import bluetooth
import time
from plyer import notification # Research says this is platform-independent so can run this script on any OS
def scan_for_devices(scan_duration=8, sleep_duration=10):
known_devices = {}
while True:
nearby_devices = bluetooth.discover_devices(duration=scan_duration, lookup_names=True, flush_cache=True)
for addr, name in nearby_devices:
if addr not in known_devices:
known_devices[addr] = name
notification.notify(
title='!!!New Bluetooth Device Detected',
message=f'Device: {name} ({addr})',
app_name='BLE Scan'
)
time.sleep(sleep_duration)
if __name__ == "__main__":
scan_for_devices()