NetCat(nc / ncat) on CentOS Linux

1. IF server IP : 192.168.10.10 , client IP: 192.168.10.78
Server: listen for connections
$ ncat -l 8081

or bind a shell to tcp port 8081, limit access to hosts on local network, and limit the maximum nuber of simultaneous connection to 1
$ ncat --exec "/bin/bash" --max-conns 1 --allow 192.168.10.0/24 -l 8081 --keep-open

2. client connect to server port 8081
$ ncat 192.168.10.10 8081  # stand by typing any instruction

3. Send a file over TCP port 8081 from  client to server
192.168.10.10$ ncat -l 8081 > tmpfile.log
192.168.10.78$ ncat 192.168.10.10 8081 < tmpfile.log   # real file in this path

4. the udp option is -u, because ncat default protocol is tcp



















(Figure 1. snipping of Man page )


references
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/

https://www.tecmint.com/netcat-nc-command-examples/

這個網誌中的熱門文章

Upgrade php and httpd(apache) on CentOS 7

Installing VMware workstation pro on Ubuntu 22.X (Jammy Jellyfish)