CURL 지원 프로토콜
DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP
TELNET
TELNET 예제
curl -v 'telnet://[IP]:[PORT]'
[user@host ~]$ curl -v telnet://10.0.2.16:8089
* About to connect() to 10.0.2.16 port 8089 (#0)
* Trying 10.0.2.16...
* Connected to 10.0.2.16 (10.0.2.16) port 8089 (#0)
HTTP
GET 예제
curl -v -X GET 'http://[IP]:[PORT]/[URL]?[PARAMETER]'
[user@host ~]$ curl -v -X GET 'http://10.0.2.16:8089/http/test01?key1=1&key2=2'
* About to connect() to 10.0.2.16 port 8089 (#0)
* Trying 10.0.2.16...
* Connected to 10.0.2.16 (10.0.2.16) port 8089 (#0)
> GET /http/test01?key1=1&key2=2 HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 10.0.2.16:8089
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 07 Feb 2022 04:14:59 GMT
< Content-Type: */*;charset=UTF-8
< Transfer-Encoding: chunked
<
* Connection #0 to host 10.0.2.16 left intact
key1=1&key2=2
POST 예제
curl -v -X POST -H '[HTTP HEADER]' 'http://[IP]:[PORT]/[URL]' -d '[DATA]'
[user@host ~]$ curl -v -X POST -H 'Content-type:application/json' 'http://10.0.2.16:8089/http/test01' -d '{"key1":{"key11":"value11","key12":"value12"},"key2":{"key21":"value21"}}'
* About to connect() to 10.0.2.16 port 8089 (#0)
* Trying 10.0.2.16...
* Connected to 10.0.2.16 (10.0.2.16) port 8089 (#0)
> POST /http/test01 HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 10.0.2.16:8089
> Accept: */*
> Content-type:application/json
> Content-Length: 73
>
* upload completely sent off: 73 out of 73 bytes
< HTTP/1.1 200 OK
< Date: Mon, 07 Feb 2022 04:08:21 GMT
< Content-Type: */*;charset=UTF-8
< Transfer-Encoding: chunked
<
* Connection #0 to host 10.0.2.16 left intact
{"key1":{"key11":"value11","key12":"value12"},"key2":{"key21":"value21"}}You have new mail in /var/spool/mail/anylink
SFTP
SFTP 예제
curl -v -k 'sftp://[IP]:[PORT]/[SRC FILE PATH]' -u '[USER]:[PASS]' -o '[TGT FILE PATH]' --ftp-create-dirs
[user@host ~]$ curl -v -k 'sftp://10.0.2.16/home/user/test.txt' -u 'username:password' -o '/home/user/test.txt' --ftp-create-dirs
* About to connect() to 10.0.2.16 port 22 (#0)
* Trying 10.0.2.16...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 10.0.2.16 (10.0.2.16) port 22 (#0)
* SSH MD5 fingerprint: uab58479d713020b59e910b610c9cad3
* SSH authentication methods available: publickey,password
* Using SSH private key file ''
* SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
* Initialized password authentication
* Authentication complete
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{ [data not shown]
100 400M 100 400M 0 0 26.7M 0 0:00:14 0:00:14 --:--:-- 33.7M
100 400M 100 400M 0 0 26.7M 0 0:00:14 0:00:14 --:--:-- 26.7M
* Connection #0 to host 10.0.2.16 left intact
'알아두면 좋은 IT 지식 > Network' 카테고리의 다른 글
[IT] Telnet의 전송키는 Enter키가 아니다? (Not Enter But Ctrl+D?) (0) | 2022.08.05 |
---|---|
[리눅스] TCP 소켓 통신 테스트 명령어 nc(ncat) 사용법 (0) | 2022.07.18 |
[리눅스] 가장 간단한 3가지 통신 테스트 방법 (telnet, curl, /dev/tcp) (0) | 2022.06.24 |
윈도우 서버 원격 데스크톱 연결 사용법 / 클립보드 설정 (0) | 2020.09.09 |
실무에서 telnet 명령어를 사용하여 간단하게 방화벽 확인하는 방법 (0) | 2020.09.08 |