Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash/perl
- use strict;
- use warnings;
- use Net::Ping::External qw(ping);
- use IO::Socket;
- my $ip_address;
- my $packed_ip;
- print "Please enter the ip or the FQDN that you want to ping: \n";
- chomp (my $scanme=<>);
- use Socket;
- $packed_ip = gethostbyname("$scanme");
- if (defined $packed_ip) {
- $ip_address = inet_ntoa($packed_ip);
- }
- my $host = $ip_address;
- my $i;
- $host = IO::Socket::INET->new(PeerAddr=>$ARGV[0],PeerPort=> $i,proto=>'tcp',Timeout=>1) and print "Port $i is open\n";
- my $alive = ping(host => "$scanme");
- print "$scanme is resolved to $ip_address \n";
- print "ping: $scanme is reachable \n" if $alive;
Advertisement
Add Comment
Please, Sign In to add comment