# # RBN Filter / Server # See http://fkurz.net/ham/stuff.html?rbnfilter # By Fabian Kurz, DJ1YFK # fabian@fkurz.net # 2012-10-22 # # Code is in the public domain. use strict; use warnings; use Net::Telnet (); use Date::Format; $| = 1; my %callhash; my %callcount; my $line; loadcalls(); open SPOTDUMP, ">/tmp/spots.txt"; $| = 1; my @lines; print "rbn: trying to connect....\n"; my $t = new Net::Telnet (Timeout => 10, Port => 7000, Prompt => '/./'); $t->open("arcluster.reversebeacon.net"); $t->print("my0call\n"); $t->print("set/nobell\n"); my $memberssize = -s "members.txt"; loadcalls(); while (1) { $line = $t->getline(Timeout => 1000); if (!$line) { print "RBN feed died!\n"; exit; } chop($line); $line = $line."\r\n"; next unless ($line =~ /^DX/); my $c = substr($line, 26, 10); $c =~ s#[^A-Z0-9/]##g; if ($callhash{$c}) { select SPOTDUMP; $| = 1; print SPOTDUMP $line; } if ($memberssize != -s "members.txt") { $memberssize = -s "members.txt"; loadcalls(); } } sub loadcalls { # Calls that will pass the spot filter open CALLS, "members.txt"; while (my $a = ) { chomp($a); map {s/\r//g;} ($a); $callhash{$a} = 1; #print ">>>$a<<<"; } close CALLS; }