Skip to content

Instantly share code, notes, and snippets.

@bamthomas
Last active January 15, 2024 08:22
Show Gist options
  • Save bamthomas/1d3a5a9a575a2f9c821cd85813bc710d to your computer and use it in GitHub Desktop.
Save bamthomas/1d3a5a9a575a2f9c821cd85813bc710d to your computer and use it in GitHub Desktop.
nb connected users on wifi lighthttpd
#!/bin/sh
echo "<h1>Utilisateurs connectes</h1>"
set -x
total=0
for interface in $(iwinfo |grep "ESSID:" | cut -d' ' -f1); do
nb_interface_users=$(iwinfo $interface assoclist | grep dBm | wc -l)
total=$((total + nb_interface_users))
done
echo "il y a $total utilisateurs connectes"
echo "<h2>Details</h2>"
echo "<pre>"
for interface in $(iwinfo |grep "ESSID:" | cut -d' ' -f1); do
echo $'\n'
echo -n "Interface $interface : "
iwinfo $interface assoclist | xargs |sed 's/..:..:..:..:..:../\n&/g'
done
echo "</pre>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment