Common Linux Network Tools: netcat for batch host service Scanning
Netcat, also known as Swiss Army knife, is a common network tool used by hackers and system administrators. It was initially developed to transfer files and subsequently developed many powerful functions, such as batch host service scanning.
We have introduced another more common batch host service scanning tool: nmap.
Netcat installation is also very simple. Install netcat directly using yum:
Yum install nc
Generally, it is not recommended to install nc in the production environment. In addition to batch host service scanning, nc also supports port proxy and file transmission, which may cause security risks.
Netcat-Batch host service Scanning
--------------------------------------------------------------------------------
Common netcat parameters used during scanning:
-W: Set the timeout value.
-Z Input/Output Mode
-V: Display Command Execution Process
Common commands:
TCP protocol
Nc-v-z-w2 192.168.2.20.1-50
UDP protocol
Nc-v-z-w2-u 192.168.2.20.1-50
Netcat File Transfer
--------------------------------------------------------------------------------
Netcat can specify a local port number to enable the listening mode. The client can use the same netcat connection to enable the port sending information, which will be displayed on the server.
Enable listener
Nc-l 2389
Establish a connection
Nc localhost 2389
If you redirect the server output to a file, it can be used for file transfer:
Nc-l 2389> test
Transfer files
Cat testfile | nc localhost 2389
If the test is performed on a server, you can use & switch nc to the background task and run the client command.
This article permanently updates the link address: