<?php
$ip=escapeshellcmd( $_SERVER['REMOTE_ADDR'] );

if ( preg_match('/([0-9]{1,3}\\.){3,3}[0-9]{1,3}/', $ip) ) {
	if ( preg_match('/172\.19\.3\./', $ip)) {
		echo "try again";
		exit();
	}

	$target=$_SERVER['DOCUMENT_ROOT']."/scripts/htaccess";
	//Only want to do this once
	if ($input = file_get_contents($target)) {
		if ( preg_match('/Deny From '.$ip.'$/m',$input,$out) == 0 ) {
			file_put_contents( $target, "Deny From ".$ip."\n" , FILE_APPEND );
		}
	}

	$date=date('Y-m-d H:i:s');
	$request=$_SERVER["REQUEST_URI"];
	mail('bolo@bolobot.com','Got a bad bot ',$date.'	'.$request.'\r\n','From:phphackattempt@bolobot.com'); 
}
?>
