|
24 | 24 | // Third is the server port
|
25 | 25 | // Fourth is the DNS server to query
|
26 | 26 | $lookups = array(
|
27 |
| - array('208.111.35.21', '1.2.3.4', 80, 'exitlist.torproject.org'), |
28 |
| - array('208.111.35.21', '1.2.3.4', 80, '8.8.8.8'), |
29 |
| - array('208.113.166.5', '1.2.3.4', 80, 'exitlist.torproject.org'), |
30 |
| - array('208.113.166.5', '1.2.3.4', 80, 'exitlist.torproject.org'), |
31 |
| - array('197.231.221.211', '1.2.3.4', 80, 'exitlist.torproject.org'), |
32 |
| - array('208.111.35.21', '1.2.3.4', 80, '10.11.12.13'), // should time out |
| 27 | + array('195.176.3.20', 'check-01.torproject.org'), /* DigiGesTor4e3 */ |
| 28 | + array('185.220.103.4', '1.1.1.1'), /* CalyxInstitute16 */ |
| 29 | + array('185.220.103.4', '9.9.9.9'), /* CalyxInstitute16 */ |
| 30 | + array('185.220.101.220', 'check-01.torproject.org'), /* niftyguard */ |
| 31 | + array('89.34.27.59', 'check-01.torproject.org'), /* Hydra2 */ |
| 32 | + array('104.215.148.63', 'check-01.torproject.org'), /* not a relay */ |
| 33 | + array('208.111.35.21', '10.11.12.13'), // should time out |
33 | 34 | );
|
34 | 35 |
|
35 | 36 | foreach($lookups as $lookup) {
|
36 |
| - list($remoteIP, $myIp, $myPort, $server) = $lookup; |
| 37 | + list($remoteIP, $server) = $lookup; |
37 | 38 |
|
38 | 39 | try {
|
39 | 40 | // send DNS request to Tor DNS exit list service
|
40 |
| - // returns true if $remoteIP is a Tor exit node that permits connections to $myIp:$myPort |
41 |
| - $isTor = TorDNSEL::IpPort($myIp, $myPort, $remoteIP, $server); |
| 41 | + // returns true if $remoteIP is a Tor exit relay |
| 42 | + $isTor = TorDNSEL::IpPort(null, null, $remoteIP, $server); |
42 | 43 |
|
43 |
| - echo sprintf("Connection to %s:%d from %s *%s* coming from a Tor exit node.\n", |
44 |
| - $myIp, $myPort, $remoteIP, ($isTor ? 'is' : 'is NOT')); |
| 44 | + echo sprintf("Connection from %s *%s* a Tor exit relay.\n", |
| 45 | + $remoteIP, ($isTor ? 'is' : 'is NOT')); |
45 | 46 | } catch (\Exception $ex) {
|
46 |
| - echo sprintf("Lookup of %s:%s for %s failed with error '%s'\n", |
47 |
| - $myIp, $myPort, $remoteIP, $ex->getMessage()); |
| 47 | + echo sprintf("Query for %s failed. Error: %s\n", |
| 48 | + $remoteIP, $ex->getMessage()); |
48 | 49 | }
|
49 | 50 | }
|
0 commit comments