[aprssig] List of digis and IGates?

Steve Dimse steve at dimse.com
Sat Feb 26 21:14:33 EST 2005


On 2/26/05 at 8:17 PM Steve Dimse <steve at dimse.com> sent:

>The method of extracting those callsigns after the q construct which do not
>match the packet call looks like the way to go then, again not hard in Perl or
>other scripting languages...
>
I guess I can't whine too much about people not having saved this, and the TAPR
archives are not working since the list moved to the new list server, so in
response to a couple requests, here is the script, cut it out and place in a
file igate.pl, and chmod +x to allow it to be executed

---------
#!/usr/bin/perl

while (<>)
{
        next unless m/^([\w\-]+).+q..\,([\w\-]+)/;
        print "$2\n" if ($1 ne $2);
        last if $i++ > 1000;        
}
----------

You also need another script I previously posted, aprsis.pl, which connects to
the APRS IS and feeds the packets to the igate parsing script, keeping this on
your computer makes it much easier to use perl to do other things. This is
needed because some of the hubs won't send data unless you send a logon string,
previouslu you could simply use telnet rotate.aprs.net. You could add the
parsing to the aprsis script, but I prefer to keep the two functions separate
and use pipes to join them:


----------
#!/usr/bin/perl 

use IO::Socket;

($host,$port) = @ARGV;
$host = "rotate.aprs.net" unless $host;
$port = 23 unless $port;
$| = 1;
$con = IO::Socket::INET->new(
        PeerAddr => $host,
        PeerPort => $port,
        Proto    => "tcp",
        Type     => SOCK_STREAM,
        Timeout  => 3) or die ("Can't connect to $host");

sleep(2);
$con->send("user perl pass -1 vers 1.0\n");
while (<$con>) 
{
        print;
}
---------

you can change the 1000 in igate.pl to be any number of packets you wish to
examine, but using a number here rather than just an infinite loop that you
ctl-c out of is that the program will self-terminate, allowing you to pipe
everything in one line:

./aprsis.pl | ./igate.pl | sort | uniq

nothing will appear until the specified number of packets has been examined,
then the list of unique IGate callsigns will print all at once. 

Steve K4HG




More information about the aprssig mailing list