Nc

From OnnoWiki
Revision as of 15:39, 25 April 2014 by Onnowpurbo (talk | contribs) (New page: nc is the command which runs netcat, a simple Unix utility that reads and writes data across network connections, using the TCP or UDP protocol. It is designed to be a reliable "back-end" ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

nc is the command which runs netcat, a simple Unix utility that reads and writes data across network connections, using the TCP or UDP protocol. It is designed to be a reliable "back-end" tool that can be used directly or driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities. Common uses include:

   Simple TCP proxies
   Shell-script based HTTP clients and servers
   Network daemon testing
   A Socks or HTTP ProxyCommand for ssh 

Pemakaian

nc [-46bCDdhklnrStUuvZz] [-I length] [-i interval] [-O length] 
   [-P proxy_username] [-p source_port] [-q seconds] [-s source] 
   [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol] 
   [-x proxy_address[:port]] [destination] [port]


Client / Server Model

It is quite simple to build a very basic client/server model using nc. On one console, start nc listening on a specific port for a connection. For example:

nc -l 1234

nc is now listening on port 1234 for a connection. On a second console (or a second machine), connect to the machine and port being listened on:

nc 127.0.0.1 1234


Mengirim Data

nc 127.0.0.1 1234 < filetest.txt



Referensi