Advertisement
Advertisement
| 04.16.2008 at 03:55PM PDT, ID: 23329217 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: |
#!/usr/bin/perl
use Socket;
$host = "0.0.0.0"; # change this to an actual IP address
$port = 85;
$error = 0;
socket(SH, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die $!;
my $sin = sockaddr_in ($port,inet_aton($host));
connect(SH,$sin) or $error = "1";
if($error eq "1")
{
print "Unable to connect: ".$!."\n";
}
else
{
print $host." on port ".$port." OPEN\n";
}
close(SH) || die $!;
|