From cb465c6f511d63b5445a640735295de967126e2c Mon Sep 17 00:00:00 2001 From: Jason Fesler Date: Wed, 2 Apr 2014 19:48:27 -0700 Subject: Imported without history from https://falling-sky.googlecode.com/svn/trunk/mod_ip revision 1511 --- scan-sixxs.pl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 scan-sixxs.pl (limited to 'scan-sixxs.pl') diff --git a/scan-sixxs.pl b/scan-sixxs.pl new file mode 100755 index 0000000..663bf70 --- /dev/null +++ b/scan-sixxs.pl @@ -0,0 +1,32 @@ +#! /usr/bin/perl + +# Scan the SIXXS pops page, +# Screen scrape it to generate the CHECK_PREFIX lines in mod_ip.c + + # Output will be like +# CHECK_PREFIX("2001:14b8:100::/40","fihel01.sixxs.net dna"); +# CHECK_PREFIX("2001:15c0:65ff::/48","simbx01.sixxs.net amis"); +# CHECK_PREFIX("2001:15c0:6600::/40","simbx01.sixxs.net amis"); + + +use strict; +use LWP::Simple qw(get); + +my $top_url = "http://www.sixxs.net/pops/prefixes/"; +my $top_html = get($top_url); +my @lines = split( /\n/, $top_html ); +@lines = grep( m#/tools/whois#, @lines ); +foreach my $line (@lines) { + if ( $line =~ m#href="/tools/whois/\?(\S+?)">\1# ) { + my ($ip) = $1; + if ( $line =~ + m#(?:Subnets|Tunnels)(\S+)(.*?)$# + ) + { + print <<"EOF"; +\t\tmod_ip_prefix $ip "$2\.sixxs.net $1" +EOF + } + } +} + -- cgit v1.2.3