workan on py
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from bleak import BleakScanner, BleakError
|
from bleak import BleakScanner, BleakError
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
# bunch of random prefixes for testing
|
# bunch of random prefixes for testing
|
||||||
## VENDOR_PREFIXES = ['00:25:DF', '00:58:28', '00:C0:D4', '84:70:03', 'C0:1C:6A', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0B', '77', '99', '0A', '0B', '0C', '0D', '0E', '0F', 'AB', 'C0']
|
## VENDOR_PREFIXES = ['00:25:DF', '00:58:28', '00:C0:D4', '84:70:03', 'C0:1C:6A', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0B', '77', '99', '0A', '0B', '0C', '0D', '0E', '0F', 'AB', 'C0']
|
||||||
@@ -8,18 +9,16 @@ VENDOR_PREFIXES = ['00:25:DF', '00:58:28', '00:C0:D4', '84:70:03']
|
|||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
print("Scanning for BLE devices...")
|
print("Scanning for BLE devices...")
|
||||||
try:
|
while True:
|
||||||
devices = await BleakScanner.discover()
|
try:
|
||||||
print(f"Found {len(devices)} devices:")
|
await devices = await BleakScanner.discover()
|
||||||
filtered_devices = [device for device in devices if any(device.address.upper().startswith(prefix) for prefix in VENDOR_PREFIXES)]
|
filtered_devices = [device for device in devices if any(device.address.upper().startswith(prefix) for prefix in VENDOR_PREFIXES)]
|
||||||
if filtered_devices:
|
if filtered_devices:
|
||||||
for device in filtered_devices:
|
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3] # includes miliseconds
|
||||||
print(f"MAC Address: {device.address}, Name: {device.name}")
|
print(f"VLAT HAS BEEN SPOTTED MAC: {filtered_devices[0].address} TIME: {now}")
|
||||||
else:
|
except BleakError as e:
|
||||||
print("No devices found with the specified vendor prefixes.")
|
print(f"Error during scanning: {e}")
|
||||||
except BleakError as e:
|
await asyncio.sleep(10) # wait before next scan
|
||||||
print(f"Error: {e}")
|
filtered_devices = [device for device in devices if any(device.address.upper().startswith(prefix) for prefix in VENDOR_PREFIXES)]
|
||||||
print("Make sure Bluetooth is enabled and a Bluetooth adapter is present.")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__": asyncio.run(main())
|
||||||
asyncio.run(main())
|
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
scapy
|
|
||||||
requests
|
requests
|
||||||
bleak
|
bleak
|
||||||
Reference in New Issue
Block a user