508 :
秋水 ★:
プロ串規制、ポートチェックの巻
sub proxy_connect {
my ($port, $ping) = (@_);
my $inad = inet_aton($ENV{'REMOTE_ADDR'});
eval {
local($SIG{ALRM}) = sub{ die "Alarm...\n"; };
alarm(2);
socket(SOCK, AF_INET, SOCK_STREAM, 0) || die "Stream...\n";
connect(SOCK, sockaddr_in($port, $inad)) || die "Connect...\n";
select(SOCK); $|=1; select(STDOUT);
close(SOCK);
die "Out!!!\n";
alarm(0);
};
close(SOCK);
if ($@ =~ /Connect/) {
return ( 0 );
#}elsif($@ =~ /Out/o){
#return ( 1 );
#}elsif($ping){
#return ( 0 );
}else{
return ( 1 );
}
}