- 2 Mar 2012
- 151
- 0
Merhaba Arkadaşlar İşte konumuz;
Çalıştırmak için istediğiniz bir isimde kaydedin ardından chmod +x isim komutunu girin ./isim yazdığınızda çalıştıracaktır
İi Forumlar..
TurkojaN SaygıLar..
Kod:
#!/bin/bash
#TurkHackTeam
##### Basit Ayarlar
PORT=22
LIMIT=150
LOCAL_IP_KONTROL=1
CRON="/etc/cron.d/d4.cron"
ARALIK=1
#### end
cron_ekle()
{
rm -f $CRON
sleep 1
service crond restart
sleep 1
echo "SHELL=/bin/sh" > $CRON
if [ $ARALIK -le 2 ]; then
echo "*/$ARALIK * * * * root /root/d4.sh >/dev/null 2>&1" >> $CRON
else
print "Bir hata olustu"
fi
service crond restart
}
head()
{
echo "Hicbir Hakki Sakli degildir"
echo "istedigin degisikligi yapabilirsin haci"
echo "TurkishAjan"
echo
}
yardim()
{
head
echo 'Kullanim : d4.sh [ayarlar]'
echo 'Ayarlar:'
echo '-c veya --cron : Scriptin duzenli calismasi icin cron olusturur'
echo '-h veya --yardim : Bu ekranı gösterir'
}
while [ $1 ]; do
case $1 in
'--cron' | '-c' )
cron_ekle
exit
;;
'-h' | '--yardim' )
yardim
exit
;;
* )
yardim
exit
;;
esac
shift
done
netstat -plan|grep :$PORT|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1 > /root/iplistesi
for ip in `cat /root/iplistesi |awk '{print $2}'`;do
if [ `grep $ip /root/iplistesi | awk '{print $1}'` -gt $LIMIT ]
then
echo "150 baglanti gelen ip $ip... `grep $ip /root/iplistesi | awk '{print $1}'` baglanti yapiyor s.refsiz... engelleniyor $ip";
#Cok baglanti yapan ip engelleniyor
/etc/rc.d/init.d/iptables save > /dev/null;
/sbin/ifconfig | grep $ip > /dev/null;
if [ $? -ne $LOCAL_IP_KONTROL ]
then
{
FLAG=0;
grep $ip /etc/sysconfig/iptables | grep DROP > /dev/null;
if [ $? -ne $FLAG ]
then
iptables -I INPUT -s $ip -j DROP;
else
echo " Su numarali ip adresi $ip zaten engellenmis ";
fi
}
else
echo " HATA, Su ip $ip local bir adres. Ayarlarinizi kontrol edin ";
fi
fi
done
İi Forumlar..
TurkojaN SaygıLar..