Script check login user SSH

 
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
View Mode
Views:

1088


Replies:6

Script check login user SSH

oke kali ini ane mau share script untuk yang jualan ssh, gunanya script ini untuk monitoring siapa yang login dan yang multilogin silahkan di ambil script dibawah ini

#!/bin/bash
# edited by Mbah Roni


data=( `ps aux | grep -i dropbear | awk '{print $2}'`);

echo "Dropbear yang Online";
echo "---";

for PID in "${data[@]}"
do
    #echo "check $PID";
    NUM=`cat /var/log/secure | grep -i dropbear | grep -i "Password auth succeeded" | grep "dropbear\[$PID\]" | wc -l`;
    USER=`cat /var/log/secure | grep -i dropbear | grep -i "Password auth succeeded" | grep "dropbear\[$PID\]" | awk '{print $10}'`;
    IP=`cat /var/log/secure | grep -i dropbear | grep -i "Password auth succeeded" | grep "dropbear\[$PID\]" | awk '{print $12}'`;
    if [ $NUM -eq 1 ]; then
        echo "$PID - $USER - $IP";
    fi
done
echo "---";

data=( `ps aux | grep "\[priv\]" | sort -k 72 | awk '{print $2}'`);

echo "OpenSSH yang Online";
echo "---";
for PID in "${data[@]}"
do
        #echo "check $PID";
        NUM=`cat /var/log/secure | grep -i sshd | grep -i "Accepted password for" | grep "sshd\[$PID\]" | wc -l`;
        USER=`cat /var/log/secure | grep -i sshd | grep -i "Accepted password for" | grep "sshd\[$PID\]" | awk '{print $9}'`;
        IP=`cat /var/log/secure | grep -i sshd | grep -i "Accepted password for" | grep "sshd\[$PID\]" | awk '{print $11}'`;
        if [ $NUM -eq 1 ]; then
                echo "$PID - $USER - $IP";
        fi
done



echo
echo
echo "Editing By : Mbah Roni"
cara gunakannya

Pertama login ke vps dengn user root, lalu ketikan perintah kayak gini

nano user-login.sh

lalu pastekan script tadi dan simpan dengan cara ctrl + x.
berikan chmod flle tersebut dengan cara

chmod +x user-login.sh

nah setelah itu jalankan scriptnya

./user-login.sh

license script ini free dan gak ada masa aktifnya, :big_smile2:
jika gak bisa gunakan silahkan coment Haha

RT: Script check login user SSH

Good share bro... informasinya bermanfaat

RT: Script check login user SSH

(11-04-2014 11:20 PM)zenixsnet Wrote: Good share bro... informasinya bermanfaat

oke man Keren

RT: Script check login user SSH

Nice share man, ijin ngarsipin. Siapa tau nanti kepake Ngupil

RT: Script check login user SSH

Berguna banget nih hahaha .... Nice share paman

RT: Script check login user SSH

CTRL + D dulu dah sapa tau bermanfaat.. Nice info man..

RT: Script check login user SSH

(18-04-2014 05:58 PM)Rhaditz Wrote: CTRL + D dulu dah sapa tau bermanfaat.. Nice info man..

Oh jelas bermanfaat donk paman Hehe
kampoeng