# rct - Recode, Counter, Tracker # (C) 2002-2005 Lena@lena.kiev.ua # freeware for non-commercial use # version 2.52 April 7, 2008 BEGIN { $MainDomain = 'lena.kiev.ua'; $ParkedDomains = qr/(?:kcana\.kiev\.ua|leksen\.kiev\.ua|ksana\.org\.ua|sergej\.org\.ua)/i; $AllDomains = qr/(?:lena\.kiev\.ua|$ParkedDomains)/io; $root = '/home/cgi/data/www/lena.kiev.ua'; $from = "lena\@mail2ftp.org.ua"; # mailbox for error messages $to = "Lena\@lena.kiev.ua"; # address,address $sendmail = "/usr/sbin/sendmail -t -i -odb -oem -f$from"; $localproxy = '127.0.0.1'; # some webservers have a local proxy $blank = ''; # substitute for blank, must be in 0-31 (0-1F) range @hostnames_IP_needed = qw(.a2000.nl .emperion.net .dataforce.net .chello.nl .cetlink.net .omegaopt.ru .omegaguard.ru coollink.us .looksmart. exabot.com .FreeBit.NE.JP net-sweeper.com .dxi.net mobster.biz v0.valuehost.ru .webair.com virtuadome.com RIN dbsmarketing.net .hostmania.net .nwlink.com proxy.telecom.lt .valuehost.co.uk .bp13catv.broadband.hu membersgetit.com .creator.co.il .hrn.ru whitepine-ventures.com unleashed.net drd.ru hostland.ru 3fn.net .valuehost.ru websense.com .servershost.net .isi.edu group-it.com .net.upc.nl .nb.home.nl .adsl-surfen.hetnet.nl amatama. .excel.com irl-crawler.cs.tamu.edu cafe.tg hostersheaven.net hosting fish\d+.search.aol.com .pppool.de lucky-server.biz dns-cluster.net .red.bezeqint.net domainspa.com .adsl.wanadoo. merphy.demos.su .adsl.euronet.nl .home.nl hostbasket.com racknine.com jeteye.com .Stanford.EDU serverpronto.com surfcontrol.com hess.com .cable.casema.nl your-ideal.com .slu.edu .adsl.skynet.be vianw.pt claria.com infinitex.com securityspace.com .dial.sovam.com sms13.de starmp3.net .adsl.cybercity.dk .introweb.nl tuxdns.net .uni-regensburg.de offline.online.ee 2net.info .attens.net .kabel.telenet.be skulker.org .cable.quicknet.nl .burohappold.com .intercom.net.ua .saix.net .netscape.com .serverkompetenz.net .oz.net -ADSL.red.retevision.es wmd.rol.ru .skylogicnet.it spider.meta-ukraine.com .adscpm.com .ntli.net expressvu.ca .cs.tamu.edu .host150.netvision.net.il lomejordeinternet.net .steephost.com .cs.washington.edu); @banned_IPs = qw{4.38.109. 12.148.196.(?:12[8-9]|1[3-9][0-9]|2[0-4][0-9]|25[0-5]) 12.148.209.(?:19[2-9]|2[0-4][0-9]|25[0-5]) 12.175.0.[34][0-9] 12.217.198.103 12.217.212.250 38.112.195. 61.81.8.103 62.25.99.14$ 62.37.188.5$ 62.56.1(?:89|9[01]). 62.58.168.62 62.118.251.(?:16|30|67)$ 62.177.137.205 62.192.151.130 62.194.61.30 62.220.103.6$ 63.109.248. 63.148.99.2?:(2[4-9]|[3-4][0-9]|5[0-5]) 63.212.171.193 63.241.61.8$ 64.37.103.34 64.62.175.13[1-8] 64.124.150.52 64.124.222.166 64.140.49.6[6-9] 64.152.73.15 64.156.198. 64.162.116.132 64.246.0.17$ 64.251.30. 65.57.107.254 65.75.134.180 65.75.136.90 65.75.171.160 65.98.67.74 65.110.40.170 65.110.62.100 65.197.137.34 66.17.157.53 66.90.67.1[1-3]$ 66.98.190.93 66.98.196.94 66.132.132.63 66.178.(?:1?[0-9]|47|6[2-9]|[7-9][0-9]). 66.194.6. 66.207.120.2(?:2[4-9]|3[0-9]) 66.225.212.203 66.225.215.32 66.230.218. 66.232.(?:15|17|21). 66.237.60.109 67.15.12.50 66.17.15.130 67.18.251.186 67.19.73.154 67.19.116.146 68.8.156.89 68.145.120.207 69.20.9.236 69.28.58. 69.28.227.2[0-2][0-9] 69.31.79. 69.41.174.31 69.41.248.242 69.44.60.201 69.50.176.146 69.61.1[25].100 78.129.202.15$ 79.143.182.232 80.24.47.77 80.56.92.43 80.88.(?:12[89]|13[0-2689]|14[2-6]|15[024]). 80.98.113.95 80.179.(?:10[1-7]|2[45][0-9]). 80.201.27.145 80.202.228.57 80.247.1[34][0-9]. 80.248.(?:6[4-6]|70) 80.250.3[67]. 80.255.43. 81.13.8.94 81.58.46.74 81.91.2(?:27|3[2-5]). 81.199.(?:6|75|8[03-5]|93|10[458]|125). 81.241.234. 82.128.(?:[12]?[0-9]|3[01]). 82.137.161.2$ 82.146.40.32 84.80.39.6 84.233.148.(?:1?[0-9]|20)$ 109.251.74.148 123.125.69. 128.9.216.196 128.194.135.8[0-3] 128.242.197.101 159.226.22. 165.254.10. 168.187.120.163 173.240.49. 174.122.51.251 192.116. 192.132.210. 193.108.209.234 193.219.234.165 193.219.248. 193.220.(?:26|50|127|178|188). 194.67.3.223 194.87.0.56 194.131.98. 195.11.231.210 195.42.160.[1-2][0-9]$ 195.44.181.17$ 195.154.174.164 195.166.138. 195.166.2(?:2[4-9]|[3-5][0-9]). 195.228.227.12$ 196.40.(?:30|75). 196.201.(?:6[4-9]|7[0-3]). 198.54.202.115 198.64.140.108 198.65.155.205 200.193.24.18$ 202.101.180. 202.108. 202.155.195. 203.194.160. 205.209.188.20$ 207.202.170.3[4-9] 208.53.138. 208.80.19[2-9]. 210.82.95. 210.218.195.129 211.161.20. 211.234.112.191 212.22.90.220 212.24.149.10 212.45.4.(?:4[49]|5[0-5]) 212.52.1(?:39|5[36]). 212.98.161.170 212.123.6.7$ 212.165.132.(?:12[8-9]|1[3-9][0-9]|2[0-5][0-9]) 212.165.141.11$ 212.165.157. 212.199.251. 213.31.4[0-2]. 213.136.(?:9[67]|10[04-6]|11[56]|12[67]). 213.150.192. 213.154.[6-9][0-9]. 213.180.9.170 213.181.(?:6[46]|81). 213.185.1[01][0-9]. 213.234.252.35 213.255.(?:19[2-8]|211|254). 216.32.83.235 216.97.147.13 216.104.207.7$ 216.127.82.9[7-9] 216.139.1(?:76|8[0159]). 216.147.132.1(?:4[4-9]|5[0-9]) 216.185.5[7-9]. 216.189.30 216.248.177.131 217.10.169. 217.73.16[45]. 217.78.(?:6[4-9]|7[0-9]). 217.107.216. 217.116.48.132 217.177.15. 217.194.1(?:4[7-9]|5[4-7]). 218.0.72. 218.0.77. 218.6.8.17 218.12.182. 218.70.8[56]. 218.88.137. 219.112.7. 209.159.170.235 220.73.165.139 220.113.168. 221.12.(?:[89]|1[0-7])[0-9]. 221.148.44.[6-9][0-9] 222.182.}; @banned_user_agents = split( ' ', <<'EOB' ); ^.Browse\s ^.Eval ^.Surf .+Harvest \)\sXX$ 0\(compatible; autoemailspider Baiduspider Boston.Project compatible\s; \(compatible;.MSIE.6.0\)$ DTS.Agent efp\@gmx.net Email.Extractor eXtractor HTTrack LWP Mozilla\/4.0.\(http:\/\/www.fast-search-engine.com\/\) MSIE.4.0;.Windows.NT.5.1; MSIE.4.5;.Windows MSIE.5.00;\) \(NaverRobot\) prospector robot\@monkia.com.tw;\+http:\/\/gais.cs.ccu.edu.tw\/robot Sosospider statcrawler www.aihit.com www.puritysearch.net www.sitebot.org ^\w{21,}$ ^[a-z]{12,}$ ^ANT.Chassis ^ASSORT ^attache ^ATHENS ^autohttp ^Baiduspider ^bew ^booch ^Brick.House.Browse ^Bridgetown\sLabs ^Bullseye ^CherryPicker ^China.Local.Browse ^combine ^CosmixCrawler ^Cowbot ^Crescent ^cURL ^curl ^Demo\sBot ^devsoft's\shttp\scomponent\sv1\.0 ^Deweb ^Digger ^Digimarc ^DIIbot ^disco ^DISCoFinder ^ecollector ^Educate\sSearch ^EmailCollector ^EmailSiphon ^EmailWolf ^EO\sBrowse ^ExtractorPro ^fastlwspider ^FEZhead ^Fetch ^First.Browse.of ^Franklin.(?:Locator|Box) ^Full\sWeb\sBot ^Gaisbot ^Generic$ ^Getleft ^GetURL ^GetWebPage ^go-ahead-got-it ^Green.Research,.Inc. ^Holiday.Shopping,.Inc ^ia_archiver ^IBM_Planetwide ^icsbot ^IE\/ ^IE.\d.\d.Compatible.*Browser$ ^Illinois.State.Tech.Labs$ ^IncyWincy ^Indiana.U.Web ^Industry\sProgram ^Inter-Coastal.Info.Server ^Internet\sExplore\s5.x ^ISC.Systems ^IUFW\sWeb ^IUPUI.Research.Bot ^IUS.Sp ^Just.a.Browser$ ^KWebGet ^[Ll]achesis ^leech ^Lincoln.State ^Mac\sFinder ^Mail\sSweeper ^MCspider ^Mediapartners-Google ^MFC\sFoundation\sClass\sLibrary ^Microcomputers.Etc ^Microsoft.Internet.Explorer ^Microsoft.URL ^MicrosoftPrototypeCrawler ^microsoftwildhare ^Missauga.Locate ^Missigua\sLocator ^Mo.College ^Monster ^Mozilla\s\/\s4\.0$ ^Mozilla.*NEWT ^Mozilla\(IE.Compatible\)$ ^Mozilla\/0 ^Mozilla\/2.0.\(compatible;.Ask.Jeeves\)$ ^Mozilla\/3\.0\s\(compatible\) ^Mozilla\/3.0.+Indy\sLibrary ^Mozilla\/3.Mozilla\/2.01 ^mozilla\s4.0$ ^Mozilla\/4.0\sefp@gmx.net ^Mozilla\/4.0\(WIN98\) ^Mozilla\/4.0\s\(compatible:\sFDSE\srobot\)$ ^Mozilla\/4\.0$ ^Mirror ^Missouri.College.Browse ^MSIE\s[56]\.0$ ^MyApp ^mySCOUT ^NASA.Search ^NaverBot ^Net.Vampire ^netattache ^NetCarta ^NG\/ ^nicerspro ^NICErsPRO ^NPBot ^Nu-Nu ^OpaL ^Openfind ^OpenTextSiteCrawler ^PackRat ^pavuk ^PicSpider ^PlantyNet_WebRobot ^Plucker ^Port.Huron.Labs ^Production\sBot ^Program\sShareware ^PushSite ^QuepasaCreep ^RepoMonkey ^RIN\. ^River.Valley.Inc ^Rover ^Rsync ^Schmozilla ^ScoutAbout ^ScSpider ^searchterms\.it ^Shai ^sherlock ^sitecheck ^Smith.and.Douglas ^Spegla ^SpiderBot ^Sqworm ^SuperBot ^SurfWalker ^tarspider ^teleport\spro\/1\.28 ^Telesoft ^Templeton ^test\/0\.1$ ^TurnitinBot ^Under.the.Rainbow ^University.of.Illinois.Web ^UtilMind ^vspider ^w3mir ^web.by.mail ^Web.hacker ^[Ww]eb[Bb]andit ^WebBrowser$ ^WebCopier ^WebCopy ^WebEMailExtrac ^WebMiner ^WebSauger ^Website.Downloader ^WebSnake ^WebStripper ^webvac ^webwalk ^WebZIP ^Wells.Search ^WEP\sSearch ^WhosTalking ^WUMPUS ^WWW-Mechanize ^www\.pl ^XGET ^Zeus EOB # that was from http://www.neilgunton.com/spambot_trap/bad_agents.txt # as of March 23, 2003, but: # - excluded: libwww-perl MSIECrawler ^reget ^wget # - included at the beginning of 'sub recode': ^Mozilla/4.0$ ^[A-Z]+$ NT;\)$ # - included: \)\sXX$ 0\(compatible; autoemailspider Boston.Project # compatible\s; \(compatible;.MSIE.6.0\) efp\@gmx.net # Mozilla\/4.0.\(http:\/\/www.fast-search-engine.com\/\) # MSIE.4.0;.Windows.NT.5.1; MSIE.4.5;.Windows MSIE.5.00;\) # robot\@monkia.com.tw;\+http:\/\/gais.cs.ccu.edu.tw\/robot statcrawler # ^\w{21,}$ ^[a-z]{12,}$ # ^ANT.Chassis ^Baiduspider ^booch ^Brick.House.Browse ^Bridgetown\sLabs # ^China.Local.Browse ^combine ^CosmixCrawler ^Cowbot ^cURL ^Demo\sBot # ^dloader(NaverRobot) ^Educate\sSearch ^First.Browse.of # ^Franklin.(?:Locator|Box) ^Full\sWeb\sBot ^Gaisbot ^Generic$ # ^Green.Research,.Inc. .+Harvest ^Holiday.Shopping,.Inc ^icsbot ^IE\/ # ^IE.\d.\d.Compatible.*Browser$ ^Illinois.State.Tech.Labs$ ^Indiana.U.Web # ^Industry\sProgram ^Inter-Coastal.Info.Server ^ISC.Systems ^IUFW\sWeb # ^IUPUI.Research.Bot ^IUS.Sp ^Just.a.Browser$ ^[Ll]achesis ^Lincoln.State # ^Mac\sFinder ^Mail\sSweeper ^Mediapartners-Google # ^MFC\sFoundation\sClass\sLibrary ^Microcomputers.Etc # ^Microsoft.Internet.Explorer ^MicrosoftPrototypeCrawler ^microsoftwildhare # ^Missauga.Locate ^Missigua\sLocator ^Missouri.College.Browse ^Mo.College # ^Mozilla$ ^Mozilla\(IE.Compatible\)$ ^Mozilla\/0 # ^Mozilla\/2.0.\(compatible;.Ask.Jeeves\)$ ^Mozilla\/3\.0\s(compatible) # ^mozilla\s4.0$ ^Mozilla\/4.0\s\(compatible:\sFDSE\srobot\)$ # ^Mozilla\/4.0\(WIN98\) ^Mozilla\/[45].0$ ^MSIE\s6\.0$ ^MyApp ^mySCOUT # ^NASA.Search ^NaverBot ^NG\/ ^NPBot ^Nu-Nu ^PicSpider ^PlantyNet_WebRobot # ^Port.Huron.Labs ^Production\sBot ^Program\sShareware ^River.Valley.Inc # ^QuepasaCreep ^Schmozilla ^ScSpider ^sherlock ^Smith.and.Douglas ^Sqworm # ^test\/0\.1$ ^TurnitinBot ^Under.the.Rainbow ^University.of.Illinois.Web # ^vspider ^WebBrowser$ ^WebSauger ^Website.Downloader ^Wells.Search # ^WEP\sSearch ^WWW-Mechanize ^Zeus # - included according to Sun Zoom Spark: # eXtractor ^ArribaPacketRat ^NICErsPRO ^Web.hacker ^[Ww]eb[Bb]andit # - included according to http://www.leekillough.com/robots.html : ^Digger # - according to http://www.sendfakemail.com/fakemail/antispam.html : # included: Email.Extractor # excluded: ^digout4uagent Harvest ^WebReaper $SIG{'__DIE__'} = $SIG{'__WARN__'} = sub { if ( $_[0] !~ /Filehandle STDOUT (?:re)?opened(?: as IN)? only for input/ # see comments below after "open( IN" and open( ERRLOG, ">>$root/cgi-errors.log" ) and flock( ERRLOG, 2 )) { print ERRLOG scalar gmtime, " $_[0]"; close ERRLOG; } }; $AllHostnames = qr/^(?:$AllDomains|(?:\d{1,3}\.){3}\d{1,3})$/io; $ref1 = $ENV{'HTTP_REFERER'}; $ref2 = $ENV{'REQUEST_URI'}; $host = $ENV{'HTTP_HOST'} || ''; $_ = $ENV{'QUERY_STRING'} || ''; $lat = /lat/i; $selat = $lat && defined( $ref1 ) && $ref1 =~ m{^http://}i && $ref1 !~ m{^http://(?:www\.)?$AllDomains}i; $ParkedRedirectToRoot = $host =~ $ParkedDomains && $ref2 ne '/' && ! -e $host; if ( $host and $host !~ $AllHostnames or $selat or $ParkedRedirectToRoot or /\w{3}\?/ ) { # Teleport Pro fetches /?win?koi?koi etc. $host =~ s/^www\.//i; $host = $MainDomain if $host and $host !~ $AllHostnames; $ref2 = '/' if $ParkedRedirectToRoot; $_ = "http://$host$ref2#"; /^(.+?)[#?]/; # +? means "not greedy" s|([#?])|/$1| unless $1 =~ m{(?:/|\.pl)$}; chop; s/^([^?]+\?\w{3})\?.*$/$1/; s/\?.+$// if $selat; # найденное поисковиками показывать кириллицей print "Status: 301 Moved Permanently\nLocation: $_\nURI: $_\n", "Content-type: text/html\n\n", "Redirect\n", "Redirecting to: $_\n"; exit; } $win = /win/i && ! $lat; $koi = /koi/i && ! $lat && ! $win; $par = $lat ? '?lat' : $win ? '?win' : $koi ? '?koi' : ''; $_ = $ENV{'HTTP_ACCEPT_CHARSET'} || ''; $acw = /windows-1251/i; $ack = /koi8-r/i; $ua = $ENV{'HTTP_USER_AGENT'}; $_ = ( $ua || '' ) =~ /win/i && ! ( $ack && ! $acw) || $acw && ! $ack; print 'Content-Type: text/html'; if ( $lat ) { $win = $_; $mct = ''; } else { if ( $win or $_ and not $koi ) { $_ = '; charset=windows-1251'; $win = 1; } else { $_ = '; charset=koi8-r'; $win = 0; } print; $mct = "\n"; } $_ = 'data' if ( $_ = $ENV{'SCRIPT_FILENAME'} ) =~ m{/guestbook/index}; $_ = $host if $host =~ $ParkedDomains and $ENV{'SCRIPT_NAME'} =~ m{^(?:/(?:index.pl)?)?$}; $lms = ( stat )[9]; print "\nLast-Modified: ", scalar gmtime $lms unless m{/guestbook/sign/write}; $| = 1; # autoflush print "\n\n"; $| = 0; } use Fcntl; use Socket; use Sys::Hostname; @months = qw(January February March April May June July August September October November December); @mesjacy = qw(января февраля марта апреля мая июня июля августа сентября октября ноября декабря); ( undef, undef, undef, $mday, $mon, $year ) = gmtime( $lms ); $year += 1900; $lme = "$months[$mon] $mday, $year"; $lmr = "$mday $mesjacy[$mon] $year"; $ra = $ENV{'REMOTE_ADDR'} || ''; $al = $ENV{'HTTP_ACCEPT_LANGUAGE'}; $ac = $ENV{'HTTP_ACCEPT_CHARSET'}; $not_watchdog = $ua || $al || $ac || $ref2 ne '/' || $ra ne inet_ntoa( scalar gethostbyname( Sys::Hostname::hostname() )); $_ = ( $host =~ $ParkedDomains ? $host : $MainDomain ) . "/$ENV{'SCRIPT_NAME'}"; s|/\./|/|g; s|//|/|g; s|/index\.pl$||; s|^/||; s|/$||; $_ = '_' if /^$/; s/\W/_/g; if ( $not_watchdog ) { if ( sysopen( COUNT, "$root/counters/$_", O_RDWR | O_CREAT ) and flock( COUNT, 2 )) { $counter = 1 + ( || 0 ); if ( seek COUNT, 0, 0 ) { printf COUNT '%08d', $counter; truncate COUNT, 8; } close COUNT; } } else { $counter = 0; } $switchers = "\n" . '
' . ( ! $win && ! $lat ? 'KOI' : 'KOI' ) . "  \n" . ( $win && ! $lat ? 'WIN' : 'WIN') . "  \n" . ( $lat ? 'LAT' : 'LAT' ) . '
'; $deny = <Use another browser Your browser or site downloader was identified as spammer's email address harvester. Use another browser to view this page (http://$host$ref2).

Ваш browser или программа для скачивания (download) сайта была идентифицирована как спамерская адресособиралка. Используйте другой browser для просмотра этой странички (http://$host$ref2). EOB $denyIP = <Your IP address banned Your IP address is banned from viewing this website because activity from your IP address was identified as spidering by spammer's email address harvester.

Вашему IP-адресу запрещено просматривать этот web-сайт, т.к. скачивание сайта с этого IP-адреса было идентифицировано как выполненное с целью извлечения email адресов для рассылки по ним спама. EOB if ( $host =~ $ParkedDomains ) { do $host if -e $host; &tracker; exit; } sub recode { $_ = shift; $shra = '^(?:4.16.87|4.79.40|24.132|24.1[57]3|38.117.1[89]|58.66|61.174|61.189|' . '62.(?:66|104|110|131|163|166.23[2-5]|177.(?:1[3-9]|2[0-2])[0-9]|19[45]|21[19]|234|25[2-5])|' . '63.109|64.110|64.217.18[01]|65.75.1[2-8][0-9]|64.251.(?:14|3[01])|' . '65.110.[3-6][0-9]|66.111.[35][0-9]|66.178|66.192.47|67.1[89]|' . '69.(?:41.24[2-8]|60.(?:9[6-9]|1[01][0-9]|12[0-7])|93.[5-7][0-9])|70.84|' . '80.(?:3|5|1[6-9]|2[01]|5[6-8]|6[01]|87.83|10[045]|11[67])|' . '80.1(?:2[689]|3[0-9]|4[0-6]|6[4-6])|80.178.(?:5|64|76|104|236)|' . '80.179.(?:49|57|78|92|10[0-47]|16[0157]|18[4589]|19[19]|242|25[04])|' . '80.(18[0-5]|19[68]|20[0-7])|' . '81.(?:11|59|6[89]|7[0-5]|8[36]|11[2-7]|12[019]|132|15[1-8]|165|188|20[4-8]|218|24[0-6])|' . '82.(?:1|3|4[389]|5[0-3]|7[2-5]|8[0189]|9[0-2]|10[45]|136|141.249|152.52|156|158.90|16[89]|172|18[468]|19[19]|217)|' . '83.8[13-58]|83.11[6-8]|83.218.240|' . '84.(?:2[4-9]|3[01]|66|8[0-35]|94|10[49]|119|12[89]|13[35]|195|246.8)|' . '85.7[2-4]|145.53|151.(?:2[4-9]|3[01])|155.232|192.178|' . '193.41.130|194.135.2(?:2[4-9]|3[01])|194.239|' . '195.(?:229.2[2-5][0-9]|239.158|24[01])|' . '196.(?:2.100|15.164|25|46.6[56]|200|201.128|207)|' . '198.54|202.155|204.56|207.50.2[23][0-9]|211.(?:36|157)|' . '212.(?:47|8[48]|95.252|12[79]|142|17[19]|18[27]|204|242|247.106)|' . '212.199.(?:12|18|22|34|45|74|109|133|163|191|240)|' . '213.(?:6|7|10|42.2|4[569]|51|93|140|193|204.221|224|251|252.152)|216.139.185|' . '217.(?:1|5|4[2-4]|5[6-9]|8[0-9]|9[3-5]|12[0-3]|136|141|157|22[2-9]|2[3-5][0-9])|' . '218.(?:12|7[29]|94|166|224)|219.133|220.(?:132|188|229|253)|' . '222.47.183|222.53)\.'; foreach my $banned_user_agent ( @banned_user_agents ) { $_ = $deny, $deny = '', last if $ua and ( $ua =~ /$banned_user_agent/ and $ua !~ m{^Checkbot/[\d\.]+ LWP/} and $ua !~ /WebRingChecker/i or $ua =~ /; Windows XP/ and $ua !~ /Opera/ or $ua =~ m{Mozilla/4.0 \(compatible; MSIE (?:6.0; Win32|5.01; Windows NT)\)} and not $ref1 and not $al and not $ac and $ra ne '194.67.18.16' # www.atrus.ru or $ua =~ /^[A-Z]+$/ and $ua ne 'MARTINI' # sv-fs1.looksmart.com or ( $ua eq 'Mozilla/4.08 [en] (Win98; I ;Nav)' or $ua =~ /^[a-zA-Z0-9 ]{19,}$/ and not $ref1 ) and $al and $al eq 'en' and not $ac ) or not $ref1 and $al and ( $al eq '*' and $ac and $ac eq 'iso-8859-1,*' or $al eq 'en' and not $ac and $ref2 =~ m{^http://} ) or $ref1 and ( $ref1 =~ /^[^?]*(?:addresses|sexpicsland|wmexp|webdevboard|devaddict|slavik|sex3k)\.com/i or $ref2 =~ m{^/guestbook/sign/} and $ref1 =~ m{^http://}i and $ref1 !~ /^[^?]+(?:$AllDomains|google\.|(?:yandex|aport|rambler)\.ru)/i or $ref1 eq 'http://www.google.com' and ref2 =~ m{http://} or $ref1 =~ /[^:]200[4-9]/ and $ref1 =~ /\?.*(?:contact|guestbook|mail[^=]|address)/i or $ref1 =~ /\?.*guestbook/i and $ref1 =~ /\?.*sign/i or $ref1 =~ m{^file:///} and not $al and not $ac ) or not ( $ua and $ua !~ m{^Mozilla/4\.0(?:\Q5 [en] (X11; I; Linux 2.0.36 i686)\E)?$} and $ua ne 'Mozilla/4.5 [en] (Win98; I)' and $ua ne 'Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)' and $ua ne 'Mozilla/3.0 (Windows 98; U) Opera 7.21 [en]' and $ua !~ / NT;\)$/ and $ua !~ /; AOL 9\.0; / and $ra !~ /$shra/o or $ref1 and $ref1 !~ m{^http://forum\.\w+\.biz/\?\w+&viewtopic=\d+$} or $al and $al ne 'en' or $ac or $ra eq '216.248.35.2' or $ra eq '150.26.230.168' or $ra eq '193.85.1.16' or $ra eq '217.20.163.17' or $ra eq '184.73.181.26'); } foreach my $banned_IP_alias ( @banned_IPs ) { my $banned_IP = $banned_IP_alias; $banned_IP =~ s/\./\\./g; $_ = $denyIP, $denyIP = '' if $ra =~ /^$banned_IP/; } s/\@/()/g if $ua and $ua =~ /googlebot/i; # some spammers harvest email # addresses by spidering Google search results and thus cached pages if ( $lat ) { # 8 9 A B C D E F # 01 2 34 56789A B CDEF012345679ABCDEF01 2 4 5 6 7 89AB C D EF01245678 9 A BCDE123456789ABCDEF02345789ACF123456789ABCDEF02345789ACF tr/\x80-\x97\x99-\xA2\xA4-\xB2\xB4-\xBE\xC1-\xD0\xD2-\xD5\xD7-\xDA\xDC\xDF\xE1-\xF0\xF2-\xF5\xF7-\xFA\xFC\xFF/\-|\/\\L\-++T++\-\-#||###?|Xv=> ?o2.+=|\/\/\/\\\\\\LLL\-\-\-||||||TTT\-\-\-+++abcdefghijklmnoprstuv'yze'ABCDEFGHIJKLMNOPRSTUV'YZE'/; # ─│ ┌ ┐└ ┘├┤┬┴┼ ▀ ▄█▌▐░▒▓⌠■·√≈≥©⌡°²∙÷═║ ╒ ╓ ╔ ╕ ╖ ╗╘╙╚ ╛ ╜ ╝╞╟╠╡╢╣╤╥╦ ╧ ╨ ╩╪╫╬ s/\x98/>/g; s/\xA3/jo/g; s/\xB3/JO/g; s/\xBF/(c)/g; s/\xC0/ju/g; s/\xD1/ja/g; s/\xD6/zh/g; s/\xDB/sh/g; s/\xDD/sch/g; s/\xDE/ch/g; s/\xE0/JU/g; s/\xF1/JA/g; s/\xF6/ZH/g; s/\xFB/SH/g; s/\xFD/SCH/g; s/\xFE/CH/g; } elsif ( $win ) { s/\x98/</g; tr/\x80-\x97\x99-\xFF/\-|Ц╛L\-++T++\-\-#||###?|∙v=>═?╟2╥+=|Ц╦ЦЦ╛╛╛LLL\-\-\-||||╗||TTT\-\-\-+++╘ЧЮАЖДЕТЦУХИЙКЛМНО\xFFПЯРСФБЭШГЬЩЫВЗчюаждетцухийклмноъпярсфбэшгьщывз/; } print; } sub tracker { return unless $not_watchdog; close STDOUT; # give page to browser, the rest is imperceptible for visitor ( $sec, $min, $hour, $mday, $mon, $year ) = gmtime; $date = sprintf '%02d%02d%02d', $year - 100, $mon + 1, $mday; $time = sprintf '%02d%02d%02d', $hour, $min, $sec; @ips = (); push @ips, $_ if defined( $_ = $ENV{'HTTP_CLIENT_IP'} ); push @ips, split /[ ,]+/ if defined( $_ = $ENV{'HTTP_X_FORWARDED_FOR'} ); push @ips, $_ if defined( $_ = $ENV{'REMOTE_ADDR'} ) and $_ ne $localproxy; foreach ( @ips ) { if ( /^(?:\d{1,3}\.){3}\d{1,3}$/ and defined( $IPpacked = Socket::inet_aton( $_ ))) { $IP = $_; if ( defined( $hostname = gethostbyaddr( $IPpacked, AF_INET )) and $hostname =~ /\.[a-zA-Z]/ ) { my $bad = 0; foreach my $hostname_IP_needed ( @hostnames_IP_needed ) { $bad = 1 if $hostname =~ /\Q$hostname_IP_needed/; } if ( $bad or not $deny or not denyIP or $hostname =~ /\.(?:ng|ci|gh|bj|bf)$/i or $hostname =~ /unused|unknown|unassign|unlabel|reserve|nonexist|unalloc|unspecif/i ) { $_ = $hostname . "[$_]"; } else { $_ = $hostname; } } &country( $IP ) unless /\.[a-zA-Z]{2}(?:\[.+)?$/ and not /\.(?:su|yu|tv|bz)(?:\[.+)?$/i; if ( defined( $hostname ) and $hostname eq 'krok.edu.ua' ) { if ( open( OUT, "|/usr/sbin/sendmail -t -i -odb -oem -fLena\@lena.kiev.ua" )) { print OUT "From: Lena\@lena.kiev.ua\nTo: leksen\@sms.umc.ua\n", "Subject: $time(GMT) ", join( '/', @ips ), "\n\n$host$ref2"; $! = 0; # to clear indicator of possible past error ##### if ( not close OUT and $! ) { warn "error closing pipe to sendmail: $!\n"; } } else { warn "can't open pipe to sendmail: $!\n"; } } } } $ref1 = '-' unless defined $ref1; foreach ( $ref1, $ref2, @ips ) { tr/+/ /; s/%([a-fA-F0-9]{2})/ pack( 'C', hex( $1 )) /eg; s/%([a-fA-F0-9]{2})/ pack( 'C', hex( $1 )) /eg; # some refs encoded twice s/([\x00-\x1F\x7F\x9A\xFF])/ sprintf '%%%02X', ord( $1 ) /eg; s/ /$blank/og; } if ( chdir( "$root/tracker" )) { if ( open( LOG, ">>$date" ) and flock( LOG, 2 )) { seek( LOG, 0, 2 ); # in case someone appended while we were waiting print LOG "$date$time ", join( '/', @ips ), $deny && $denyIP ? '' : '#', " $ref1 ", $host =~ $ParkedDomains ? $host : '', $ref2, defined( $al ) ? " $al" : '', defined( $ac ) ? " $ac" : '', defined( $ua ) ? " $ua" : '', "\n"; close LOG; } if ( opendir( DIR, '.' )) { foreach ( readdir DIR ) { unless ( $_ eq $date or /^\./ ) { if ( open( IN, $_ ) and # STDOUT was closed, so this file gets # same number of file descriptor as usually # STDOUT, it causes incorrect warning # "Filehandle STDOUT opened only for input" # or "Filehandle STDOUT reopened as IN only # for input" flock( IN, 2 )) { # exclusive if ( -e ) { # file wasn't deleted while we were waiting if ( open( OUT, "|$sendmail" )) { print OUT "From: $from\nTo: $to\n", "Subject: Website statistics $_\n\n"; while ( defined( $line = )) { print OUT $line; } $! = 0; # to clear indicator of possible past error if ( not close OUT and $! ) { warn "error closing pipe to sendmail: $!\n"; } else { unlink; } } else { warn "can't open pipe to sendmail: $!\n"; } } close IN; } last; # only one letter per call } } closedir DIR; } } } sub country { my @list = # from ftp://ftp.ripe.net/iso3166-countrycodes.txt and # http://www.crwflags.com/fotw/flags/iso3166.html 20Jan2003 qw(840 US 643 RU 804 UA 826 GB 4 AF 8 AL 12 DZ 16 AS 20 AD 24 AO 660 AI 10 AQ 28 AG 32 AR 51 AM 533 AW 36 AU 40 AT 31 AZ 44 BS 48 BH 50 BD 52 BB 112 BY 56 BE 84 BZ 204 BJ 60 BM 64 BT 68 BO 70 BA 72 BW 74 BV 76 BR 86 IO 96 BN 100 BG 854 BF 108 BI 116 KH 120 CM 124 CA 132 CV 136 KY 140 CF 148 TD 152 CL 156 CN 162 CX 166 CC 170 CO 174 KM 178 CG 180 CD 184 CK 188 CR 384 CI 191 HR 192 CU 196 CY 203 CZ 208 DK 262 DJ 212 DM 214 DO 626 TP 218 EC 818 EG 222 SV 226 GQ 232 ER 233 EE 231 ET 238 FK 234 FO 242 FJ 246 FI 250 FR 254 GF 258 PF 260 TF 266 GA 270 GM 268 GE 276 DE 288 GH 292 GI 300 GR 304 GL 308 GD 312 GP 316 GU 320 GT 324 GN 624 GW 328 GY 332 HT 334 HM 336 VA 340 HN 344 HK 348 HU 352 IS 356 IN 360 ID 364 IR 368 IQ 372 IE 376 IL 380 IT 388 JM 392 JP 400 JO 398 KZ 404 KE 296 KI 408 KP 410 KR 414 KW 417 KG 418 LA 428 LV 422 LB 426 LS 430 LR 434 LY 438 LI 440 LT 442 LU 446 MO 807 MK 450 MG 454 MW 458 MY 462 MV 466 ML 470 MT 584 MH 474 MQ 478 MR 480 MU 175 YT 484 MX 583 FM 498 MD 492 MC 496 MN 500 MS 504 MA 508 MZ 104 MM 516 NA 520 NR 524 NP 528 NL 530 AN 540 NC 554 NZ 558 NI 562 NE 566 NG 570 NU 574 NF 580 MP 578 NO 512 OM 586 PK 585 PW 275 PS 591 PA 598 PG 600 PY 604 PE 608 PH 612 PN 616 PL 620 PT 630 PR 634 QA 638 RE 642 RO 646 RW 654 SH 659 KN 662 LC 666 PM 670 VC 882 WS 674 SM 678 ST 682 SA 686 SN 690 SC 694 SL 702 SG 703 SK 705 SI 90 SB 706 SO 710 ZA 239 GS 724 ES 144 LK 736 SD 740 SR 744 SJ 748 SZ 752 SE 756 CH 760 SY 158 TW 762 TJ 834 TZ 764 TH 768 TG 772 TK 776 TO 780 TT 788 TN 792 TR 795 TM 796 TC 798 TV 800 UG 784 AE 581 UM 858 UY 860 UZ 548 VU 862 VE 704 VN 92 VG 850 VI 876 WF 732 EH 887 YE 891 YU 894 ZM 716 ZW 200 CS 278 DD 582 PC 810 SU 65281 EU); my( $a, $b, $c, $d ) = split /\./, $_[0]; if ( defined( my $ippacked = gethostbyname( "$d.$c.$b.$a.zz.countries.nerd.dk" ))) { my( $mustbe127, $n ) = unpack( 'vn', $ippacked ); if ( $mustbe127 == 127 ) { for ( my $i = 0; $i < $#list; $i += 2 ) { if ( $n == $list[$i] ) { $_ .= "*$list[$i+1]"; return; } } $_ .= "*$n"; } } }