1
0
mirror of https://github.com/AAAAAEXQOSyIpN2JZ0ehUQ/SSHPLUS-MANAGER-FREE.git synced 2024-11-27 06:09:04 +00:00
SSHPLUS-MANAGER-FREE/Modulos/limiter
AAAAAEXQOSyIpN2JZ0ehUQ 0c6a834d35 Update Script
2020-12-29 21:32:39 -03:00

40 lines
1.1 KiB
Bash

#!/bin/bash
#====================================================
# SCRIPT: LIMITER SSHPLUS MANAGER
# DESENVOLVIDO POR: CRAZY_VPN
# CONTATO TELEGRAM: http://t.me/crazy_vpn
# CANAL TELEGRAM: http://t.me/sshplus
#====================================================
clear
database="/root/usuarios.db"
fun_multilogin() {
(
while read user; do
[[ $(grep -wc "$user" $database) != '0' ]] && limit="$(grep -w $user $database | cut -d' ' -f2)" || limit='1'
conssh="$(ps -u $user | grep sshd | wc -l)"
[[ "$conssh" -gt "$limit" ]] && {
pkill -u $user
}
[[ -e /etc/openvpn/openvpn-status.log ]] && {
ovp="$(grep -E ,"$user", /etc/openvpn/openvpn-status.log | wc -l)"
[[ "$ovp" -gt "$limit" ]] && {
pidokill=$(($limit - $ovp))
listpid=$(grep -E ,"$user", /etc/openvpn/openvpn-status.log | cut -d "," -f3 | head -n $pidokill)
while read ovpids; do
(
telnet localhost 7505 <<-EOF
kill $ovpids
EOF
) &>/dev/null &
done <<<"$listpid"
}
}
done <<<"$(awk -F: '$3 >= 1000 {print $1}' /etc/passwd)"
) &
}
while true; do
echo 'verificando...'
fun_multilogin > /dev/null 2>&1
sleep 15s
done