Linux NC command detailed "scan ports, chat tools, transfer files" __linux

Source: Internet
Author: User
Introduction to NC commands

NC process is netcat is a common network tool (the Swiss knife of the network); NC communication reads and writes data through TCP/IP protocol,

Can be TCP, UDP after network link communication.
The most reusable function of the NC scan Port NC is to scan the port for opening, a bit like telnet:

Nc-v-W 2 ' hostname-i ' 3901-3905
nc:connect to 10.246.46.15 Port 3901 (TCP) Failed:connection refused Nc:conn
ECT to 10.246.46.15 Port 3902 (TCP) Failed:connection refused
Connection to 10.246.46.15 3903 Port [Tcp/charsetmgr] s ucceeded!  #端口开通
nc:connect to 10.246.46.15 Port 3904 (TCP) Failed:connection refused Connection to
10.246.46.15 3905 Port [Tcp/mupdate] succeeded!     #端口开通
You can use the NC return value to determine whether the port is open

Nc-v-W 2 ' hostname-i ' 3901
nc:connect to 10.246.46.15 Port 3901 (TCP) Failed:connection refused
echo $?
  
   1

nc-v-W 2 ' hostname-i ' 3903
Connection to 10.246.46.15 3903 Port [tcp/charsetmgr] succeeded!
echo $?
0

  


NC Chat Tools

NC is a TCP/IP network protocol tool that is sure to be followed by TCP connections, and can simulate one of the simplest chat tools with NC: Server-side "any side"

Nc-l 55555
shi ni 
shiwo^h^h
ni hao shuming
ni shmming

Client side "either side"

NC 10.246.46.15 55555
shi ni 
shiwo
ni hao shuming
ni shmming
NC Transfer Files

Since NC is a network connection to the TCP/IP protocol, you can use NC to establish a connection to transfer file transfer files to write the contents of the file to the NC-enabled port listen

Cat rpyc.py |nc-l 33333
Receives the file side, the NC connects transmits the file machine the listen port, and receives the file to write in the specified file

NC 10.246.46.15  33333 > rpyc.py

NC Usage: http://www.huanxiangwu.com/477/linux-nc-netcat



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.