Created
February 16, 2018 11:09
-
-
Save Kappaton/6e75c1e3f5c8fa3b4e505b8e032dce57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl -w - | |
use warnings; | |
use strict; | |
use IO::Socket::INET; | |
if (@ARGV < 3){ | |
die "USAGE: perl Confirmation_Port.pl [HOST] [PORT] [PROTO]\n"; | |
exit; | |
} | |
my $sock = IO::Socket::INET->new( | |
PeerAddr=>$ARGV[0], | |
PeerPort=>$ARGV[1], | |
Proto=>$ARGV[2], | |
Timeout=>5, | |
) or die "Close $ARGV[1]\/$ARGV[2] port!\n"; | |
if ($sock){ | |
print "Open $ARGV[1]\/$ARGV[2] port!\n"; | |
} else { | |
print "Error!\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://infotech.hateblo.jp/entry/2018/02/16/201648