Skip to content

Instantly share code, notes, and snippets.

@mschmitt
Created July 5, 2017 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mschmitt/5ff9c25f1e403ec3dd890b8d44a37aba to your computer and use it in GitHub Desktop.
Save mschmitt/5ff9c25f1e403ec3dd890b8d44a37aba to your computer and use it in GitHub Desktop.
Single line portscanner in Perl
perl -MIO::Socket::INET -e 'open I,"</etc/services";while(<I>){
(/^\s*($|#)/)&&next;($n,$p,@j)=split/\s+/;($p=~s/\/tcp//)||next;
$s=IO::Socket::INET->new(PeerAddr=>$ARGV[0], PeerPort=>$p,Proto=>'tcp')?
print"$n($p)-->Open\n":next}' 192.168.12.34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment