ホームページ  >  記事  >  運用・保守  >  centos の nc とは何ですか

centos の nc とは何ですか

WBOY
WBOYオリジナル
2022-03-23 18:44:253746ブラウズ

centos の NC は「netcat」の略称です。これは、ポート スキャン、ファイル転送などに使用できるネットワーク ツールです。nc は、TCP および UDP ポートでのリッスンも実装できます。 「yum install nc -y」コマンドでインストールします。

centos の nc とは何ですか

この記事の動作環境: centos 7 システム、Dell G3 コンピューター。

centos の nc とは

nc は netcat ツールの略称で、ポート スキャン、ファイル転送、その他の機能に使用できるネットワーク ツールです。 。

centos へのインストールも非常に簡単です:

yum install nc -y

nc よく使用される関数

  • 任意の TCP /UDP ポート リッスンを実現します。nc は、TCP または UDP モードで指定されたポートをリッスンするサーバーとして機能します。

  • ポート スキャン。nc は、TCP を開始するクライアントとして機能します。または UDP 接続

  • マシン間のファイル転送

  • マシン間のネットワーク速度テスト

通常は ncは TCP/UDP プロトコルのポート テストにのみ使用されます。他の機能は控えめに使用する必要があります。

nc ヘルプの説明

# 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 一般的なケース

TCP リスニング テスト

nc をサーバー側 192.168.10.11 として使用して、TCP 監視を開始できます

nc -l 80

クライアント テスト方法: マシンの IP ポート

telnet 192.168 に直接 Telnet します。 10.11 80

または: nmap 192.168.10.11 -p 80

UDP listen test

nc は udp をサーバーの監視

nc -lu 80

netstat を通じて、udp プロトコルが監視されていることを確認できます:

> # 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

推奨チュートリアル: "centos チュートリアル "

以上がcentos の nc とは何ですかの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。