安全工具-curl学习_curl --aws-sigv4

 --egd-file <file>  EGD socket path for random data
 --engine <name>  Crypto engine to use
 --etag-compare <file>  Pass an ETag from a file as a custom header
 --etag-save <file>  Parse ETag from a request and save it to a file
 --expect100-timeout <seconds>  How long to wait for 100-continue

-f, --fail Fail silently (no output at all) on HTTP errors
–fail-early Fail on first transfer error, do not continue
–fail-with-body Fail on HTTP errors but save the body
–false-start Enable TLS False Start
-F, --form <name=content> Specify multipart MIME data
–form-string <name=string> Specify multipart MIME data
–ftp-account Account data string
–ftp-alternative-to-user String to replace USER [name]
–ftp-create-dirs Create the remote dirs if not present
–ftp-method Control CWD usage
–ftp-pasv Use PASV/EPSV instead of PORT
-P, --ftp-port

Use PORT instead of PASV
–ftp-pret Send PRET before PASV
–ftp-skip-pasv-ip Skip the IP address for PASV
–ftp-ssl-ccc Send CCC after authenticating
–ftp-ssl-ccc-mode <active/passive> Set CCC mode
–ftp-ssl-control Require SSL/TLS for FTP login, clear for transfer
-G, --get Put the post data in the URL and use GET
-g, --globoff Disable URL sequences and ranges using {} and []
–happy-eyeballs-timeout-ms Time for IPv6 before trying IPv4
–haproxy-protocol Send HAProxy PROXY protocol v1 header
-I, --head Show document info only
-H, --header header/@file Pass custom header(s) to server
-h, --help Get help for commands
–hostpubmd5 Acceptable MD5 hash of the host public key
–hsts Enable HSTS with this cache file
–http0.9 Allow HTTP 0.9 responses
-0, --http1.0 Use HTTP 1.0
–http1.1 Use HTTP 1.1
–http2 Use HTTP 2
–http2-prior-knowledge Use HTTP 2 without HTTP/1.1 Upgrade
–http3 Use HTTP v3
–ignore-content-length Ignore the size of the remote resource
-i, --include Include protocol response headers in the output
-k, --insecure Allow insecure server connections when using SSL
–interface Use network INTERFACE (or address)
-4, --ipv4 Resolve names to IPv4 addresses
-6, --ipv6 Resolve names to IPv6 addresses
-j, --junk-session-cookies Ignore session cookies read from file
–keepalive-time Interval time for keepalive probes
–key Private key file name
–key-type Private key file type (DER/PEM/ENG)
–krb Enable Kerberos with security
–libcurl Dump libcurl equivalent code of this command line
–limit-rate Limit transfer speed to RATE
-l, --list-only List only mode
–local-port <num/range> Force use of RANGE for local port numbers
-L, --location Follow redirects
–location-trusted Like --location, and send auth to other hosts
–login-options Server login options
–mail-auth
Originator address of the original email
–mail-from
Mail from this address
–mail-rcpt
Mail to this address
–mail-rcpt-allowfails Allow RCPT TO command to fail for some recipients
-M, --manual Display the full manual
–max-filesize Maximum file size to download
–max-redirs Maximum number of redirects allowed
-m, --max-time Maximum time allowed for the transfer
–metalink Process given URLs as metalink XML file
–negotiate Use HTTP Negotiate (SPNEGO) authentication
-n, --netrc Must read .netrc for user name and password
–netrc-file Specify FILE for netrc
–netrc-optional Use either .netrc or URL
-:, --next Make next URL use its separate set of options
–no-alpn Disable the ALPN TLS extension
-N, --no-buffer Disable buffering of the output stream
–no-keepalive Disable TCP keepalive on the connection
–no-npn Disable the NPN TLS extension
–no-progress-meter Do not show the progress meter
–no-sessionid Disable SSL session-ID reusing
–noproxy List of hosts which do not use proxy
–ntlm Use HTTP NTLM authentication
–ntlm-wb Use HTTP NTLM authentication with winbind
–oauth2-bearer OAuth 2 Bearer Token
-o, --output Write to file instead of stdout
–output-dir Directory to save files in
-Z, --parallel Perform transfers in parallel
–parallel-immediate Do not wait for multiplexing (with --parallel)
–parallel-max Maximum concurrency for parallel transfers
–pass Pass phrase for the private key
–path-as-is Do not squash … sequences in URL path
–pinnedpubkey FILE/HASHES Public key to verify peer against
–post301 Do not switch to GET after following a 301
–post302 Do not switch to GET after following a 302
–post303 Do not switch to GET after following a 303
–preproxy [protocol://]host[:port] Use this proxy first
-#, --progress-bar Display transfer progress as a bar
–proto Enable/disable PROTOCOLS
–proto-default Use PROTOCOL for any URL missing a scheme
–proto-redir Enable/disable PROTOCOLS on redirect
-x, --proxy [protocol://]host[:port] Use this proxy
–proxy-anyauth Pick any proxy authentication method
–proxy-basic Use Basic authentication on the proxy
–proxy-cacert CA certificate to verify peer against for proxy
–proxy-capath CA directory to verify peer against for proxy
–proxy-cert <cert[:passwd]> Set client certificate for proxy
–proxy-cert-type Client certificate type for HTTPS proxy
–proxy-ciphers SSL ciphers to use for proxy
–proxy-crlfile Set a CRL list for proxy
–proxy-digest Use Digest authentication on the proxy
–proxy-header header/@file Pass custom header(s) to proxy
–proxy-insecure Do HTTPS proxy connections without verifying the proxy
–proxy-key Private key for HTTPS proxy
–proxy-key-type Private key file type for proxy
–proxy-negotiate Use HTTP Negotiate (SPNEGO) authentication on the proxy
–proxy-ntlm Use NTLM authentication on the proxy
–proxy-pass Pass phrase for the private key for HTTPS proxy
–proxy-pinnedpubkey FILE/HASHES public key to verify proxy with
–proxy-service-name SPNEGO proxy service name
–proxy-ssl-allow-beast Allow security flaw for interop for HTTPS proxy
–proxy-ssl-auto-client-cert Use auto client certificate for proxy (Schannel)
–proxy-tls13-ciphers TLS 1.3 proxy cipher suites
–proxy-tlsauthtype TLS authentication type for HTTPS proxy
–proxy-tlspassword TLS password for HTTPS proxy
–proxy-tlsuser TLS username for HTTPS proxy
–proxy-tlsv1 Use TLSv1 for HTTPS proxy
-U, --proxy-user user:password Proxy user and password
–proxy1.0 <host[:port]> Use HTTP/1.0 proxy on given port
-p, --proxytunnel Operate through an HTTP proxy tunnel (using CONNECT)
–pubkey SSH Public key file name
-Q, --quote Send command(s) to server before transfer
–random-file File for reading random data from
-r, --range Retrieve only the bytes within RANGE
–raw Do HTTP “raw”; no transfer decoding
-e, --referer Referrer URL
-J, --remote-header-name Use the header-provided filename
-O, --remote-name Write output to a file named as the remote file
–remote-name-all Use the remote file name for all URLs
-R, --remote-time Set the remote file’s time on the local output
-X, --request Specify request command to use
–request-target Specify the target for this request
–resolve <[+]host:port:addr[,addr]…> Resolve the host+port to this address
–retry Retry request if transient problems occur
–retry-all-errors Retry all errors (use with --retry)
–retry-connrefused Retry on connection refused (use with --retry)
–retry-delay Wait time between retries
–retry-max-time Retry only within this period
–sasl-authzid Identity for SASL PLAIN authentication
–sasl-ir Enable initial response in SASL authentication
–service-name SPNEGO service name
-S, --show-error Show error even when -s is used
-s, --silent Silent mode
–socks4 <host[:port]> SOCKS4 proxy on given host + port
–socks4a <host[:port]> SOCKS4a proxy on given host + port
–socks5 <host[:port]> SOCKS5 proxy on given host + port
–socks5-basic Enable username/password auth for SOCKS5 proxies
–socks5-gssapi Enable GSS-API auth for SOCKS5 proxies
–socks5-gssapi-nec Compatibility with NEC SOCKS5 server
–socks5-gssapi-service SOCKS5 proxy service name for GSS-API
–socks5-hostname <host[:port]> SOCKS5 proxy, pass host name to proxy
-Y, --speed-limit Stop transfers slower than this
-y, --speed-time Trigger ‘speed-limit’ abort after this time
–ssl Try SSL/TLS
–ssl-allow-beast Allow security flaw to improve interop
–ssl-auto-client-cert Use auto client certificate (Schannel)
–ssl-no-revoke Disable cert revocation checks (Schannel)
–ssl-reqd Require SSL/TLS
–ssl-revoke-best-effort Ignore missing/offline cert CRL dist points
-2, --sslv2 Use SSLv2
-3, --sslv3 Use SSLv3
–stderr Where to redirect stderr
–styled-output Enable styled output for HTTP headers
–suppress-connect-headers Suppress proxy CONNECT response headers
–tcp-fastopen Use TCP Fast Open
–tcp-nodelay Use the TCP_NODELAY option
-t, --telnet-option <opt=val> Set telnet option
–tftp-blksize Set TFTP BLKSIZE option
–tftp-no-options Do not send any TFTP options
-z, --time-cond


通过curl --help all帮助命令,我们可以看到所有的选项,这里学几个常用的选项


## 无选项


### 命令



curl http://httpbin.org


### 结果


**命令行结果**  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/9fdd048349984bf2b1b023c6364f80e3.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到返回了html页面  
 **wireshark抓包结果**  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/e7f30b0138a844ce9a3f58f8b8fb26fd.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到curl发送了一个HTTP1.1的GET请求,添加了请求头HOST、User-Agent和Accept。其中User-Agent是版本。  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/83934af121d24c6cb8bf06a1c9fd4fa5.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到httpbin.org的响应包含了头部和数据,数据就是curl显示的html页面代码。那么头部curl如何显示呢?请继续阅读。


## 请求头


### 仅显示返回的头部


-I选项


#### 命令



curl http://httpbin.org -I


#### 结果


![在这里插入图片描述](https://img-blog.csdnimg.cn/fe9c58cb3d774d50ba7d9270c13a702d.png#pic_center)  
 可以看到仅显示了头部


### 保存返回的头部



-D


#### 命令



curl http://httpbin.org -D recv_head.txt


#### 结果


![在这里插入图片描述](https://img-blog.csdnimg.cn/67d207be50054f82b0074fc5dd294d00.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到添加了将返回数据包的头部保存到E盘下recv\_head.txt文件的选项,打开文件  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/c880fe21746746f2b6c25866a9fc1261.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_10,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到和前面抓包的结果一样。


### 添加请求头



-H header/@file


请求头使用key: value的形式


#### 命令



curl -H “blog: lady_killer9” -H “User-Agent: firefox” http://httpbin.org


#### 结果


![在这里插入图片描述](https://img-blog.csdnimg.cn/bfe4ff5aa7dc45a4b3ee720a5be2d34f.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/6b62fa43b57948f58a63c299de8f90e4.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到覆盖了自带的User-Agent,添加了新的请求头部blog


### 覆盖User-Agent的值


UserAgent是经常用的,可以使用-A直接替换value



-A


#### 命令



curl -A chrome http://httpbin.org


#### 结果


![在这里插入图片描述](https://img-blog.csdnimg.cn/e9ea0f8ebd554aafb2fd2c5d47b040ae.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/7f51cad7ae0a4e58abc55958ea3c5017.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到User-Agent修改了


## GET请求


默认发送的就是GET请求,这里说一下如何添加参数。一般在url上使用?添加参数即可,注意,如果不转义的话,使用双引号。  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/d108a618106542198ba5094d3b225124.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/aa1960c054124dd88085b1da0f708197.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 也可以使用-G选项配合-d选项添加  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/62ba8e2df2074831860db5c19d1848cb.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/79967585ef224f1b8fee49548bdb93bd.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)


## POST请求


-X指定请求,-d添加数据



-X
-d


#### 表单



curl -X POST -d “blog=lady_killer&name=9” http://httpbin.org/post


![在这里插入图片描述](https://img-blog.csdnimg.cn/03ff141a039b4c91a19c68062bd6893a.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_19,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/fd02ab180bcc4e1794e2e305e713e199.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAbGFkeV9raWxsZXI5,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)  
 可以看到添加了curl相比GET又添加了两个请求头Content-Length和Content-Type


#### json
## 最后

**自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。**

**深知大多数网络安全工程师,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!**

**因此收集整理了一份《2024年网络安全全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。**

![img](https://img-blog.csdnimg.cn/img_convert/476147d6e29e8a7197d7380c35abd9a6.png)

![img](https://img-blog.csdnimg.cn/img_convert/4493240235dce929353faf085fc66a34.png)

![img](https://img-blog.csdnimg.cn/img_convert/29eb58991f3f61a6c44e70951ceda678.png)

![img](https://img-blog.csdnimg.cn/img_convert/556b7a3964f9c8da780f92e3a91a02eb.png)

![img](https://img-blog.csdnimg.cn/img_convert/ee21e051739ccb9a035b5e9e48d5b1f3.png)

 

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上网络安全知识点!真正的体系化!**

[**如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!**](https://bbs.csdn.net/topics/618653875)

**由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!**

中...(img-xC9PA0B5-1715654821303)]

[外链图片转存中...(img-1mJcejbf-1715654821303)]

[外链图片转存中...(img-cHZS6Pdi-1715654821303)]

[外链图片转存中...(img-oIFBb77J-1715654821303)]

 

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上网络安全知识点!真正的体系化!**

[**如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!**](https://bbs.csdn.net/topics/618653875)

**由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!**

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值