Forum Moderators: coopster & phranque

Message Too Old, No Replies

trap.pl

         

admad1

5:42 pm on Aug 4, 2005 (gmt 0)

10+ Year Member


Hi Guys. I'm new to this stuff and I've come across the trap.pl script at thread http://www.webmasterworld.com/forum13/1183.htm . I have this up and running and it appears to be working in so much as that when I try to access a file disallowed in robots.txt it sends me a notification email and writes my ip to .htaccess as below.
---------------------------------------------
# Thu Aug 4 17:37:29 2005 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50215)
SetEnvIf Remote_Addr ^82\.112\.144\.214$ getout

<Files ~ "^.*$">
order allow,deny
allow from all
deny from env=ban
</Files>
----------------------------------------

I assumed this would block me from accessing my site but I can still get to it. I've placed the trap.cgi script in my root rather than my cgi bin and this appears to bw working as it should but I cant understand why I can access the site if its blocked.

Can anyone help me with this please .
Many Thanks
Andy

balam

8:15 pm on Aug 9, 2005 (gmt 0)

10+ Year Member



Welcome to WebmasterWorld, admad1!

Very simple to fix - that is, if you recognize what's wrong. :)

It looks like you took the perl script from one thread and mixed it with .htaccess code from another - and that's where the problem lies.

If you change this line...

deny from env=ban

...to this...

deny from env=getout

...I'm sure you'll find you can no longer visit your own website. ;)

You're obviously aware of the first thread, "Ban malicious visitors with this Perl Script [webmasterworld.com]", but for complete picture, there are two follow-up threads:

bad-bot script: follow-up? [webmasterworld.com]
modified "bad-bot" script blocks site downloads [webmasterworld.com]

If you feel more comfortable with PHP than perl, you might like to have a look at these threads:

PHP Spider Trap [webmasterworld.com]
Updated PHP Bad Bot Script [webmasterworld.com]

admad1

8:43 pm on Aug 9, 2005 (gmt 0)

10+ Year Member



Many Thanks Balam, much appreciated. Yes your right I was reading between 3 threads and obvously got the code mixed up.Proberbly why I'll never make a programmer! Oh well plod on .

Just tested and it works a treat at last a way to block the bastards.

Many thanks

Andy