-
Notifications
You must be signed in to change notification settings - Fork 3
/
dropbear
47 lines (38 loc) · 1.63 KB
/
dropbear
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#
# Dropbear & OpenSSH
# ========================
#
data=( `ps aux | grep -i dropbear | awk '{print $2}'`);
echo "=============================================="
echo "Usuarios [Dropbear]";
echo "[x]";
for PID in "${data[@]}"
do
#echo "check $PID";
NUM1=`cat /var/log/auth.log | grep -i dropbear | grep -i "Password auth succeeded" | grep "dropbear\[$PID\]" | wc -l`;
USER=`cat /var/log/auth.log | grep -i dropbear | grep -i "Password auth succeeded" | grep "dropbear\[$PID\]" | awk '{print $10}'`;
IP=`cat /var/log/auth.log | grep -i dropbear | grep -i "Password auth succeeded" | grep "dropbear\[$PID\]" | awk '{print $12}'`;
if [ $NUM1 -eq 1 ]; then
echo "[PID] $PID - [Usuario]: $USER";
echo "[TOTAL en Dropbear]: $NUM1";
fi
done
echo "---";
data=( `ps aux | grep "\[priv\]" | sort -k 72 | awk '{print $2}'`);
echo "Usuarios [OpenSSH]";
echo "[x]";
for PID in "${data[@]}"
do
#echo "check $PID";
NUM2=`cat /var/log/auth.log | grep -i sshd | grep -i "Accepted password for" | grep "sshd\[$PID\]" | wc -l`;
USER=`cat /var/log/auth.log | grep -i sshd | grep -i "Accepted password for" | grep "sshd\[$PID\]" | awk '{print $9}'`;
IP=`cat /var/log/auth.log | grep -i sshd | grep -i "Accepted password for" | grep "sshd\[$PID\]" | awk '{print $11}'`;
if [ $NUM2 -eq 1 ]; then
echo "[PID] $PID - [Usuario]: $USER";
echo "[TOTAL en OpenSSH]: $NUM2";
fi
done
echo "=============================================="
echo "VPSPack @PowerMX";
echo "=============================================="