http://www.akadia.com/services/solaris_tips.html
#!/usr/bin/perl
$| = 1;
my $port = 80;
my $total = 0;
my $IP_LIMIT = 90;Â Â Â Â Â Â Â Â Â Â Â Â Â # upper limit of httpd connections
my $LOGF = “/tmp/ddos.log”;Â Â Â Â # file used to log ips
my $EMAIL = ‘root’;
my $DELAY = 60;
my $TIMEF = ‘/tmp/time_file’;
open FD, “+>>$LOGF” or die “$!”;
select FD;
open( CMD, “netstat -an|” );
while (<CMD>) {
chomp;
($proto, undef, undef, $local_addr, $remote_addr, undef) = split(/ +/, $_, 5);
($local_ip, $local_port) = split( /:/, $local_addr );
($remote_ip, $remote_port) = split( /:/, $remote_addr );
next if $remote_ip =~ /0.0.0.0/;
next if $remote_ip =~ /192.168.0.1/;Â Â Â #our ip
next …
#!/bin/bash
for ((Â n = 0 ;Â n <= 29;Â n++Â ))
do
netstat -plan|grep :80|awk {‘print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1
netstat -plan|grep :80|awk {‘print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1 | awk ‘{ if ( $1 > 35 ) print  $2
}’ > /tmp/blockedip
for i in `cat /tmp/blockedip`
do
printf ” \t\t\t\033[1;34m $i \033[0m \n \n";
CHECK_IF_LOCALIP=0;
/sbin/ifconfig | grep $i > /dev/null;
if [ $? -ne $CHECK_IF_LOCALIP ]
then
{
FLAG=0;
grep $i /etc/sysconfig/iptables | grep DROPÂ > /dev/null;
if [ $? -ne $FLAG ]
then
printf “\033[1;35m \t\tBLOCKING ALL CONNECTIONS …
Alternate apt-get mirrors.
add the following in the file /etc/apt/sources.list
# main sources
#
deb http://debian.intergenia.de/debian/ sarge main contrib non-free
#deb-src http://debian.intergenia.de/debian/ sarge main contrib non-free
# non-us
#
deb http://debian.intergenia.de/debian-non-US/ sarge/non-US main contrib non-free
#deb-src http://debian.intergenia.de/debian-non-US/ sarge/non-US main contrib non-free
# security
#
deb http://debian.intergenia.de/debian-security/ sarge/updates main contrib non-free
#deb-src http://debian.intergenia.de/debian-security/ sarge/updates main contrib non-free
# Plesk
#deb http://autoinstall.plesk.com/debian PSA_8.0.1/
# PHP5
#deb http://people.debian.org/~dexter php5 sarge
deb http://dotdeb.netmirror.org/ stable all
deb-src http://dotdeb.netmirror.org/ stable all