Leser: 1
5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use IO::Socket; use Net::IP; my $port = 80; my $start_ip = "88.198.240.123"; my $end_ip = "88.198.255.254"; my $ip_string = $start_ip." - ".$end_ip; my $ip = new Net::IP ($ip_string) or die; do { my $temp_ip = $ip->ip(); print "Info: Connecting to... [$temp_ip]\n"; my $socket = IO::Socket::INET->new( PeerAddr => $temp_ip, PeerPort => $port, proto => 'tcp', Timeout => 0 ); unless($socket) { print STDERR "Info: ... FAILED! Can't bind: $@\n"; } $socket->close(); print "Info: ... OK!\n"; } while (++$ip);
1
2
3
Info: Connecting to... [88.198.240.123]
Info: ... FAILED! Can't bind: IO::Socket::INET: connect: Unknown error
Can't call method "close" on an undefined value at ...
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;
5 Einträge, 1 Seite |