#!/usr/local/bin/php -q ","",$grey_lower); $grey_split = split("\|", $grey_lower); $email_from = strtolower($grey_split[2]); $email_to = strtolower($grey_split[3]); $server_ip = strtolower($grey_split[1]); if(in_array($server_ip, $current_blacklist)) { if($debug) echo "$server_ip already in blacklist.\n"; continue; } if(in_array($email_to, $current_spamtrap)) { if($email_to) echo "$email_to already in blacklist.\n"; continue; } if($debug) echo "Testing $email_from | $email_to \n"; if (in_array($email_to, $valid_list)) { if($debug) echo "$email_to is in the valid list\n"; } else { /* spammer picked the wrong person to mess with */ if($server_ip) { if($debug) echo "/usr/local/sbin/spamdb -a $server_ip -t\n"; exec("/usr/local/sbin/spamdb -d {$server_ip} 2>/dev/null"); exec("/usr/local/sbin/spamdb -d {$server_ip} -T 2>/dev/null"); exec("/usr/local/sbin/spamdb -d {$server_ip} -t 2>/dev/null"); if($debug) echo "/usr/local/sbin/spamdb -a \"<$email_to>\" -T\n"; exec("/usr/local/sbin/spamdb -a \"<$email_to>\" -T"); config_lock(); system("echo $server_ip >> /var/db/blacklist.txt"); config_unlock(); $result = mwexec("/usr/local/sbin/spamdb -a $server_ip -t"); } else { if($debug) echo "Could not locate server ip address."; } if($debug) echo "Script result code: {$result}\n"; } } mwexec("killall -HUP spamlogd"); if($debug) { echo "\nSearch completed.\n\n"; echo "Items trapped: "; system("/usr/local/sbin/spamdb | grep TRAPPED | wc -l"); echo "Items spamtrapped: "; system("/usr/local/sbin/spamdb | grep SPAMTRAP | wc -l"); } mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); mwexec("/sbin/pfctl -t blacklist -T show | cut -d\" \" -f4 > /var/db/blacklist.txt"); if($debug) { echo "Items in blacklist.txt: "; system("/sbin/pfctl -t blacklist -T show | wc -l"); } ?>