November 12, 2018

nc, s_client(plaintext/ciphertext communication with a server)


The Linux software for plaintext/ciphertext communication with a server.
서버와 평문/암호문 통신을 하는 리눅스 소프트웨어.




1. Feature  특징
01. Easy to use.
사용하기 간편.
02. "nc(netcat)" supports plaintext communication.
"nc"는 평문 통신을 지원한다.
03. "s client" supports ciphertext communication.
"s_client"는 암호문 통신을 지원한다.




2. How to install  설치 방법
01. Install using apt-get.
apt-get을 사용하여 설치.
nc: $ apt-get install nc
s_client: $ apt-get install openssl




3. How to use  사용법
❑ Connection.
접속.
[nc]: $ nc [Address] [Port]
$ nc bandit.labs.overthewire.org 30000
$ nc 176.9.9.172 30000
$ nc localhost 30000


[s_client]: $ openssl s_client -connect [Address]:[Port]
$ openssl s_client -connect bandit.labs.overthewire.org:30001
$ openssl s_client -connect 176.9.9.172:30001
$ openssl s_client -connect localhost:30001


❑ Multi-port connection.
다중 포트 접속.
[nc]: $nc [Address] [Port]-[Port]
$ nc bandit.labs.overthewire.org 20-25


❑ Port scan.
포트스캔.
[nc]
- TCP scan: $ nc -zvnw 1 bandit.labs.overthewire.org 20-25
- UDP scan: $ nc -zvunw 1 bandit.labs.overthewire.org 20-25


❑ Data transmission.
데이터 전송.
[nc]
- Receiver: nc -l (-p) 1234 > ./myFile.txt
- Sender: nc 192.168.x.x. 1234 < ./myFile.txt


❑ One-shot HTTP server.
일회용 HTTP 서버.
[nc]
- Server : (echo -e "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <./[Text file])\r\n\r\n"; cat ./[Text file];) | nc -l (-p) 8880
- Client : Connect to "http://[Address]:8880" with a web browser.  웹 브라우저로 "http://[Address]:8880"에 접속.


Check environment  점검 환경
O   S Ubuntu 16.04(64 bits) CPU Intel i7
SHELL GNU bash (4.3.48) RAM 1 GB