- 論壇徽章:
- 3
|
20可用積分
想嘗試復原tracert的結(jié)果數(shù)據(jù),但是dump出來以后不知道怎么弄。。
要取的信息是hops里面的信息。
程序代碼如下:- #!/usr/bin/perl
- use Data::Dumper;
- use Net::Traceroute::PurePerl;
- my $t = new Net::Traceroute::PurePerl(
- host => 'www.baidu.com',
- debug => 0,
- query_timeout => 1,
- packetlen => 40,
- concurrent_hops => 2,
- protocol => 'udp', # Or icmp
- );
- $t->traceroute;
- print $acb;
- print Dumper($t->{'hops'});
- #@results=$t->pretty_print;
- #@results=split(/\n/,$t->pretty_print);
- #foreach my $res (@results){
- # print "aaaaaaaaaaaaa:$res\n";
- #}
- # max_ttl => 100,
復制代碼 結(jié)構(gòu)是:[code]Net::Traceroute: urePerl=HASH(0x1419c70)$VAR1 = bless( {
'_local_port' => 46300,
'query_timeout' => '1',
'protocol' => 'udp',
'packetlen' => '40',
'max_ttl' => '30',
'trace_program' => 'traceroute',
'_destination' => 's |
|