Christopher Hotchkiss

Christopher Hotchkiss

Crafting Solutions, Shaping Products: From Concept to Code

Netcat for those without NetCat

August 15, 2012

Here is a perl one liner I found here: http://www.ajs.com/ajswiki/Perl_one-liners

This starts up a socket server that allows for easy firewall testing if you don't have netcat installed.

perl -MIO::Socket::INET -e '$s=IO::Socket::INET->new(LocalPort=>5000,
Proto=>"tcp",
ReuseAddr=>1,
Listen=>5) or die "socket: $!";
while($in=$s->accept()){
$in->print("Hi\n");print while <$in>;undef $in
}'