diff --git a/public/blacklist.dat b/public/blacklist.dat new file mode 100644 index 0000000..e69de29 diff --git a/public/blacklist.php b/public/blacklist.php new file mode 100644 index 0000000..0bacce6 --- /dev/null +++ b/public/blacklist.php @@ -0,0 +1,23 @@ +\n"); + while ($line = fgets($fp,255)) { + $u = explode(" ",$line); + $u0 = $u[0]; + if (preg_match("/$u0/",$_SERVER['REMOTE_ADDR'])) {$badbot++;} + } + fclose($fp); + if ($badbot > 0) { /* this is a bad bot, reject it */ + sleep(12); + print ("
\n"); + print ("ニャンでここに?
+ + \n"); + while ($line = fgets($fp,255)) { + $u = explode(" ",$line); + $u0 = $u[0]; + if (preg_match("/$u0/",$_SERVER['REMOTE_ADDR'])) {$badbot++;} + } + fclose($fp); + if ($badbot == 0) { /* we just see a new bad bot not yet listed ! */ + /* send a mail to hostmaster */ + $tmestamp = time(); + $datum = date("Y-m-d (D) H:i:s",$tmestamp); + $from = "badbot-watch@076.ne.jp"; + $to = "reports@076.ne.jp"; + $subject = "domain-tld alert: bad robot"; + $msg = "A bad robot hit ".$_SERVER['REQUEST_URI']." ".$datum." \n"; + $msg .= "address is ".$_SERVER['REMOTE_ADDR'].", agent is ".$_SERVER['HTTP_USER_AGENT']."\n"; + mail($to, $subject, $msg, "From: $from"); + /* append bad bot address data to blacklist log file: */ + $fp = fopen($filename,'a+'); + fwrite($fp, $_SERVER['REMOTE_ADDR']." - - [".$datum."] ".$_SERVER['REQUEST_METHOD']." ".$_SERVER['REQUEST_URI']." ".$_SERVER['SERVER_PROTOCOL']." ".$_SERVER['HTTP_REFERER']." ".$_SERVER['HTTP_USER_AGENT']."\n"); + fclose($fp); + } + ?> + + diff --git a/public/img/pixel.gif b/public/img/pixel.gif new file mode 100644 index 0000000..670932d Binary files /dev/null and b/public/img/pixel.gif differ diff --git a/public/robots.txt b/public/robots.txt index eb05362..4334ecd 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,2 @@ User-agent: * -Disallow: +Disallow: /bot-trap/ diff --git a/resources/views/pages/common/comments.blade.php b/resources/views/pages/common/comments.blade.php index 34d4fba..adf5c68 100644 --- a/resources/views/pages/common/comments.blade.php +++ b/resources/views/pages/common/comments.blade.php @@ -2,9 +2,10 @@