Block TOR Servers

apache, centos, module, php, tor

Solution

Here is more information about TorDNSEL https://www.torproject.org/projects/tordnsel.html.en and how to structure query.

And below is function I found on the net that can perform dynamic checks.

( https://check.torproject.org/ must use something similar to this ).

I am not sure about performance under heavier traffic.

function IsTorExitPoint(){
if (gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']).".".$_SERVER['SERVER_PORT'].".".ReverseIPOctets($_SERVER['SERVER_ADDR']).".ip-port.exitlist.torproject.org")=="127.0.0.2") {
return true;
} else {
return false;
} 
}
function ReverseIPOctets($inputip){
$ipoc = explode(".",$inputip);
return $ipoc[3].".".$ipoc[2].".".$ipoc[1].".".$ipoc[0];
}

Problem

I need a script that blocks `TOR servers` in `php` ... I need to get the list of servers and block them. Or, any solution to install on the server (centos).

Original source