The netcat is used to debug and check the network and to read and write data through TCP and UDP on the network. Netcat is to establish a link between two computers and return two data streams, you can set up a server, transfer files, chat with friends, transfer streaming media or use it as a separate client for other protocols.
0x01, Port scan
NCAT-V-N 192.168.1.1 80
-V: Show more information
-N: Use a pure digital IP address without DNS to resolve IP addresses
-W 1: Set timeout time is 1
-u: Scan UDP port, default TCP
-Z: Use 0IO, close connection immediately after successful connection, no data exchange
-L: Connect and listen to incoming connections
-e: Command line to perform delivery
-K: Accepts multiple listening mode connections
0x02, Chat Service
Server
Start a TCP server on port 10086
Ncat-l 10086
Client
On the machine clent input, the server will show up
NCAT localhost 10086
0x03, File transfer
Server transfers files to client
Server
Ncat-l 10086 < Test.txt
Client
Ncat-n 127.0.0.1 10086 > Test.txt
Client transfers files to the server
Server
Touch Test.txt
Ncat-l 10086 > Test.txt
Clinet
Cat Test.txt | NCAT localhost 10086
0x03, directory Transfer
Server
Tar-czvf-python | ncat-l10086
Clinet
Ncat-n 127.0.0.1 10086 | TAR-XVF-
0x04, cloning a device
Server
DDIF=/DEV/SDA | Nc-l 10086
Clinet
Ncat-n 127.0.0.1 10086 | DD OF=/DEV/SDA
0x05, open a shell
Server
Ncat-l 10086-e/bin/bash-i
Client
Ncat-l 192.168.1.1 10086
Reverse shell
Server
Ncat-l 10086
Cliet
NCAT 127.0.0.1 10086-e/bin/bash
This article is from the "Love Affair" blog, please be sure to keep this source http://guojianglong.blog.51cto.com/9344755/1894458
Linux Netcat Commands