Curl简单使用

 

Curl支持协议

 

DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP

 

常见用法

 
发送POST数据

curl -d "id=1"  -x 127.0.0.1:8080 http://xxxx.com

-x 选项是使用http代理(当然也支持SOcks代理,后面会有总结),这里面我用burp抓包

 

 
下载文件
 

curl -o ./test.zip http://xxx.com/xxx.zip

 
下载进度
 

curl -o -s  ./test.zip http://xxx.com/xxx.zip

 
自定义header
 

curl -H "Transfer-Encoding: chunked" http://example.com

 
自定义UA
 

curl --user-agent "aaa" http://www.baidu.com

 

支持的认证

 

digest
negotiate
ntlm
-u <username:password>

 

任意http方法

 

curl -X <POST/GET/OPTIONS/PUT> http://example.com

 

上传文件

 

支持:FILE, FTP, FTPS, HTTP, HTTPS, IMAP, IMAPS, SCP, SFTP, SMB, SMBS, SMTP, SMTPS and TFTP.

HTTP  curl -T test.zip http://xxx.com/   #PUT
FTP   curl -T test.zip ftp://xxx.com
SMTP  curl -T mail smtp://mail.example.com/ --mail-from user@example.com

 

网卡选择

 

curl --interface eth1 https://www.example.com/

curl --interface 192.168.0.2 https://www.example.com/

curl --interface machine2 https://www.example.com/

 

指定源端口

 

curl --local-port 4000-4200 https://example.com/

 

代理

 
支持 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/

 

 

Cookie

 

读取Cookie

curl -L -b cookies.txt http://example.com

将Cookie写入文件

curl -c cookie-jar.txt http://example.com

 

参考资料

 
https://payloads.online/archivers/2018-12-03/2

posted @ 2020-03-06 15:51  Zahad003  阅读(399)  评论(0编辑  收藏  举报