Fixed IPv6 lookups
This commit is contained in:
parent
9312e5a5a8
commit
f82da57ebd
39
aslookup
39
aslookup
|
@ -1,32 +1,20 @@
|
||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
#aslookup.pl - Looks up information on a given ASN or IP address
|
#aslookup.pl - Looks up information on a given ASN or IP address
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Net::Whois::RIPE;
|
use Net::Whois::RIPE;
|
||||||
|
|
||||||
my $default_as_server = "whois.radb.net";
|
sub handle_whois_output {
|
||||||
my %whois_options = (
|
my ($obj,$target) = @_;
|
||||||
"hostname" => $default_as_server,
|
while($obj->isnt_exhausted) {
|
||||||
);
|
|
||||||
|
|
||||||
if($#ARGV < 0 || $ARGV[0] eq "") {
|
|
||||||
print "Provide an IP or ASN to look up";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
my $target = $ARGV[0];
|
|
||||||
my $whois = Net::Whois::RIPE->new(%whois_options);
|
|
||||||
my $witerator = $whois->query($target);
|
|
||||||
while($witerator->isnt_exhausted) {
|
|
||||||
my ($asnum,$asname,$descr,$origin,$route);
|
my ($asnum,$asname,$descr,$origin,$route);
|
||||||
my @whoisdata = split /\n/, $witerator->value();
|
my @whoisdata = split /\n/, $obj->value();
|
||||||
foreach (@whoisdata) {
|
foreach (@whoisdata) {
|
||||||
$asnum = $_ if /^aut-num:/;
|
$asnum = $_ if /^aut-num:/;
|
||||||
$asname = $_ if /^as-name:/;
|
$asname = $_ if /^as-name:/;
|
||||||
$descr = $_ if /^descr:/;
|
$descr = $_ if /^descr:/;
|
||||||
$origin = $_ if /^origin:/;
|
$origin = $_ if /^origin:/;
|
||||||
$route = $_ if /^route:/;
|
$route = $_ if /^route[6]?:/;
|
||||||
}
|
}
|
||||||
$descr =~ s/.*:[ ]+//;
|
$descr =~ s/.*:[ ]+//;
|
||||||
if($target =~ /^AS.*/i) {
|
if($target =~ /^AS.*/i) {
|
||||||
|
@ -39,3 +27,20 @@ while($witerator->isnt_exhausted) {
|
||||||
print "$route advertised by $origin - $descr\n";
|
print "$route advertised by $origin - $descr\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $default_as_server = "whois.radb.net";
|
||||||
|
my %whois_options = (
|
||||||
|
"hostname" => $default_as_server,
|
||||||
|
);
|
||||||
|
if($#ARGV < 0 || $ARGV[0] eq "") {
|
||||||
|
print "Provide an IP or ASN to look up";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
my $target = $ARGV[0];
|
||||||
|
my $whois = Net::Whois::RIPE->new(%whois_options);
|
||||||
|
my $ripewhois = Net::Whois::RIPE->new();
|
||||||
|
my $witerator = $whois->query($target);
|
||||||
|
handle_whois_output($witerator,$target);
|
||||||
|
my $riterator = $ripewhois->query($target);
|
||||||
|
#handle_whois_output($riterator,$target);
|
||||||
|
|
Loading…
Reference in New Issue