","",$srcip); $srcip = str_replace(" ","",$srcip); /* execute spamdb command */ if($action == "whitelist") { exec("/usr/local/sbin/spamdb -d {$srcip}"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -T"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -t"); delete_from_blacklist($srcip); mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); exec("echo spamdb -a {$srcip} > /tmp/tmp"); exec("/usr/local/sbin/spamdb -a {$srcip}"); } else if($action == "delete") { exec("/usr/local/sbin/spamdb -d {$srcip}"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -T"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -t"); delete_from_blacklist($srcip); mwexec("/sbin/pfctl -q -t spamd -T delete $srcip"); mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); } else if($action == "spamtrap") { exec("/usr/local/sbin/spamdb -d {$srcip}"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -T"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -t"); exec("/usr/local/sbin/spamdb -a {$srcip} -T"); } else if($action == "trapped") { exec("/usr/local/sbin/spamdb -d {$srcip}"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -T"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -t"); exec("/usr/local/sbin/spamdb -a {$srcip} -t"); mwexec("/sbin/pfctl -q -t spamd -T add -f /var/db/blacklist.txt"); mwexec("/sbin/pfctl -q -t blacklist -T add -f /var/db/blacklist.txt"); } /* signal a reload for real time effect. */ mwexec("killall -HUP spamlogd"); exit; } /* spam trap e-mail address */ if($_POST['spamtrapemail'] <> "") { mwexec("/usr/local/sbin/spamdb -T -a \"<{$_POST['spamtrapemail']}>\""); mwexec("killall -HUP spamlogd"); $savemsg = $_POST['spamtrapemail'] . " added to spam trap database."; } if($_GET['getstatus'] <> "") { $status = exec("/usr/local/sbin/spamdb | grep \"{$_GET['getstatus']}\""); if(stristr($status, "WHITE") == true) { echo "WHITE"; } else if(stristr($status, "TRAPPED") == true) { echo "TRAPPED"; } else if(stristr($status, "GREY") == true) { echo "GREY"; } else if(stristr($status, "SPAMTRAP") == true) { echo "SPAMTRAP"; } else { echo "NOT FOUND"; } exit; } /* spam trap e-mail address */ if($_GET['spamtrapemail'] <> "") { $status = exec("spamdb -T -a \"<{$_GET['spamtrapemail']}>\""); mwexec("killall -HUP spamlogd"); if($status) echo $status; else echo $_POST['spamtrapemail'] . " added to spam trap database."; exit; } /* spam trap e-mail address */ if($_GET['whitelist'] <> "") { $status = exec("spamdb -a \"<{$_GET['spamtrapemail']}>\""); mwexec("killall -HUP spamlogd"); if($status) echo $status; else echo $_POST['spamtrapemail'] . " added to whitelist database."; exit; } function delete_from_blacklist($srcip) { config_lock(); $blacklist = split("\n", file_get_contents("/var/db/blacklist.txt")); $fd = fopen("/var/db/blacklist.txt", "w"); foreach($blacklist as $bl) { if($bl <> "") if(!stristr($bl, $srcip)) fwrite($fd, "{$bl}\n"); } fclose($fd); mwexec("/sbin/pfctl -q -t spamd -T delete $srcip"); mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); config_unlock(); } $pgtitle = "SpamD: Database"; include("head.inc"); ?>
=$pgtitle?>