Thread PortScanner (4 answers)
Opened by Gast at 2008-07-29 00:15

GwenDragon
 2008-07-29 15:07
#112867 #112867
User since
2005-01-17
14749 Artikel
Admin1
[Homepage]
user image
Unter Windows ist es so, dass so was bei nicht erreichbaren Ports passiert; gerade getestet.

Test doch mal damit:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use strict;
use warnings;

use IO::Socket::INET;

my @ports = qw/20 29 80 99/;
my @ips = ("www.example.org", "example.com" ) ;

for my $i (@ips) {
for my $p(@ports) {
print "Connect to $i:$p", "\n";
my $socket = IO::Socket::INET->new(
PeerAddr => $i,
PeerPort => $p,
proto => 'tcp',
Timeout => 0 );
print "$i:$p ", $socket ? "ist verbunden" : "#Fehler: $@#", "\n";
$socket && $socket->close();
}
}

1;

View full thread PortScanner