본문 바로가기
아이티 공부/리눅스

-bash: nc: command not found (nc 패키지 설치)

by Klero 2019. 9. 24.
반응형

테스트 환경 : CentOS7, Amazon Linux 2


위와 같은 환경에서 nc 명령어를 사용했더니 -bash: nc: command not found 에러가 발생했다.

즉, nc 패키지가 리눅스에 설지되지 않아서 명령어를 찾을 수 없다는 에러가 발생한 것이다.

그래서 nc 패키지를 설치 하기 위한 명령어를 구글에 계속 검색했으나 확실한 명령어를 찾을 수 없어 많은 시간을 소비했다.


혹시나 나와 같은 분들이 계실까봐 조금이나마 도움이 되시라고 글을 포스팅하게 되었다.

이 명령어를 통해 설치하면 nc 명령어를 사용할 수 있다. sudo yum install -y nmap-ncat

 



참고로 nmap은 Network Map을 뜻하며 네트워크에 연결되어 있는 호스트들의 정보를 파악 하는 도구이다.

ncat은 Network cat을 뜻하며 네트워크를 입출력 할 수 있는 도구라고 생각하면 된다.

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'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'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's version information and exit

댓글