From b8fbb976794ccc52b592aae0f3b3d367be8c44bf Mon Sep 17 00:00:00 2001 From: XiCoN-FJS- Date: Sat, 19 Oct 2019 23:25:57 +0200 Subject: [PATCH] v5 --- xtr.pl | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/xtr.pl b/xtr.pl index 344e667..10efdfa 100644 --- a/xtr.pl +++ b/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; } }