内容简介:cURL是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所以是综合传输工具,但按传统,习惯称cURL为下载工具。cURL还包含了用于程序开发的libcurl。 – BaiduDICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTPRef
cURL是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所以是综合传输工具,但按传统,习惯称cURL为下载工具。cURL还包含了用于程序开发的libcurl。 – Baidu
0x01 cURL支持的协议
DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP
Ref:https://ec.haxx.se/protocols-curl.html
0x02 常用选项
curl -v http://example.com curl -L http://example.com curl -d "username=Rvn0xsy" http://example.com curl -o ~/Download/down.zip http://example.com/download.zip curl -s -o ~/Download/down.zip http://example.com/download.zip curl -O ~/Download/down.zip http://example.com/download.zip curl http://example.com/ --limit-rate 200K curl --max-filesize 100000 http://example.com/ curl --range 100-1099 http://example.com/download.zip curl --data-urlencode "name=John Doe (Junior)" http://example.com curl --data-urlencode user@contents.txt http://example.com #user的内容再contents.txt中 curl -G http://example.com curl -H "Transfer-Encoding: chunked" http://example.com curl --user-agent/-A/-H 'User-Agent: http://example.com'
0x03 认证
cURL支持四种认证:
-u <username:password>
0x04 任意HTTP方法
cURL -X <POST/GET/OPTIONS/PUT> http://example.com
0x04 上传文件
支持:FILE, FTP, FTPS, HTTP, HTTPS, IMAP, IMAPS, SCP, SFTP, SMB, SMBS, SMTP, SMTPS and TFTP.
HTTP: curl -T upload.zip http://example.com/ # PUT
FTP: curl -T upload.zip ftp://example.com/
SMTP: curl -T mail smtp://mail.example.com/ --mail-from user@example.com
0x05 网卡
curl --interface eth1 https://www.example.com/ curl --interface 192.168.0.2 https://www.example.com/ curl --interface machine2 https://www.example.com/
0x06 指定源端口
curl --local-port 4000-4200 https://example.com/
0x07 代理
支持代理:
- http
- socks
curl -x 192.168.0.1:8080 http:/example.com/ curl -x socks4://proxy.example.com http://www.example.com/ curl --socks4 proxy.example.com http://www.example.com/ curl --socks4a proxy.example.com http://www.example.com/ curl -x socks4a://proxy.example.com http://www.example.com/ curl -x socks5://proxy.example.com http://www.example.com/ curl --socks5 proxy.example.com http://www.example.com/ curl -x socks5h://proxy.example.com http://www.example.com/ curl --socks5-hostname proxy.example.com http://www.example.com/
代理认证
curl -U daniel:secr3t -x myproxy:80 http://example.com
0x08 HTML表单上传文件
<form action="submit.cgi" method="post" enctype="multipart/form-data"> Name: <input type="text" name="person"><br> File: <input type="file" name="secret"><br> <input type="submit" value="Submit"> </form>
curl -F person=anonymous -F secret=@file.txt http://example.com/submit.cgi
0x09 COOKIE
读取cookie
curl -L -b cookies.txt http://example.com
将cookie写入文件
curl -c cookie-jar.txt http://example.com
REF
- https://legacy.gitbook.com/book/bagder/everything-curl
以上所述就是小编给大家介绍的《cURL工具的使用技巧》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- slice的一些使用技巧
- 分享一些 Broadcast 使用技巧
- AndroidStudio使用技巧-debug篇
- PyCharm/IDEA 使用技巧总结
- IDEA 超实用使用技巧分享
- FairyGUI的使用技巧和优化建议
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Writing Windows VxDs and Device Drivers, Second Edition
Karen Hazzah / CMP / 1996-01-12 / USD 54.95
Software developer and author Karen Hazzah expands her original treatise on device drivers in the second edition of "Writing Windows VxDs and Device Drivers." The book and companion disk include the a......一起来看看 《Writing Windows VxDs and Device Drivers, Second Edition》 这本书的介绍吧!