Curl 사용법

2020. 5. 1. 07:142020/Web Pentesting

# curl --help

# man curl

 

1. 웹 페이지의 소스코드를 읽어들여서 파일에 저장할 수 있다.

# curl -o /home/curlOutput/naver.txt http://naver.com 

 

2. 파일을 다운로드 할 수 있다.

# curl -o fileName DownloadLink

 

3. 웹 페이지가 사용자를 다른 사이트로 리다이렉트시키는 경우

# curl https://eunhwan.com

만약 위 사이트가 다른 사이트로 리다이렉트를 실행하도록 한다면?

# curl -L https://eunhwan.com 

L 옵션을 사용해서  리다이렉트 페이지로 이동해서 소스코드를 얻을 수 있다.

 

4. Request 요청을 보내고 서버로부터 Response응답을 받아온다.

# curl -I https://eunhwan.com => 오직 헤더 값만을 받아온다.

# curl -i https//eunhwan.com  => 응답 데이터 및 헤더 데이터를 받아들인다.

 

5. verbose

# curl -v https://eunhwan.com 

 

6. 파라미터를 조작할 수 있다 (--data or -d)

# curl --data "user=admin&pwd=password" https://eunhwan.com/login.php 

변수명 user, pwd로써 해당 데이터가 포함되어 패킷이 전송된다.

만약 해당 페이지에서 이 변수들을 사용한다면 브루트포스 공격을 진행할 수 있을 것이다.

 

[ GET Method ]

# curl https://eunhwan.com -H "Accept:application/json"  - 헤더값 조작

[ POST Method ]

# curl -X POST -H "Accept:application/json" https:/eunhwan.com -d '{"name": "eun", "job":"student"}'

 

 

# curl -o [output] [url]

- 웹 페이지를 얻고 로컬 파일에 저장한다. (.html or .txt)

# echo "user=user:passwod" | curl -K - https://eunhwan.com  

-K옵션과 - 를 통해 명령어 설정 사용자로부터 입력받아서 명령을 실행한다.

 

 

 

# curl -o [PathToStore] [URL]

 

# curl -i [URL] 

 

# curl -I [URL]

 

# curl -X POST --data "var1=value1&var2=value2" [URL]

 

 

'2020 > Web Pentesting' 카테고리의 다른 글

OWASP Juice shop Difficulty 3  (0) 2020.04.28
OWASP Juice shop Difficulty 2  (0) 2020.04.24
OWASP Juice shop Difficulty 1  (0) 2020.04.24