[Swiss Army Knife in Linux --nc]

一、What is Netcat?

Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol.

It is designed to be a reliable "back-end" tool that can be used directly or easily 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.

 

It provides access to the following main features:

Outbound and inbound connections, TCP or UDP, to or from any ports.

Featured tunneling mode which allows also special tunneling such as UDP to TCP, with the possibility of specifying all network parameters (source port/interface, listening port/interface, and the remote host allowed to connect to the tunnel.

Built-in port-scanning capabilities, with randomizer.

Advanced usage options, such as buffered send-mode (one line every N seconds), and hexdump (to stderr or to a specified file) of trasmitted and received data.

Optional RFC854 telnet codes parser and responder.

 

 

NetCat (nc for short), known as the "Swiss Army Knife" in network tools, has Windows and Linux versions. Because it is short and powerful (the 1.84 version is only 25k, the old or reduced version is even smaller), and its functions are practical, it is designed as a simple and reliable network tool, which can transmit and read data through TCP or UDP protocol. At the same time, it is also a network application debug analyzer, because it can create a variety of different types of network connections as needed.

 

 

二、Project Goals

Although the project development is marked as beta, GNU Netcat is already enough stable for everyday use.

Goals of this project are full compatibility with the original nc 1.10 that is widely used, and portability. GNU Netcat should compile and work without changes on the following hosts:

Linux (test host: alphaev67-unknown-linux-gnu)

FreeBSD (test host: i386-unknown-freebsd4.9)

NetBSD (test host: i386-unknown-netbsdelf1.6.1)

SunOS/Solaris (test host: sparc-sun-solaris2.9)

MacOS X (test host: powerpc-apple-darwin6.8)

Other operating systems could be supported with minor source modifications, since the code has been written following the GNU coding standard conventions.

If you find a bug or you want to report a successfull build on another OS, use the bug tracking system.

 

Soon the project will split releases between "stable" releases and "development" releases to improve development speed and the introduction of new features without requiring too much testing.

 

For further information, see the README and ChangeLog files in the package. 

If you are courageous enough to try the newest development version or you want to contribute patches, you may want to check out the version in the CVS repository.

 

 

 

3. Application

1. Copy files remotely

Copy files from server1 to server2. You need to activate the monitor with nc on server2 first

Run on server2:

[root@hatest2 tmp]# nc -lp 1234 > install.log

 

run on server1:

[root@hatest1 ~]# ll install.log

-rw-r--r--   1 root root 39693 12月 20   2007 install.log

[root@hatest1 ~]# nc hatest2  1234 < install.log

 

 

 

 

4. Introduction to parameters

1.84 version parameter introduction 1. nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]

  [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol] [-x 

  proxy_address[:port]] [hostname] [port[s]] 

 

1. -4 Force the use of ipv4 

2. -6 Force the use of ipv6 

3. -D allows socket communication to return debug information 

4. -d disallow reading from standard input 

5. -h Display nc help documentation 

6. -i interval  

7. Specify the content delay between each line to send and receive, or delay the connection between multiple ports 

8. -k When a connection ends, force nc to listen for another connection. Must be used with -l 

9. -l is used to listen for incoming data links, cannot be used with -p -z -s. The timeout for the -w parameter is also ignored 

10. -n Do not perform any address, hostname, port or DNS lookup 

11. -p specifies the source port used by nc, which is restricted by permissions and cannot be used together with -l 

12. -r specifies the source port and destination port used by nc, and cannot use those ports originally specified by the system 

13. -S Allow TCP MD5 signing option in RFC 2385 

14. -s source_ip_address  

15. Specify the IP address of the interface used for sending packets, cannot be used together with -l 

16. -T ToS 

17. Specify the IP Type of Service (TOS) for the link 

18. -C word wrap 

19. -t enables nc to interact with telnet 

20. -U Use UNIX domain socket 

21. -u use udp instead of default tcp option 

22. -v output verbose report 

23. -w timeout 

24. A link will be automatically disconnected if there is no operation for a period of time, and there is no timeout by default. 

25. -X proxy_version 

26. Specify the protocol used by nc to use the proxy, optional socksv4, socks5 and https. Default socks5 

27. -x proxy_address[:port] 

28. Specify the proxy address and port used by nc. Default settings: 1080 (SOCKS), 3128 (HTTPS) 

29. -z listen only without sending any packets

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326519796&siteId=291194637
Recommended