[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: How to remove some useless nodes

On Jan 27, 2008 11:08 AM, Kraktus <kraktus@xxxxxxxxxxxxxx> wrote:
> You can add
> ExcludeNodes NodeName1, NodeName2
> to your torrc, where the NodeName1, etc. are the names of Chinese exit
> nodes that you are aware of.  However, you much disallow each Chinese
> node separately; you can't exclude by country.
A crude approach would be to write a script that checks
[vidalia-config-directory]\geoip-cache for IP addresses located in
China, and then extract fingerprints of the Tor nodes on those IPs
from [tor-config-directory]\cached-descriptors to build up your
"ExcludeNodes" list.

The enclosed perl script does just this. It should be self-explanatory
enough. It produces one "ExcludeNodes" line to be included in your
torrc file.

Instead of the geoip-cache file, you can also use country IP blocks
from www.ipdeny.com to match IP to country.

Yet another alternative using public tor status pages was discussed on
this list:


# Usage
if (@ARGV != 3) {
  print "Usage: $ENV{'_'} [2-letter-country-code] [descriptors-file] [geoip-file] \n";

$ARGV[0] = uc($ARGV[0]);

# Build ip-to-country hash table from geoip cache
while (<GEOIP>) {
  ($ip,undef,undef,$country,undef) = split(/,/);
  $geoip{$ip} = $country;

# Parse descriptor file and extract fingerprints
$switch = false;
while (<DESC>) {
  @params = split(/ /);
  if ($params[0] eq 'router') {
    $switch = $geoip{$params[2]} eq $ARGV[0];
  } elsif ($switch && $params[0] eq 'opt' && $params[1] eq 'fingerprint') {
    push(@exclude,'$' . join('',@params[2 .. $#params]));
print 'ExcludeNodes ',join(',',@exclude),"\n";