[or-cvs] r14810: I wanted to clearly and formally kill the perl script but I (check/trunk/cgi-bin)

ioerror at seul.org ioerror at seul.org
Thu May 29 09:46:19 UTC 2008


Author: ioerror
Date: 2008-05-29 05:46:18 -0400 (Thu, 29 May 2008)
New Revision: 14810

Added:
   check/trunk/cgi-bin/TorCheck.pl
Removed:
   check/trunk/cgi-bin/index.pl
Log:
I wanted to clearly and formally kill the perl script but I decided to just rename it and leave it. Hopefully no one ever uses this for anything important.


Copied: check/trunk/cgi-bin/TorCheck.pl (from rev 14739, check/trunk/cgi-bin/index.pl)
===================================================================
--- check/trunk/cgi-bin/TorCheck.pl	                        (rev 0)
+++ check/trunk/cgi-bin/TorCheck.pl	2008-05-29 09:46:18 UTC (rev 14810)
@@ -0,0 +1,157 @@
+#!/usr/bin/perl
+#
+# This software was released into the public domain as of 06-21-07 at PET 2007.
+#
+# tor-detector.pl
+# A small CGI script to check if a user is routing through Tor.
+# by Jacob Appelbaum <jacob at appelbaum.net>
+#
+# This requires Net::DNS <http://www.net-dns.org/>
+# 
+# To make a mirror of this you should follow these steps:
+# 1. Get a copy of this script (and the Vadila images for good measure)
+# 2. Configure apache (see the sample below)
+# 3. Place the copy of the program in the apache cgi-bin directory
+# 4. Test it. 
+# 5. Tell people about it.
+# 6. Come to PET and learn fun stuff.
+#
+# Configure with apache like so:
+#<VirtualHost *:80>
+#        ServerAdmin tordnsel at torproject.org
+#        ServerName check.torproject.org
+#
+#        DocumentRoot /var/www/tor-detector/
+#
+#        ScriptAlias /cgi-bin/ /var/www/tor-detector/cgi-bin/
+#
+#        <Directory "/var/www/tor-detector/">
+#                DirectoryIndex /cgi-bin/index.pl
+#                AllowOverride None
+#                Options Indexes -MultiViews +SymLinksIfOwnerMatch
+#                Order allow,deny
+#                Allow from all
+#        </Directory>
+#
+#        ServerSignature Off
+#
+#</VirtualHost>
+#
+
+use strict;
+use warnings;
+use Net::DNS::Resolver;
+use CGI ':standard';
+
+# The client in question
+my $srcip = remote_host();
+
+# Exit check to check.torproject.org or your exit checking website
+my $dstip = "209.237.247.217";
+my $dstport = 80;
+
+# The DNSEL server to query
+my $dnsel = "exitlist.torproject.org";
+
+$| = 1;
+
+# Construct our DNSEL query 
+# It consists of: a source address, a destination address, a destination port and a DNSEL server.
+# IP addresses should be in dotted-decimal notation.
+sub build_query {
+  my ($srcip, $dstip, $dstport, $dnsel) = @_;
+  ($srcip, $dstip) = map { join '.', reverse split /\./ } $srcip, $dstip;
+  "$srcip.$dstport.$dstip.ip-port.$dnsel.";
+}
+
+# query_exitlist($srcip, $dstip, $dstport, $dnsel) queries the Tor DNS Exit List server.
+#   The result of the query is one of the following:
+#     undef : DNS lookup failed or an unexpected response was received.
+#         0 : $srcip does not appear to be a Tor exit.
+#         1 : $srcip is a known Tor exit for the provided destination IP / port.
+sub query_exitlist {
+  my ($srcip, $dstip, $dstport, $dnsel) = @_;
+
+  # Create our resolver and talk to the DNSEL directly.
+  my $res = Net::DNS::Resolver->new;
+  $res->nameservers("$dnsel");
+  $res->retrans(2);
+  $res->retry(3);
+  $res->usevc(0);
+
+  # Rewrite this to make it clear
+  # Perform our DNS query
+  if (defined(my $pkt = $res->send(build_query $srcip, $dstip, $dstport, $dnsel))) {
+    if (grep $_->type eq 'A', $pkt->answer) {
+      # an A record was returned: this is a Tor exit node
+      return 1;
+    } elsif ($pkt->header->rcode eq 'NXDOMAIN') {
+      # NXDOMAIN: this is not a Tor exit node
+      return 0;
+    }
+  }
+
+  # the DNS query failed or something unexpected was returned
+  return undef;
+}
+
+# Finally, ask the DNSEL about our client 
+my $result = query_exitlist $srcip, $dstip, $dstport, $dnsel;
+
+# Lets make a pretty website for our clients
+print header(-charset=>'UTF-8');
+print start_html('Are you using Tor?');
+print "<center>\n";
+
+if ($result) {
+  print "<img src='https://check.torproject.org/tor-on.png'>\n<br>";
+  print "<h1 style='color: #0A0'>";
+  print "Congratulations. You are using Tor.<br><br>";
+  print 'ﻡژﺪﻫ. ﺶﻣﺍ (ﺎﺤﺘﻣﺍﻻ) ﺩﺭ ﺡﺎﻟ ﺎﺴﺘﻓﺍﺪﻫ ﺍﺯ ﺕُﺭ ﻡی ﺏﺎﺷیﺩ.';
+  print "<br><br>";
+  print "</h1>";
+  print "Please refer to the <a href='https://www.torproject.org/'>Tor website</a> for further information about using Tor safely.<br><br>";
+  print "خواهشمند است مراجعه کنید به <a href='https://www.torproject.org/'>وب سایت تُر</a>  برای اطلاعات بیشتر درمورد استفاده ایمن از تُر<br><br>";
+
+} elsif (defined $result) {
+
+  print "<img src='https://check.torproject.org/tor-off.png'>\n<br>";
+  print "<h1 style='color: #A00'>";
+  print "Sorry. You are not using Tor.\n<br><br>";
+  print "پوزش. شما (احتمالا) در حال استفاده از تُر نمی باشید.\n<br><br>";
+  print "</h1>";
+  print "If you are attempting to use a Tor client, please refer to the <a href='https://www.torproject.org/'>Tor website</a> and specifically the <a href='https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#ItDoesntWork'>instructions for configuring your Tor client</a>.<br><br>";
+  print 'ﺍگﺭ ﺲﻋی ﺩﺭ ﺎﺴﺘﻓﺍﺪﻫ ﺍﺯ یک کﺍﺮﺧﻭﺎﻫ ﺕُﺭ ﺭﺍ ﺩﺍﺭیﺩ, ﺥﻭﺎﻬﺸﻤﻧﺩ ﺎﺴﺗ ﻡﺭﺎﺠﻌﻫ کﻥیﺩ ﺐﻫ ';
+  print "<a href='https://www.torproject.org/'>";
+  print 'ﻮﺑ ﺱﺍیﺕ ﺕُﺭ';
+  print '</a> ';
+  print 'و بویژه ';
+  print "<a href='https://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#ItDoesntWork'>";
+  print 'ﺪﺴﺗﻭﺭﺎﺗ ﺏﺭﺍی پیکﺮﺒﻧﺩی کﺍﺮﺧﻭﺎﻫ ﺕُﺭ.';
+  print "</a><br><br>";
+
+} else {
+
+  print "<img src='https://check.torproject.org/tor-off.png'>\n<br>";
+  print "Sorry, your query failed or an unexpected response was received.\n<br><br>";
+  print "A temporary service outage prevents us from determining if your source IP address is a <a href='https://www.torproject.org/'>Tor</a> node.  For other ways to test whether you are using Tor, please visit <a href='https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#IsMyConnectionPrivate'>this FAQ entry</a>.<br><br>";
+}
+  print "<br>\n";
+  print "<small>\n";
+  print "<p><tt>";
+  print "Additional information:<br>\n";
+  print "اطلاعات تکمیلی:<br>\n";
+  print "Your IP appears to be: <b>$srcip</b><br>\n";
+  print "آدرس آی پی شما: <b>$srcip</b><br>\n";
+  print "This small script is powered by <a href='http://exitlist.torproject.org/'>tordnsel</a><br><br>";
+  print "این دست‌نوشته کوچک ارائه می شود بوسیله <a href='http://exitlist.torproject.org/'>tordnsel</a><br><br>";
+  print "This server does not log <i>any</i> information about visitors.<br>";
+  print "این پیشکار هیچ اطلاعاتی درمورد کاربران مهمان را ثبت نمی کند.<br>";
+  print "</tt></p>";
+
+  print "</small>\n";
+  print "</center>\n";
+  print end_html();
+
+exit 0;
+

