Skip to content

Instantly share code, notes, and snippets.

@sd65
Created September 4, 2017 12:18
Show Gist options
  • Save sd65/47f6ba4a8018118ffe6af692e283a13a to your computer and use it in GitHub Desktop.
Save sd65/47f6ba4a8018118ffe6af692e283a13a to your computer and use it in GitHub Desktop.
Prevent laptop grab theft
#!/bin/bash
DEVICE="$1"
SCAN_DELAY=10
trap ctrl_c INT
function ctrl_c() {
echo "Shutting down..."
exit 0
}
[[ -z "$DEVICE" ]] && echo "Please provide an BT MAC as first argument." && exit 1
echo "Starting..."
while sudo hcitool info $DEVICE >/dev/null 2>&1; do
echo "[OK] REACHABLE"
sleep $SCAN_DELAY
done
echo "[ERROR] Device $DEVICE is not reachable ! Locking screen."
cinnamon-screensaver-command -l -m "Potential theft detected"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment