在渗透中curl的常见用法

安全工具 2017-11-19

curl是利用URL语法在命令行方式下工作的开源文件传输工具。其功能以及参数非常多,然而,我们在渗透测试中可以用curl做什么呢?下面就举例说一下,欢迎大家拍砖!工具下载地址如下:

https://curl.haxx.se/download.html

常规访问

curl http://www.myh0st.cn

文件名正则

curl ftp://ftp.myh0st.cn/file[1-100].txt

curl ftp://ftp.myh0st.cn/file[1-100:10].txt

curl ftp://ftp.myh0st.cn/file[001-100].txt

curl ftp://ftp.myh0st.cn/file[a-z].txt

curl ftp://ftp.myh0st.cn/file[a-z:2].txt

域名正则

curl http://site.{one,two,three}.com

目录正则

curl http://www.myh0st.cn/archive[1996-1999]/vol[1-4]/part{a,b,c}.html


常规下载页面

curl -o index.html http://www.myh0st.cn/

curl http://www.myh0st.cn/ > index.html

添加下载进度条

curl -# http://www.myh0st.cn/ > index.html


使用不同的版本的http协议

默认1.0版本

curl -0 http://www.myh0st.cn

指定版本

curl --http1.1 http://www.myh0st.cn

curl --http2 http://www.myh0st.cn


使用不同的ssl版本访问

tlsv1

curl -1 http://www.myh0st.cn

curl --tlsv1 http://www.myh0st.cn

sslv2

curl -2 http://www.myh0st.cn

curl --sslv2 http://www.myh0st.cn

sslv3

curl -3 http://www.myh0st.cn

curl --sslv3 http://www.myh0st.cn


使用不同的ip协议

ipv4

curl -4 http://www.myh0st.cn

curl --ipv4 http://www.myh0st.cn

ipv6

curl -6 http://www.myh0st.cn

curl --ipv6 http://www.myh0st.cn

指定user-agent

curl -A "wget/1.0" http://www.myh0st.cn

curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" http://www.myh0st.cn

curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" http://www.myh0st.cn

指定cookie

curl -b "phpsession=Testtest" http://www.myh0st.cn

curl --cookie "name=Daniel" http://www.myh0st.cn

指定cookie文件

curl -c cookies.txt http://www.myh0st.cn

curl --cookie-jar cookies.txt http://www.myh0st.cn

提交post数据

curl -d "username=admin&password=pass" http://www.myh0st.cn

curl --data "birthyear=1905&press=%20OK%20" http://www.myh0st.cn/when.cgi

curl --data-urlencode "name=I am Daniel" http://curl.haxx.se

curl --data "<xml>" --header "Content-Type: text/xml" --request PROPFIND url.com

指定referer

curl -e "http://www.myh0st.cn/referer" http://www.myh0st.cn

curl --referer http://www.myh0st.cn/referer http://www.myh0st.cn

指定header

curl --header "Host:www.myh0st.cn" http://www.myh0st.cn

显示访问网页的header

curl -D - http://www.myh0st.cn

curl --dump-header headers_and_cookies http://www.myh0st.cn

跟随location跳转页面

curl -L http://www.myh0st.cn

curl --location http://www.myh0st.cn

指定dns访问网站

curl --dns-servers 8.8.8.8 http://www.myh0st.cn

指定证书访问https的网页

curl --cert mycert.pem https://www.myh0st.cn

总结

大家可以下载这个软件自己把玩一下,可能整理的不全,作为一款优秀的命令行版网页浏览工具,在实际的渗透中可以帮我们很多,有没有用全看自己如何去玩。有什么建议或者意见请下方留言。


本文由 信安之路 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

楼主残忍的关闭了评论