Getting a List of Tor server Nodes in perl

In 2008, I wrote a module in perl called Net::Tor::servers (which can be found in CPAN). Below is the code (albeit not as complicated as the module) which will get a list of Tor servers into an array called @torarray.

One use of this module is a script I wrote which adds all the Tor servers into an IP blacklist on Smoothwall firewalls. I used to run the community version at home last year but got rid of it when the box died.
The script can be found here:
http://www.cpan.org/modules/by-authors/id/A/AJ/AJDIXON/torblacklister.pl

The code is thus:

#/usr/bin/perl
use LWP::Simple
my @torarray=();
my @arrayrecord=();
my $router;
my @rarray;
my $torserver = "128.31.0.34";
my $port = 9031;
my $content = get("http://$torserver:$port/tor/status/all");
my @lines = split(/\n/,$content);

foreach $router (@lines) {
@rarray = split(/\ /,$router);
if($rarray[0] =~ /^r$/) {
my $ip=$rarray[6];
my $hostname=$rarray[1];
my $orport = $rarray[7];
my $dirrepport = $rarray[8];
@torarray = (@torarray,[$ip,$hostname,$orport,$dirrepport]);
}
}

Updated: oops, forgot the use clause…

Dynamically update Smoothwall to block the Tor Network

I wrote a script a while back in perl to update a smoothwall system to query the Tor network and block access to all the machines which act as relay nodes to their anonymity network – if you dont know what Tor is, it creates an encrypted connection between a users’ computer and one of many many nodes, which then provides the user with access (albeit slow) to an uncensored internet, and stay nearly 100% anonymous.

I wrote this script using a copy of smoothwall on a development VM. I dont have the VM, let alone a newer copy of smoothwall, but as of December 2008 it works, and I have just got around to adding this script to my site. In theory, it should work the same. Let me know if it doesnt..

The script can be found here:
ftp://ftp.perl.org/pub/CPAN/authors/id/A/AJ/AJDIXON/torblacklister.pl
Download it onto the smoothie box, chmod it to 700, and run it. Add it to cron for full effect..!