$ip = $_SERVER['REMOTE_ADDR']; $ua = $_SERVER['HTTP_USER_AGENT']; if ($ip =="10.10.10.101"){ #ini_set('display_errors', 1); #ini_set('display_startup_errors', 1); #error_reporting(E_ALL); } $actual_link = $_SERVER['PHP_SELF']; $list = file("/var/wwwroot/westnet.ca/bannedipan.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); #if (preg_match('/bot|semrush|riddler|qwant|curl|dataprovider|riddler|daum|get|spider|find|java|majesticsEO|teoma|contaxe|yandex|libwww-perl|abacho|accona|AddThis|AdsBot|ahoy|AhrefsBot|AISearchBot|alexa|altavista|anthill|appie|applebot|arale|araneo|AraybOt|ariadne|arks|aspseek|ATN_Worldwide|Atomz|baiduspider|baidu|bbot|bingbot|bing|Bjaaland|BlackWidow|BotLink|bot|boxseabot|bspider|calif|CCBot|ChinaClaw|christcrawler|CMC\/0\.01|combine|confuzzledbot|contaxe|CoolBot|cosmos|crawler|crawlpaper|crawl|curl|cusco|cyberspyder|cydralspider|dataprovider|digger|DIIbot|DotBot|downloadexpress|DragonBot|DuckDuckBot|dwcp|EasouSpider|ebiness|ecollector|elfinbot|esculapio|ESI|esther|eStyle|Ezooms|facebookexternalhit|facebook|facebot|fastcrawler|FatBot|FDSE|FELIX IDE|fetch|fido|find|Firefly|fouineur|Freecrawl|froogle|gammaSpider|gazz|gcreep|geona|Getterrobo-Plus|get|girafabot|golem|grabber|GrabNet|griffon|Gromit|gulliver|gulper|hambot|havIndex|hotwired|htdig|HTTrack|ia_archiver|iajabot|IDBot|Informant|InfoSeek|InfoSpiders|INGRID\/0\.1|inktomi|inspectorwww|Internet Cruiser Robot|irobot|Iron33|JBot|jcrawler|Jeeves|jobo|KDD\-Explorer|KIT\-Fireball|ko_yappo_robot|label\-grabber|larbin|legs|libwww-perl|linkedin|Linkidator|linkwalker|Lockon|logo_gif_crawler|Lycos|m2e|majesticsEO|marvin|mattie|mediafox|mediapartners|MerzScope|MindCrawler|MJ12bot|mod_pagespeed|moget|Motor|msnbot|muncher|muninn|MuscatFerret|MwdSearch|NationalDirectory|naverbot|NEC\-MeshExplorer|NetcraftSurveyAgent|NetScoop|NetSeer|newscan\-online|nil|none|Nutch|ObjectsSearch|Occam|openstat.ru\/Bot|packrat|pageboy|ParaSite|patric|pegasus|perlcrawler|phpdig|piltdownman|Pimptrain|pingdom|pinterest|pjspider|PlumtreeWebAccessor|PortalBSpider|psbot|rambler|Raven|RHCS|RixBot|roadrunner|Robbie|robi|RoboCrawl|robofox|Scooter|Scrubby|Search\-AU|searchprocess|search|SemrushBot|Senrigan|seznambot|Shagseeker|sharp\-info\-agent|sift|SimBot|Site Valet|SiteSucker|skymob|SLCrawler\/2\.0|snooper|solbot|speedy|spider_monkey|SpiderBot\/1\.0|spiderline|spider|suke|tach_bw|TechBOT|TechnoratiSnoop|templeton|teoma|titin|topiclink|twitterbot|twitter|UdmSearch|Ukonline|UnwindFetchor|URL_Spider_SQL|urlck|urlresolver|Valkyrie libwww\-perl|verticrawl|Victoria|void\-bot|Voyager|VWbot_K|wapspider|WebBandit\/1\.0|webcatcher|WebCopier|WebFindBot|WebLeacher|WebMechanic|WebMoose|webquest|webreaper|webspider|webs|WebWalker|WebZip|wget|whowhere|winona|wlm|WOLP|woriobot|WWWC|XGET|xing|yandex|yeti|Zeus/i', $_SERVER['HTTP_USER_AGENT'])){ #if (preg_match('/(?!\googlebot)|bot|semrush|riddler|curl|dataprovider|riddler|daum|get|spider|find|java|majesticsEO|teoma|contaxe|yandex|libwww-perl/i', $_SERVER['HTTP_USER_AGENT'])) { #if (preg_match('/bot|semrush|riddler|curl|dataprovider|riddler|daum|get|spider|find|java|majesticsEO|teoma|contaxe|yandex|libwww-perl/i', $_SERVER['HTTP_USER_AGENT'])) { #if (preg_match('/bot|semrush|riddler|qwant|curl|dataprovider|riddler|daum|get|spider|find|java|majesticsEO|teoma|contaxe|yandex|libwww-perl|abacho|accona|AddThis|AdsBot|ahoy|AhrefsBot|AISearchBot|alexa|altavista|anthill|appie|applebot|arale|araneo|AraybOt|ariadne|arks|aspseek|ATN_Worldwide|Atomz|baiduspider|baidu|bbot|bingbot|bing|Bjaaland|BlackWidow|BotLink|bot|boxseabot|bspider|calif|CCBot|ChinaClaw|christcrawler|CMC\/0\.01|combine|confuzzledbot|contaxe|CoolBot|cosmos|crawler|crawlpaper|crawl|curl|cusco|cyberspyder|cydralspider|dataprovider|digger|DIIbot|DotBot|downloadexpress|DragonBot|DuckDuckBot|dwcp|EasouSpider|ebiness|ecollector|elfinbot|esculapio|ESI|esther|eStyle|Ezooms|facebookexternalhit|facebook|facebot|fastcrawler|FatBot|FDSE|FELIX IDE|fetch|fido|find|Firefly|fouineur|Freecrawl|froogle|gammaSpider|gazz|gcreep|geona|Getterrobo-Plus|get|girafabot|golem|grabber|GrabNet|griffon|Gromit|gulliver|gulper|hambot|havIndex|hotwired|htdig|HTTrack|ia_archiver|iajabot|IDBot|Informant|InfoSeek|InfoSpiders|INGRID\/0\.1|inktomi|inspectorwww|Internet Cruiser Robot|irobot|Iron33|JBot|jcrawler|Jeeves|jobo|KDD\-Explorer|KIT\-Fireball|ko_yappo_robot|label\-grabber|larbin|legs|libwww-perl|linkedin|Linkidator|linkwalker|Lockon|logo_gif_crawler|Lycos|m2e|majesticsEO|marvin|mattie|mediafox|mediapartners|MerzScope|MindCrawler|MJ12bot|mod_pagespeed|moget|Motor|msnbot|muncher|muninn|MuscatFerret|MwdSearch|NationalDirectory|naverbot|NEC\-MeshExplorer|NetcraftSurveyAgent|NetScoop|NetSeer|newscan\-online|nil|none|Nutch|ObjectsSearch|Occam|openstat.ru\/Bot|packrat|pageboy|ParaSite|patric|pegasus|perlcrawler|phpdig|piltdownman|Pimptrain|pingdom|pinterest|pjspider|PlumtreeWebAccessor|PortalBSpider|psbot|rambler|Raven|RHCS|RixBot|roadrunner|Robbie|robi|RoboCrawl|robofox|Scooter|Scrubby|Search\-AU|searchprocess|search|SemrushBot|Senrigan|seznambot|Shagseeker|sharp\-info\-agent|sift|SimBot|Site Valet|SiteSucker|skymob|SLCrawler\/2\.0|snooper|solbot|speedy|spider_monkey|SpiderBot\/1\.0|spiderline|spider|suke|tach_bw|TechBOT|TechnoratiSnoop|templeton|teoma|titin|topiclink|twitterbot|twitter|UdmSearch|Ukonline|UnwindFetchor|URL_Spider_SQL|urlck|urlresolver|Valkyrie libwww\-perl|verticrawl|Victoria|void\-bot|Voyager|VWbot_K|wapspider|WebBandit\/1\.0|webcatcher|WebCopier|WebFindBot|WebLeacher|WebMechanic|WebMoose|webquest|webreaper|webspider|webs|WebWalker|WebZip|wget|whowhere|winona|wlm|WOLP|woriobot|WWWC|XGET|xing|yahoo|YandexBot|YandexMobileBot|yandex|yeti|Zeus/i', $_SERVER['HTTP_USER_AGENT'])){ #if (preg_match('/bot|crawl|curl|qwant|dataprovider|search|get|spider|find|java|majesticsEO|teoma|contaxe|yandex|libwww-perl/i', $_SERVER['HTTP_USER_AGENT'], $matches)) { if (preg_match('/^(?!.*\bgooglebot\b)(?!.*\bslurp\b)(?!.*\byandex\b)(?!.*\bbing\b).*?(?:bot|crawl|qwant|curl|dataprovider|search|get|spider|find|java|majesticsEO|yahoo|teoma|contaxe|yandex|libwww-perl|abacho|accona|AddThis|AdsBot|ahoy|AhrefsBot|AISearchBot|alexa|altavista|anthill|appie|arale|araneo|AraybOt|ariadne|arks|aspseek|ATN_Worldwide|Atomz|baiduspider|baidu|bbot|bingbot|bing|Bjaaland|BlackWidow|BotLink|bot|boxseabot|bspider|calif|CCBot|ChinaClaw|christcrawler|CMC\/0\.01|combine|confuzzledbot|contaxe|CoolBot|cosmos|crawler|crawlpaper|crawl|curl|cusco|cyberspyder|cydralspider|dataprovider|digger|DIIbot|DotBot|downloadexpress|DragonBot|DuckDuckBot|dwcp|EasouSpider|ebiness|ecollector|elfinbot|esculapio|ESI|esther|eStyle|Ezooms|facebot|fastcrawler|FatBot|FDSE|FELIX IDE|fetch|fido|find|Firefly|fouineur|Freecrawl|froogle|gammaSpider|gazz|gcreep|geona|Getterrobo-Plus|get|girafabot|golem|grabber|GrabNet|griffon|Gromit|gulliver|gulper|hambot|havIndex|hotwired|htdig|HTTrack|ia_archiver|iajabot|IDBot|Informant|InfoSeek|InfoSpiders|INGRID\/0\.1|inktomi|inspectorwww|Internet Cruiser Robot|irobot|Iron33|JBot|jcrawler|Jeeves|jobo|KDD\-Explorer|KIT\-Fireball|ko_yappo_robot|label\-grabber|larbin|legs|libwww-perl|linkedin|Linkidator|linkwalker|Lockon|logo_gif_crawler|Lycos|m2e|majesticsEO|marvin|mattie|mediafox|mediapartners|MerzScope|MindCrawler|MJ12bot|mod_pagespeed|moget|Motor|msnbot|muncher|muninn|MuscatFerret|MwdSearch|NationalDirectory|naverbot|NEC\-MeshExplorer|NetcraftSurveyAgent|NetScoop|NetSeer|newscan\-online|nil|none|Nutch|ObjectsSearch|Occam|openstat.ru\/Bot|packrat|pageboy|ParaSite|patric|pegasus|perlcrawler|phpdig|piltdownman|Pimptrain|pingdom|pinterest|pjspider|PlumtreeWebAccessor|PortalBSpider|psbot|rambler|Raven|RHCS|RixBot|roadrunner|Robbie|robi|RoboCrawl|robofox|Scooter|Scrubby|Search\-AU|searchprocess|search|SemrushBot|Senrigan|seznambot|Shagseeker|sharp\-info\-agent|sift|SimBot|Site Valet|SiteSucker|skymob|SLCrawler\/2\.0|snooper|solbot|speedy|spider_monkey|SpiderBot\/1\.0|spiderline|spider|suke|tach_bw|TechBOT|TechnoratiSnoop|templeton|teoma|titin|topiclink|UdmSearch|Ukonline|UnwindFetchor|URL_Spider_SQL|urlck|urlresolver|Valkyrie libwww\-perl|verticrawl|Victoria|void\-bot|Voyager|VWbot_K|wapspider|WebBandit\/1\.0|webcatcher|WebCopier|WebFindBot|WebLeacher|WebMechanic|WebMoose|webquest|webreaper|webspider|webs|WebWalker|WebZip|wget|whowhere|winona|wlm|WOLP|woriobot|WWWC|XGET|xing|yeti|Zeus)/i', $_SERVER['HTTP_USER_AGENT'], $matches)) { $arr = $matches; $uafound = $arr['0']; #echo "Useragent Match: $uafound\n"; #Goodbots "Googlebot" OR "bingbot" OR "Yahoo" OR "Slurp" OR "DuckDuckBot" if (in_array($ip, $list) ){ #echo "$ip FOUND IN FILE $ua $uafound"; }else{ #echo "$ip NOT FOUND IN FILE $ua $uafound"; if ($ip !=="10.10.10.101" ){ #$ht = "Deny from $ip"; file_put_contents("/var/wwwroot/westnet.ca/bannedipan.txt", $ip."\n", FILE_APPEND); #file_put_contents("/var/wwwroot/westnet.ca/.htaccess", $ht."\n", FILE_APPEND); file_put_contents("/var/wwwroot/westnet.ca/bannedbots.txt", "$ip $ua Useragent Match: $uafound\n", FILE_APPEND); } } /* header("HTTP/1.1 503 Service Temporarily Unavailable"); header("Status: 503 Service Temporarily Unavailable"); header("Retry-After: 3600"); echo '
We expect to have the site back up within 4 hours.
'; exit; */ #} }#goodbotcheck /* if (in_array($ip, $list) ){ #echo "$ip FOUND IN FILE, last array"; header("HTTP/1.1 503 Service Temporarily Unavailable"); header("Status: 503 Service Temporarily Unavailable"); header("Retry-After: 3600"); echo 'We expect to have the site back up within 4 hours.
'; exit; } */ # '../', 'passwd', 'UNION' if (strpos($urlg, '../') !== false) { echo 'fuck off'; die(); } if (strpos($article, '../') !== false) { echo 'fuck off'; die(); } if (strpos($vl, '../') !== false) { echo 'fuck off'; die(); } $banned[0]="5.79.105.131"; if (in_array($_SERVER['REMOTE_ADDR'],$banned)) { header("HTTP/1.1 403 Forbidden"); exit; } $banned[0]="202.46.51.210"; if (in_array($_SERVER['REMOTE_ADDR'],$banned)) { header("HTTP/1.1 403 Forbidden"); exit; } $host = $_SERVER['HTTP_HOST']; $uri = $_SERVER['REQUEST_URI']; $domainname = $_SERVER['HTTP_HOST']; #if ($domainname != "action.news"){ #$uri = $_SERVER['REQUEST_URI']; #Header( "HTTP/1.1 301 Moved Permanently" ); #Header( "Location: http://action.news$uri" ); #} if ($domainname == "www.telus.com.fiber.westnet.ca"){ $cdn = "https://$domainname"; } else { #$cdn = "https://secure.action.news"; } // find out the domain: $domain = $_SERVER['HTTP_HOST']; // find out the path to the current file: $path = $_SERVER['SCRIPT_NAME']; // find out the QueryString: $queryString = $_SERVER['QUERY_STRING']; // put it all together: $url = "//" . $domain . $path . "?" . $queryString; #$items = array(westnet,westnethd,forestlawnalberta); #$fblikename = $items[array_rand($items)]; $fblikename = "westnethd"; $range_start = ip2long("207.35.0.0"); $range_end = ip2long("207.35.255.255"); $ip = ip2long($_SERVER['REMOTE_ADDR']); if ($ip >= $range_start && $ip <= $range_end) { // alert $ip = $_SERVER["REMOTE_ADDR"]; $referer = $_SERVER['HTTP_REFERER']; $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); $ua = $_SERVER['HTTP_USER_AGENT']; $to = "cs.security-207.35.0.0@westnet.ca"; $subject = "Calgary Stampede Snooping $url"; $body = "$ip $hostname read $url from $referer $ua"; if (mail($to, $subject, $body)) { echo(""); } else { echo(""); } } $referer = $_SERVER['HTTP_REFERER']; if (strpos($referer,'facebook') !== false) { // alert $ip = $_SERVER["REMOTE_ADDR"]; $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); $ua = $_SERVER['HTTP_USER_AGENT']; #$to = "fb-visitor@westnet.ca"; $subject = "$url"; $body = "$ip $hostname read $url from $referer $ua"; if (mail($to, $subject, $body)) { echo(""); } else { echo(""); } } $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); if (strpos($hostname,'tfbnw') !== false) { // alert $ip = $_SERVER["REMOTE_ADDR"]; $ua = $_SERVER['HTTP_USER_AGENT']; #$to = "fb-visitor@westnet.ca"; $subject = "$url"; $body = "$ip $hostname read $url from $referer $ua"; if (mail($to, $subject, $body)) { echo(""); } else { echo(""); } } $range_start = ip2long("216.239.0.0"); $range_end = ip2long("216.239.255.255"); $ip = ip2long($_SERVER['REMOTE_ADDR']); if ($ip >= $range_start && $ip <= $range_end) { // alert $ip = $_SERVER["REMOTE_ADDR"]; $referer = $_SERVER['HTTP_REFERER']; $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); $ua = $_SERVER['HTTP_USER_AGENT']; $to = "security-216.239.0.0@westnet.ca"; $subject = "Google Snooping $url"; $body = "$ip $hostname read $url from $referer $ua"; if (mail($to, $subject, $body)) { echo(""); } else { echo(""); } } $ip = $_SERVER['REMOTE_ADDR']; ?>