More work on aslookup
This commit is contained in:
parent
af7e9c4218
commit
5f8a3c3099
26
aslookup
26
aslookup
|
@ -11,9 +11,27 @@ my %whois_options = (
|
|||
"hostname" => $default_as_server,
|
||||
);
|
||||
|
||||
my $target = "1.1.1.1";
|
||||
my $whois = Net::Whois::RIPE->new(%whois_options);
|
||||
my $witerator = $whois->query('1.1.1.1');
|
||||
while($witerator->isnt_exhausted()) {
|
||||
my $wdata = $witerator->value()
|
||||
|
||||
my $witerator = $whois->query($target);
|
||||
while($witerator->isnt_exhausted) {
|
||||
my ($asnum,$asname,$descr,$origin,$route);
|
||||
my @whoisdata = split /\n/, $witerator->value();
|
||||
foreach (@whoisdata) {
|
||||
$asnum = $_ if /^aut-num:/;
|
||||
$asname = $_ if /^as-name:/;
|
||||
$descr = $_ if /^descr:/;
|
||||
$origin = $_ if /^origin:/;
|
||||
$route = $_ if /^route:/;
|
||||
}
|
||||
if($target =~ /^AS.*/i) {
|
||||
$asnum =~ s/.*:[ ]+//;
|
||||
$asname =~ s/.*:[ ]+//;
|
||||
print "$target advertised by $asnum - $asname\n";
|
||||
} else {
|
||||
$descr =~ s/.*:[ ]+//;
|
||||
$origin =~ s/.*:[ ]+//;
|
||||
$route =~ s/.*:[ ]+//;
|
||||
print "$route advertised by $origin - $descr\n";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue