#!/usr/bin/perl # # list-iana-reserved-ranges - List IANA Reserved ranges # Copyright (C) 2001,2008 Mark Suter # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see L. # # [MJS 22 Oct 2001] List IANA Reserved ranges (for firewall purposes) # [MJS 3 Mar 2008] IANA reformated document to use /8s and not ranges # [SWS 1 Jul 2010] Changed URL of address space list to get text version use strict; use warnings; use LWP; ## Download Official IANA document my $ua = LWP::UserAgent->new(); my $res = $ua->get('http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.txt'); $res->is_success or die 'HTTP request failed: ' . $res->message . "\n"; ## Print all the /8s. print map {"$_\n"} $res->content =~ m{ ( \d{3} \/ 8 ) .+? (?: UNALLOCATED | RESERVED ) }gx; # $Id: list-iana-reserved-ranges,v 1.9 2008/03/03 08:28:16 suter Exp suter $