Deleted: check/trunk/cgi-bin/index.pl
===================================================================
--- check/trunk/cgi-bin/index.pl	2008-05-29 09:45:33 UTC (rev 14809)
+++ check/trunk/cgi-bin/index.pl	2008-05-29 09:46:18 UTC (rev 14810)
@@ -1,157 +0,0 @@
-#!/usr/bin/perl
-#
-# This software was released into the public domain as of 06-21-07 at PET 2007.
-#
-# tor-detector.pl
-# A small CGI script to check if a user is routing through Tor.
-# by Jacob Appelbaum <jacob at appelbaum.net>
-#
-# This requires Net::DNS <http://www.net-dns.org/>
-# 
-# To make a mirror of this you should follow these steps:
-# 1. Get a copy of this script (and the Vadila images for good measure)
-# 2. Configure apache (see the sample below)
-# 3. Place the copy of the program in the apache cgi-bin directory
-# 4. Test it. 
-# 5. Tell people about it.
-# 6. Come to PET and learn fun stuff.
-#
-# Configure with apache like so:
-#<VirtualHost *:80>
-#        ServerAdmin tordnsel at torproject.org
-#        ServerName check.torproject.org
-#
-#        DocumentRoot /var/www/tor-detector/
-#
-#        ScriptAlias /cgi-bin/ /var/www/tor-detector/cgi-bin/
-#
-#        <Directory "/var/www/tor-detector/">
-#                DirectoryIndex /cgi-bin/index.pl
-#                AllowOverride None
-#                Options Indexes -MultiViews +SymLinksIfOwnerMatch
-#                Order allow,deny
-#                Allow from all
-#        </Directory>
-#
-#        ServerSignature Off
-#
-#</VirtualHost>
-#
-
-use strict;
-use warnings;
-use Net::DNS::Resolver;
-use CGI ':standard';
-
-# The client in question
-my $srcip = remote_host();
-
-# Exit check to check.torproject.org or your exit checking website
-my $dstip = "209.237.247.217";
-my $dstport = 80;
-
-# The DNSEL server to query
-my $dnsel = "exitlist.torproject.org";
-
-$| = 1;
-
-# Construct our DNSEL query 
-# It consists of: a source address, a destination address, a destination port and a DNSEL server.
-# IP addresses should be in dotted-decimal notation.
-sub build_query {
-  my ($srcip, $dstip, $dstport, $dnsel) = @_;
-  ($srcip, $dstip) = map { join '.', reverse split /\./ } $srcip, $dstip;
-  "$srcip.$dstport.$dstip.ip-port.$dnsel.";
-}
-
-# query_exitlist($srcip, $dstip, $dstport, $dnsel) queries the Tor DNS Exit List server.
-#   The result of the query is one of the following:
-#     undef : DNS lookup failed or an unexpected response was received.
-#         0 : $srcip does not appear to be a Tor exit.
-#         1 : $srcip is a known Tor exit for the provided destination IP / port.
-sub query_exitlist {
-  my ($srcip, $dstip, $dstport, $dnsel) = @_;
-
-  # Create our resolver and talk to the DNSEL directly.
-  my $res = Net::DNS::Resolver->new;
-  $res->nameservers("$dnsel");
-  $res->retrans(2);
-  $res->retry(3);
-  $res->usevc(0);
-
-  # Rewrite this to make it clear
-  # Perform our DNS query
-  if (defined(my $pkt = $res->send(build_query $srcip, $dstip, $dstport, $dnsel))) {
-    if (grep $_->type eq 'A', $pkt->answer) {
-      # an A record was returned: this is a Tor exit node
-      return 1;
-    } elsif ($pkt->header->rcode eq 'NXDOMAIN') {
-      # NXDOMAIN: this is not a Tor exit node
-      return 0;
-    }
-  }
-
-  # the DNS query failed or something unexpected was returned
-  return undef;
-}
-
-# Finally, ask the DNSEL about our client 
-my $result = query_exitlist $srcip, $dstip, $dstport, $dnsel;
-
-# Lets make a pretty website for our clients
-print header(-charset=>'UTF-8');
-print start_html('Are you using Tor?');
-print "<center>\n";
-
-if ($result) {
-  print "<img src='https://check.torproject.org/tor-on.png'>\n<br>";
-  print "<h1 style='color: #0A0'>";
-  print "Congratulations. You are using Tor.<br><br>";
-  print 'ﻡژﺪﻫ. ﺶﻣﺍ (ﺎﺤﺘﻣﺍﻻ) ﺩﺭ ﺡﺎﻟ ﺎﺴﺘﻓﺍﺪﻫ ﺍﺯ ﺕُﺭ ﻡی ﺏﺎﺷیﺩ.';
-  print "<br><br>";
-  print "</h1>";
-  print "Please refer to the <a href='https://www.torproject.org/'>Tor website</a> for further information about using Tor safely.<br><br>";
-  print "خواهشمند است مراجعه کنید به <a href='https://www.torproject.org/'>وب سایت تُر</a>  برای اطلاعات بیشتر درمورد استفاده ایمن از تُر<br><br>";
-
-} elsif (defined $result) {
-
-  print "<img src='https://check.torproject.org/tor-off.png'>\n<br>";
-  print "<h1 style='color: #A00'>";
-  print "Sorry. You are not using Tor.\n<br><br>";
-  print "پوزش. شما (احتمالا) در حال استفاده از تُر نمی باشید.\n<br><br>";
-  print "</h1>";
-  print "If you are attempting to use a Tor client, please refer to the <a href='https://www.torproject.org/'>Tor website</a> and specifically the <a href='https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#ItDoesntWork'>instructions for configuring your Tor client</a>.<br><br>";
-  print 'ﺍگﺭ ﺲﻋی ﺩﺭ ﺎﺴﺘﻓﺍﺪﻫ ﺍﺯ یک کﺍﺮﺧﻭﺎﻫ ﺕُﺭ ﺭﺍ ﺩﺍﺭیﺩ, ﺥﻭﺎﻬﺸﻤﻧﺩ ﺎﺴﺗ ﻡﺭﺎﺠﻌﻫ کﻥیﺩ ﺐﻫ ';
-  print "<a href='https://www.torproject.org/'>";
-  print 'ﻮﺑ ﺱﺍیﺕ ﺕُﺭ';
-  print '</a> ';
-  print 'و بویژه ';
-  print "<a href='https://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#ItDoesntWork'>";
-  print 'ﺪﺴﺗﻭﺭﺎﺗ ﺏﺭﺍی پیکﺮﺒﻧﺩی کﺍﺮﺧﻭﺎﻫ ﺕُﺭ.';
-  print "</a><br><br>";
-
-} else {
-
-  print "<img src='https://check.torproject.org/tor-off.png'>\n<br>";
-  print "Sorry, your query failed or an unexpected response was received.\n<br><br>";
-  print "A temporary service outage prevents us from determining if your source IP address is a <a href='https://www.torproject.org/'>Tor</a> node.  For other ways to test whether you are using Tor, please visit <a href='https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#IsMyConnectionPrivate'>this FAQ entry</a>.<br><br>";
-}
-  print "<br>\n";
-  print "<small>\n";
-  print "<p><tt>";
-  print "Additional information:<br>\n";
-  print "اطلاعات تکمیلی:<br>\n";
-  print "Your IP appears to be: <b>$srcip</b><br>\n";
-  print "آدرس آی پی شما: <b>$srcip</b><br>\n";
-  print "This small script is powered by <a href='http://exitlist.torproject.org/'>tordnsel</a><br><br>";
-  print "این دست‌نوشته کوچک ارائه می شود بوسیله <a href='http://exitlist.torproject.org/'>tordnsel</a><br><br>";
-  print "This server does not log <i>any</i> information about visitors.<br>";
-  print "این پیشکار هیچ اطلاعاتی درمورد کاربران مهمان را ثبت نمی کند.<br>";
-  print "</tt></p>";
-
-  print "</small>\n";
-  print "</center>\n";
-  print end_html();
-
-exit 0;
-



More information about the tor-commits mailing list