Synping.pl

From Federal Burro of Information
Revision as of 22:34, 6 March 2021 by David (talk | contribs) (Created page with "<pre> #!/usr/bin/perl use strict; use Net::Ping; my $prot = 'tcp'; my $port = 'smtp'; my $p = Net::Ping->new("syn"); $p->{port_num} = getservbyname($port, $prot); foreach...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
#!/usr/bin/perl

use strict;

use Net::Ping;

my $prot = 'tcp';
my $port = 'smtp';

my $p = Net::Ping->new("syn");
$p->{port_num} = getservbyname($port, $prot);

foreach my $host (@ARGV) {
	$p->ping($host);
	print "PING: $host on $prot/$port\n";
}
while (my($host,$rtt,$ip) = $p->ack) {
	print "HOST: $host [$ip] ACKed in $rtt seconds.\n";
}