Home  >  Article  >  Operation and Maintenance  >  What is nc under centos

What is nc under centos

WBOY
WBOYOriginal
2022-03-23 18:44:253820browse

NC under centos is the abbreviation of "netcat". It is a network tool that can be used for port scanning, file transfer, etc. nc can also implement listening on any TCP and UDP ports. You can use "yum install nc -y" command to install.

What is nc under centos

The operating environment of this article: centos 7 system, Dell G3 computer.

What is nc under centos

nc is the abbreviation of netcat tool, a network tool that can be used for port scanning, file transfer and other functions.

The installation on centos is also very simple:

yum install nc -y

nc commonly used functions

  • realize any TCP /UDP port listening, nc can act as a server to listen to the specified port in TCP or UDP mode

  • Port scanning, nc can act as a client to initiate a TCP or UDP connection

  • Transfer files between machines

  • Network speed test between machines

Generally nc is only used for TCP/UDP Protocol port testing, other functions should be used sparingly!

nc Help Description

# nc --help 
Ncat 7.50 ( https://nmap.org/ncat )
Usage: ncat [options] [hostname] [port]
Options taking a time assume seconds. Append 'ms' for milliseconds,
's' for seconds, 'm' for minutes, or 'h' for hours (e.g. 500ms).
  -4                         Use IPv4 only
  -6                         Use IPv6 only
  -U, --unixsock             Use Unix domain sockets only
  -C, --crlf                 Use CRLF for EOL sequence
  -c, --sh-exec <command>    Executes the given command via /bin/sh
  -e, --exec <command>       Executes the given command
      --lua-exec <filename>  Executes the given Lua script
  -g hop1[,hop2,...]         Loose source routing hop points (8 max)
  -G <n>                     Loose source routing hop pointer (4, 8, 12, ...)
  -m, --max-conns <n>        Maximum <n> simultaneous connections
  -h, --help                 Display this help screen
  -d, --delay <time>         Wait between read/writes
  -o, --output <filename>    Dump session data to a file
  -x, --hex-dump <filename>  Dump session data as hex to a file
  -i, --idle-timeout <time>  Idle read/write timeout
  -p, --source-port port     Specify source port to use
  -s, --source addr          Specify source address to use (doesn&#39;t affect -l)
  -l, --listen               Bind and listen for incoming connections
  -k, --keep-open            Accept multiple connections in listen mode
  -n, --nodns                Do not resolve hostnames via DNS
  -t, --telnet               Answer Telnet negotiations
  -u, --udp                  Use UDP instead of default TCP
      --sctp                 Use SCTP instead of default TCP
  -v, --verbose              Set verbosity level (can be used several times)
  -w, --wait <time>          Connect timeout
  -z                         Zero-I/O mode, report connection status only
      --append-output        Append rather than clobber specified output files
      --send-only            Only send data, ignoring received; quit on EOF
      --recv-only            Only receive data, never send anything
      --allow                Allow only given hosts to connect to Ncat
      --allowfile            A file of hosts allowed to connect to Ncat
      --deny                 Deny given hosts from connecting to Ncat
      --denyfile             A file of hosts denied from connecting to Ncat
      --broker               Enable Ncat&#39;s connection brokering mode
      --chat                 Start a simple Ncat chat server
      --proxy <addr[:port]>  Specify address of host to proxy through
      --proxy-type <type>    Specify proxy type ("http" or "socks4" or "socks5")
      --proxy-auth <auth>    Authenticate with HTTP or SOCKS proxy server
      --ssl                  Connect or listen with SSL
      --ssl-cert             Specify SSL certificate file (PEM) for listening
      --ssl-key              Specify SSL private key (PEM) for listening
      --ssl-verify           Verify trust and domain name of certificates
      --ssl-trustfile        PEM file containing trusted SSL certificates
      --ssl-ciphers          Cipherlist containing SSL ciphers to use
      --version              Display Ncat&#39;s version information and exit

nc Common Cases

TCP Listening Test

nc can be used as the server side 192.168.10.11 to start a tcp monitoring

nc -l 80

Client test method: directly telnet the machine ip port

telnet 192.168.10.11 80

Or: nmap 192.168.10.11 -p 80

UDP listening test

nc starts a udp as the server Monitoring

nc -lu 80

You can see through netstat that the udp protocol has been monitored:

> # netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address   Foreign Address   State  PID/Program name   
udp        0      0 0.0.0.0:80      0.0.0.0:*                15401/nc

Recommended tutorial: "centos tutorial"

The above is the detailed content of What is nc under centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn