A Windows background security system that locks the workstation when a configured Bluetooth device moves out of range.
A Python BLE scanner reads the target device RSSI and streams it to a TypeScript Node.js engine. The engine averages signal strength, watches for a pause lockfile, and calls Windows LockWorkStation when the device goes too far away.
- Hardware Sensor: Python 3 +
bleak - Orchestrator: Node.js + TypeScript
- OS Integration: Windows lock via
rundll32.exe user32.dll,LockWorkStation - Startup / management:
run.bat,silent.vbs,toggle.bat,kill.bat
- Windows 11 with Bluetooth support.
- Node.js 16+ installed and on
PATH. - Python 3.10+ installed and on
PATH. - A BLE advertiser app such as nRF Connect on Android.
In src/stream_rssi.py, set TARGET_NAME to the target broadcast name:
TARGET_NAME = "Forgata"In nRF Connect Advertiser, include:
- device name
- TX power level
- a complete local name record
Make sure the phone advertises a name that matches TARGET_NAME.
pip install bleak
npm installnpm run buildOpen src/main.ts and update these values as needed:
const LOCK_THRESHOLD = -75;
const WINDOW_SIZE = 5;LOCK_THRESHOLD is the rolling average RSSI threshold that triggers the lock.
WINDOW_SIZE controls how many recent readings are averaged.
node dist/main.jsThe engine will spawn python src/stream_rssi.py, read RSSI values, print live and smoothed signal output, and lock Windows when the average crosses the threshold.
To run silently at boot:
- Press
Win + R, entershell:startup, and press Enter. - Create a shortcut to
silent.vbsin the Startup folder.
silent.vbs launches run.bat hidden.
run.bat starts the built engine from dist/main.js.
toggle.bat— togglespaused.lock. While paused, signal tracking continues but locking is bypassed.kill.bat— readsapp.pid, terminates the specific Node process, and removesapp.pidandpaused.lock.
app.pidis written to the repo root bysrc/main.ts.- The engine expects
pythonto be callable from the system path. - If you want to verify scanning separately, run:
python src/stream_rssi.py