diff --git a/scripts/wireguard/clientSTAT.sh b/scripts/wireguard/clientSTAT.sh index 166085f..ae07a72 100755 --- a/scripts/wireguard/clientSTAT.sh +++ b/scripts/wireguard/clientSTAT.sh @@ -2,6 +2,7 @@ # PiVPN: client status script CLIENTS_FILE="/etc/wireguard/configs/clients.txt" +CONF_FILE="/etc/wireguard/wg0.conf" if [ ! -s "$CLIENTS_FILE" ]; then echo "::: There are no clients to list" @@ -44,7 +45,6 @@ listClients(){ BYTES_SENT="$(awk '{ print $7 }' <<< "$LINE")" LAST_SEEN="$(awk '{ print $5 }' <<< "$LINE")" CLIENT_NAME="$(grep "$PUBLIC_KEY" "$CLIENTS_FILE" | awk '{ print $1 }')" - if [ "$HR" = 1 ]; then if [ "$LAST_SEEN" -ne 0 ]; then printf "%s \t %s \t %s \t %s \t %s \t %s\n" "$CLIENT_NAME" "$REMOTE_IP" "${VIRTUAL_IP/\/32/}" "$(hr "$BYTES_RECEIVED")" "$(hr "$BYTES_SENT")" "$(date -d @"$LAST_SEEN" '+%b %d %Y - %T')" @@ -63,6 +63,11 @@ listClients(){ printf "\n" } | column -t -s $'\t' + + cd /etc/wireguard || return + echo "::: Disabled clients :::" + grep '\[disabled\] ### begin' wg0.conf | sed 's/#//g; s/begin//' + } if [[ $# -eq 0 ]]; then