#!/usr/bin/perl # # hall_of_mirrors, a more advanced tarpit :) # # attempts to mimic actual pages, using random # phrases. if you want to maintain state for logging # suggest you use QUERY_STRING, and pass it along in # the #include virtual. # logs behavior, you may want to comment this out if # a very fast/multi-threaded bot tries to muck # around in your cgis, or if you are more # fortunate than me and have access to your server # logs. # this is still quite simple code, but it's the most # in-depth bot trap i've seen (albeit not much.) you # can log the bots to study their behavior (do they # have 'depth' limits, do they target certain words?) # this is mostly just a skeleton for you to build # upon, demonstrate an undetectable bot trap. (they # can guess, but i've not seen one that will; it # fooled every spambot/site-grabber i tried) # enjoy, # -sonofsamiam print "Content-type: text/html\n\n"; # @seeds is seed words or phrases or sentences or html or email # address or whatever to use in constucting our fakes. this way, # we can target our funhouse visitors @seeds=('bots','skunks','botany','teergrube','server@domain.com','d_E-y@!!!.com','blaggart', 'crawler','spider','choke','and','die','

kill spammers

','cornelius' ); # extension of yer mirrors, usually .shtml, unless you use the x-bit hack $extension='.shtml'; #files you don't want to delete @dontkill=('test.shtml'); chdir '../funhouse/'; #er, fix to your liking. # the bot leaves it's footprints... customize however you please... #open(LOG,">>mirror_log.txt"); #$time=localtime; #print LOG "[$time] $ENV{'REMOTE_ADDR'} $ENV{'HTTP_USER_AGENT'} $ENV{'HTTP_REFERER'}\n"; #close(LOG); ### the ground gets sticky right about here ### $slen=@seeds; #kill the elders if(opendir(DIR,'.')){ while($file=readdir(DIR)){ foreach $f(@dontkill){ if($file eq $f){ last; }else{ unlink($file); } } } close(DIR); } #birth the new @newmirs=(); $mirs=int(rand 5)+1; for($h=0;$h<$mirs;$h++){ #make filename $n=''; $c=int(rand 8)+3; for($j=0;$j<$c;$j++){ $n.=chr(int(rand 26)+97); } $ms=push @newmirs, $n.$extension; } foreach $mir(@newmirs){ #make a mirror, default perms are 666 open(MIRROR,">$mir") or die("the mirror cracked!"); print MIRROR "$seeds[0]\n"; # <<<*** the key ssi ***>>> print MIRROR ""; print MIRROR "\n"; close(MIRROR); } #how many sentences? $sens=int(rand 100)+1; for($i=0;$i<$sens;$i++){ #how long is the sentence? $senlen=int(rand 20)+1; for($j=0;$j<$senlen;$j++){ if(int(rand 5)+1<2){ #fix this to whatever you want. #make a link to a mirror $n=$newmirs[int(rand $ms)]; print " $n "; }else{ #get a random word from @seeds $word=$seeds[int(rand $slen)]; print " $word "; } } print ".
"; #or whatever. }