2023-01-18 09:22:40 +01:00

27 lines
712 B
Bash

#!/bin/bash
requirements=1
# check for the requirements first
if ! command -v nmcli &> /dev/null
then
echo "- nmcli is missing: please make sure you have NetworkManager installed"
requirements=0
fi
if ! command -v xxhsum &> /dev/null
then
echo "- xxhsum is missing: please install xxhash OR change the code to use another hashing algo (crc32?)"
requirements=0
fi
if [ $requirements -ne 1 ]
then
echo "\nPlease install the missing packages."
exit
fi
salt=$(cat /etc/machine-id)$(whoami) && for a in $(nmcli -f BSSID,SIGNAL device wifi list --rescan yes | awk -v s=$salt '{print $1 s "\n" $2 s}'); do xxhsum -H0 <(echo $a); done | cut -d ' ' -f 1 | tail -n +2 | head -n 10 | xargs echo | sed 's/ //g'