Perl AnyEvent::Socket

还是在不断的改写做尝试。

做了些小记录把。方便以后翻。。

#!/usr/bin/perl

use Coro;
use AnyEvent::Socket;
use AnyEvent::Ping::TCP;
my @check_list;
my @target=<>;
foreach my $ip (@target){
   foreach my $port (1..65535){
      push @check_list,async{
            $a=tcp_connect $ip => $port, sub {
                  my $fh = shift
                 or die "unable to connect: $!";
            };
            if(!$a){
               print "$port open\n";
            }
         # $result=tcp_ping_ack $ip,$port;
   #     nex($ip,$port);
      }
   };
};

这个脚本貌似不太成功,链接成功的就没有提示,不知道为什么。

判断的基准没找到。

posted @ 2013-10-10 10:24  墨迹哥's  阅读(390)  评论(0编辑  收藏  举报