Netcat I/O enhancements
- by user13277689
When Netcat integrated into OpenSolaris it was already clear
that there will be couple of enhancements needed. The biggest set of the changes made after Solaris 11 Express was released brings
various I/O enhancements to netcat shipped with Solaris 11. Also, since
Solaris 11, the netcat package is
installed by default in all distribution forms (live CD, text install, ...).
Now, let's take a look at the new functionality:
/usr/bin/netcat alternative program name (symlink)
-b bufsize I/O buffer size
-E use exclusive bind for the listening socket
-e program program to execute
-F no network close upon EOF on stdin
-i timeout extension of timeout specification
-L timeout linger on close timeout
-l -p port addr previously not allowed usage
-m byte_count Quit after receiving byte_count bytes
-N file pattern for UDP scanning
-I bufsize size of input socket buffer
-O bufsize size of output socket buffer
-R redir_spec port redirection
addr/port[/{tcp,udp}] syntax of redir_spec
-Z bypass zone boundaries
-q timeout timeout after EOF on stdin
Obviously, the Swiss army knife of networking tools just got a bit thicker.
While by themselves the options are pretty self explanatory, their combination together with other options,
context of use or boundary values of option arguments make it possible to construct small but powerful tools.
For example:
the port redirector allows to convert TCP stream to UDP datagrams.
the buffer size specification makes it possible to send
one byte TCP segments or to produce IP fragments easily.
the socket linger option can be used to produce TCP RST segments by setting the timeout to 0
execute option makes it possible to simulate TCP/UDP servers or clients with shell/python/Perl/whatever script
etc.
If you find some other helpful ways use please share via comments.
Manual page nc(1) contains more details, along with examples on how to use some of these new options.