v5
This commit is contained in:
parent
e975ec2460
commit
b8fbb97679
26
xtr.pl
26
xtr.pl
@ -30,6 +30,18 @@ use Data::Dumper;
|
||||
######################################################################################################################################################
|
||||
|
||||
|
||||
### CHANGELOG ######################################################################################################################################
|
||||
# v0.5 (2019-08-18)
|
||||
# * FIX: dropped "timeout" option of Net::Traceroute (details -> https://rt.cpan.org/Ticket/Display.html?id=107066)
|
||||
# * FIX: altered dependency on which an output will be send ("$tr->found" -> "$tr->hops > 1")
|
||||
#
|
||||
# v0.4 (2019-08-13)
|
||||
# * ADD: added better documentation
|
||||
# * ADD: updated API to v3
|
||||
# * FIX: limied inputs to ipv4 addresses only (no more hostnames for now in requests)
|
||||
######################################################################################################################################################
|
||||
|
||||
|
||||
### INSTALL ########################################################################################################################################
|
||||
# This is a standalone software which usually runs in the "foreground". Starting it in a screen session or via init.d/systemd/rc.d is
|
||||
# highly recommended. For testing, starting this script in a screen session is also fine.
|
||||
@ -50,7 +62,7 @@ use Data::Dumper;
|
||||
|
||||
|
||||
### VARS ###########################################################################################################################################
|
||||
my $VERSION = "0.4";
|
||||
my $VERSION = "0.5";
|
||||
my $dbfile = 'ip2asn.db';
|
||||
my $ip2asn_csv_url = 'http://iptoasn.com/data/ip2asn-v4-u32.tsv.gz';
|
||||
my $master_server = 'xtr-master.xicon.eu';
|
||||
@ -149,10 +161,11 @@ sub get_my_ipv4
|
||||
sub traceit
|
||||
{
|
||||
my ($dbh,$host) = @_;
|
||||
my $tr = Net::Traceroute->new(host => $host, use_icmp => 1, timeout => 1 );
|
||||
my $tr = Net::Traceroute->new(host => $host, use_icmp => 1);
|
||||
|
||||
my @array = ();
|
||||
if($tr->found)
|
||||
my $hops = $tr->hops;
|
||||
if($hops > 1)
|
||||
{
|
||||
foreach my $hop (@{$tr->{'hops'}})
|
||||
{
|
||||
@ -179,15 +192,12 @@ sub traceit
|
||||
}
|
||||
push(@array, [$hop->[0]->[1],$answer,$sum,$as]);
|
||||
}
|
||||
}
|
||||
|
||||
if($tr->found)
|
||||
{
|
||||
return \@array;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $tr->{'hops'};
|
||||
push(@array, "NO","ANSWER","FOUND");
|
||||
return \@array;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user