📄 one-to-eight-icmp.pl
字号:
#!/usr/bin/perl# this script verifies that there is at least 1, and at most 8 ICMP# messages in the file. The ICMP messages will typically not be consistent# due to ICMP rate limiting.# note that we keep track of things on a per destination basis.%count=undef;while(<>) { chomp; # 192.0.2.254 > 192.0.2.1: icmp: host 192.0.1.1 unreachable - admin prohibited filter [tos 0xc0] if(/(.*) \> (.*)\: icmp: .* .* unreachable/) { $from=$1; $to=$2; $message{$to}=$_; $count{$to}++; #print "Processed $_\n"; } else { print $_."\n"; }}foreach $to (keys %count) { next if($to eq ""); if($count{$to} >= 1 && $count{$to} <= 8) { print $message{$to}." <=> 1-8\n"; } else { print $message{$to}." FOUND ".$count{$to}." TIMES\n"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -