[or-cvs] r14744: (ticket:80) Adding TorDNSEL checking to TorStatus (torstatus/trunk/web)

kasimir at seul.org kasimir at seul.org
Tue May 27 02:45:18 UTC 2008


Author: kasimir
Date: 2008-05-26 22:45:18 -0400 (Mon, 26 May 2008)
New Revision: 14744

Modified:
   torstatus/trunk/web/config_template.php
   torstatus/trunk/web/index.php
Log:
(ticket:80) Adding TorDNSEL checking to TorStatus

Modified: torstatus/trunk/web/config_template.php
===================================================================
--- torstatus/trunk/web/config_template.php	2008-05-27 01:27:15 UTC (rev 14743)
+++ torstatus/trunk/web/config_template.php	2008-05-27 02:45:18 UTC (rev 14744)
@@ -49,6 +49,9 @@
 $GEOIP_Database_Path = "geoip/";
 $PHP_Path = "/usr/bin/";
 $TNS_Path = "/home/torstatus-kgprog-com/project/trunk/";
+
+$UseTorDNSEL = 1;
+
 // Comment the following line if you do not provide a WHOIS service
 define("WHOISPath","/whois.php?ip=");
 // If you want to provide a bandwidth history, uncomment the following line

Modified: torstatus/trunk/web/index.php
===================================================================
--- torstatus/trunk/web/index.php	2008-05-27 01:27:15 UTC (rev 14743)
+++ torstatus/trunk/web/index.php	2008-05-27 02:45:18 UTC (rev 14744)
@@ -1390,6 +1390,20 @@
 $Hostname = $record['Hostname'];
 $CountryCode = $record['CountryCode'];
 
+// Either use TorDNSEL or an internal search
+if ($UseTorDNSEL == 1)
+{
+	$QueryRemoteIP = implode(".",array_reverse(explode(".",$RemoteIP)));
+	$QueryServerIP = implode(".",array_reverse(explode(".",$ServerIP)));
+	$tordnsel = gethostbyname($QueryRemoteIP . "." . $ServerPort . "." . $QueryServerIP . ".ip-port.exitlist.torproject.org");
+	if ($tordnsel == "127.0.0.2")
+	{
+		// A positive match was given
+		$PositiveMatch_IP = 1;
+	}
+}
+else
+{
 // Determine if client IP exists in database as a Tor server
 $query = "select count(*) as Count from $ActiveNetworkStatusTable where IP = '$RemoteIP'";
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
@@ -1401,6 +1415,7 @@
 {
 	$PositiveMatch_IP = 1;	
 }
+}
 
 // Get name, fingerprint, and exit policy of Tor node(s) if match was found, look for match in ExitPolicy
 if ($PositiveMatch_IP == 1)



More information about the tor-commits mailing list