"; $host = @gethostbyaddr($_SERVER["REMOTE_ADDR"]); //echo $host."
"; $dontblock = array('dc.cox.net','hr.cox.net','googlebot.com','search.msn.com','yahoo.com','planetmike.com','1e100.net','64.34.168.169','fios.verizon.net'); $shouldiblock="yes"; foreach ($dontblock as $value) { // echo "Value: $value
\n"; if (stripos($host,$value)) { // echo "yes
\n"; $shouldiblock="no"; } else { // echo "no
\n"; } } //echo "Would I block this ip address? ".$shouldiblock; if ($shouldiblock == "yes") { //firewall the ip //echo "firewall it."; //should be port 80 $file = $_SERVER["SCRIPT_NAME"]; //echo $file; //echo "
"; $break = Explode('/', $file); $pfile = $break[count($break) - 1]; $blocktheip = 'sudo /sbin/iptables -I INPUT --source '.$ip.'/32 -p tcp --dport 80 -j DROP -m comment --comment "`date +%Y-%m-%d` web-automatic '.$pfile.'"'; //echo $blocktheip."
\n"; $output = shell_exec($blocktheip); echo $output."
\n"; #$cfblock = "curl --insecure -o ~/cloudflare.txt -d a=ban -d key=$ip -d u=cloudflare.com@planetmike.com -d tkn=2620f841568206aedde593b351eb1e00c28e6 https://www.cloudflare.com/api_json.html"; #echo $cfblock; # $output = shell_exec($cfblock); # echo $output."
\n"; echo "Ummm?"; } else { echo "
\n"; echo "
\n"; echo "What?"; } ?>