Perl 校验命中的脚本
发布时间:2020-12-16 00:01:34 所属栏目:大数据 来源:网络整理
导读:这个脚本无比的重要,虽然代码简单,但是在判断是否准确上,有着很重要的地位。 通过icmp和解析,它有一定意义所在。 mark!.. # !/usr/bin/perl use Net:: Ping; sub icmp_domain{ $k = ' true ' ; local ( $host )= shift ; $p =Net::Ping-new( " icmp " );
这个脚本无比的重要,虽然代码简单,但是在判断是否准确上,有着很重要的地位。 通过icmp和解析,它有一定意义所在。 mark!.. #!/usr/bin/perl use Net::Ping; sub icmp_domain{ $k='true'; local($host)=shift; $p=Net::Ping->new("icmp"); #@url=<>; $k='false' unless $p->ping($host,1); #if($p->ping($host,1)){ # print "yesn"; #}else{ # print "Non"; #} return $k; $p->close(); } sub domain_ip{ local($host)=shift; $p=Net::Ping->new(); $p->hires(); ($ret,undef,$ip) = $p->ping($host,1); $p->close(); return $ip; } $ip=domain_ip('163.com'); print $ip; $icmp=icmp_domain('waieufh290.com'); print $icmp; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |