-I Show document info only 只展示headers,发起HEAD请求 -o Write output to file instead of stdout 保存到本地 -x 用这个option可以指定http访问所使用的proxy服务器及其端口 -v Make the operation more talkative 可以显示一次http通信的整个过程,包括端口连接和http -H Custom header to pass to server 添加header -A/–user-agent [string] 指定UA访问 -e, --referer URL 指定referer --resolve HOST:PORT:ADDRESS Force resolve of HOST:PORT to ADDRESS -X -d 这里的X是大写,-X POST发起POST请求
通过61.156.15.39的80端口 访问 http://mat1.gtimg.com/www/images/qq2012/weiboIcon.png 只展示 返回头
curl -I 'http://mat1.gtimg.com/www/images/qq2012/weiboIcon.png' -x 61.156.15.39:80 HTTP/1.1 200 OK Server: X2_Platform Connection: keep-alive Date: Tue, 29 Aug 2017 11:46:50 GMT Cache-Control: max-age=600 Expires: Tue, 29 Aug 2017 11:56:50 GMT Last-Modified: Wed, 03 Sep 2014 07:35:47 GMT Content-Type: image/png Content-Length: 1320 X-NWS-LOG-UUID: a2c0b82e-26ca-49d6-8b0a-7bf7454a9167 aa3427e8cc9ad3ae0642cf3e63b08ea2 Access-Control-Expose-Headers: X-Client-Ip Access-Control-Expose-Headers: X-Server-Ip Access-Control-Expose-Headers: X-Upstream-Ip X-Client-Ip: 119.29.119.193 X-Server-Ip: 61.156.15.39 X-Upstream-Ip: X-Cache-Lookup: Hit From Disktank
curl -o weiboIcon.png 'http://mat1.gtimg.com/www/images/qq2012/weiboIcon.png' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1320 100 1320 0 0 12005 0 --:--:-- --:--:-- --:--:-- 12110 [root@VM_105_254_centos tmp]# ll total 4 -rw-r--r-- 1 root root 1320 Aug 29 19:47 weiboIcon.png
https查看证书详情,请求到的IP信息,请求header,返回header
curl -vo /dev/null 'https://mc.qcloudimg.com/static/img/ae4bfa87aae5714c1c74dd9e134f5a29/image.png' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mc.qcloudimg.com port 443 (#0) * Trying 218.11.8.104... * Connected to mc.qcloudimg.com (218.11.8.104) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: * subject: CN=*.qcloudimg.com,OU=R&D,O=Shenzhen Tencent Computer Systems Company Limited,L=Shenzhen,ST=Guangdong,C=CN * start date: Jul 28 00:00:00 2016 GMT * expire date: Jul 28 23:59:59 2019 GMT * common name: *.qcloudimg.com * issuer: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US > GET /static/img/ae4bfa87aae5714c1c74dd9e134f5a29/image.png HTTP/1.1 > User-Agent: curl/7.29.0 > Host: mc.qcloudimg.com > Accept: */* > < HTTP/1.1 200 OK < Server: NWSs < Date: Tue, 29 Aug 2017 11:48:22 GMT < Content-Type: image/png < Content-Length: 38325 < Connection: keep-alive < Cache-Control: max-age=2592000 < Expires: Thu, 28 Sep 2017 11:48:22 GMT < Last-Modified: Mon, 14 Aug 2017 08:51:52 GMT < X-NWS-LOG-UUID: c977832c-4772-45b2-8da7-904df04c5235 < X-Cache-Lookup: Hit From Disktank3 < Accept-Ranges: bytes < X-Daa-Tunnel: hop_count=1 < X-Cache-Lookup: Hit From Inner Cluster < { [data not shown] 100 38325 100 38325 0 0 102k 0 --:--:-- --:--:-- --:--:-- 102k * Connection #0 to host mc.qcloudimg.com left intact
如果是http可以直接 -x 14.204.144.142:80 https需要 --resolve mc.qcloudimg.com:443:14.204.144.142 即--resolve host:端口:ip
curl -vo /dev/null 'https://mc.qcloudimg.com/static/img/ae4bfa87aae5714c1c74dd9e134f5a29/image.png' --resolve mc.qcloudimg.com:443:14.204.144.142 * Added mc.qcloudimg.com:443:14.204.144.142 to DNS cache * About to connect() to mc.qcloudimg.com port 443 (#0) * Trying 14.204.144.142... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to mc.qcloudimg.com (14.204.144.142) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: * subject: CN=*.qcloudimg.com,OU=R&D,O=Shenzhen Tencent Computer Systems Company Limited,L=Shenzhen,ST=Guangdong,C=CN * start date: Jul 28 00:00:00 2016 GMT * expire date: Jul 28 23:59:59 2019 GMT * common name: *.qcloudimg.com * issuer: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US > GET /static/img/ae4bfa87aae5714c1c74dd9e134f5a29/image.png HTTP/1.1 > User-Agent: curl/7.29.0 > Host: mc.qcloudimg.com > Accept: */* > < HTTP/1.1 200 OK < Server: NWSs < Date: Tue, 29 Aug 2017 12:02:33 GMT < Content-Type: image/png < Content-Length: 38325 < Connection: keep-alive < Cache-Control: max-age=2592000 < Expires: Thu, 28 Sep 2017 12:02:32 GMT < Last-Modified: Mon, 14 Aug 2017 08:51:52 GMT < X-NWS-LOG-UUID: d6e89516-13a1-453e-9382-4cfce5b203bd < X-Cache-Lookup: Hit From Disktank3 < Accept-Ranges: bytes < X-Daa-Tunnel: hop_count=1 < X-Cache-Lookup: Hit From Inner Cluster < { [data not shown] 100 38325 100 38325 0 0 161k 0 --:--:-- --:--:-- --:--:-- 161k * Connection #0 to host mc.qcloudimg.com left intact
curl -vo /dev/null -H "Accept-Encoding: gzip,deflate" 'https://img3.doubanio.com/f/shire/25e3b87e05e5de459e1473fad35d25cafd392ad6/css/core/_init_.css' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to img3.doubanio.com port 443 (#0) * Trying 124.227.27.226... * Connected to img3.doubanio.com (124.227.27.226) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: * subject: CN=*.doubanio.com,OU=Technology Department,O=Beijing Douwang Technology Co. Ltd.,L=Beijing,ST=Beijing,C=CN * start date: May 23 00:00:00 2017 GMT * expire date: Jul 05 23:59:59 2019 GMT * common name: *.doubanio.com * issuer: CN=GeoTrust SSL CA - G3,O=GeoTrust Inc.,C=US > GET /f/shire/25e3b87e05e5de459e1473fad35d25cafd392ad6/css/core/_init_.css HTTP/1.1 > User-Agent: curl/7.29.0 > Host: img3.doubanio.com > Accept: */* > Accept-Encoding: gzip,deflate > < HTTP/1.1 200 OK < Server: Tengine < Content-Type: text/css < Transfer-Encoding: chunked < Connection: keep-alive < Vary: Accept-Encoding < Date: Tue, 23 May 2017 02:48:22 GMT < Expires: Wed, 23 May 2018 02:48:22 GMT < Cache-Control: max-age=31536000 < Last-Modified: Wed, 21 Jan 2004 19:51:30 GMT < Vary: Accept-Encoding < Via: cache6.l2st4-3[0,200-0,H], cache20.l2st4-3[2,0], cache4.cn775[0,200-0,H], cache5.cn775[0,0] < Age: 8502171 < X-Cache: HIT TCP_MEM_HIT dirn:4:6027639 < X-Swift-SaveTime: Mon, 14 Aug 2017 11:45:29 GMT < X-Swift-CacheTime: 15552000 < Timing-Allow-Origin: * < EagleId: 7ce31b9915040098733093939e < Content-Encoding: gzip < { [data not shown] 100 7444 0 7444 0 0 46758 0 --:--:-- --:--:-- --:--:-- 46817 * Connection #0 to host img3.doubanio.com left intact
curl -e 'http://www.bigmen.cn' 'http://mat1.gtimg.com/www/images/qq2012/weiboIcon.png' -vo /dev/null % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mat1.gtimg.com port 80 (#0) * Trying 27.221.81.38... * Connected to mat1.gtimg.com (27.221.81.38) port 80 (#0) > GET /www/images/qq2012/weiboIcon.png HTTP/1.1 > User-Agent: curl/7.29.0 > Host: mat1.gtimg.com > Accept: */* > Referer: http://www.bigmen.cn > < HTTP/1.1 200 OK < Server: X2_Platform < Connection: keep-alive < Date: Tue, 29 Aug 2017 12:35:56 GMT < Cache-Control: max-age=600 < Expires: Tue, 29 Aug 2017 12:45:56 GMT < Last-Modified: Wed, 03 Sep 2014 07:35:47 GMT < Content-Type: image/png < Content-Length: 1320 < X-NWS-LOG-UUID: b9831f5f-6144-43d9-b00d-bee2bbf01d53 6a93446aaa8e62f1e3b39997d017a315 < Access-Control-Expose-Headers: X-Client-Ip < Access-Control-Expose-Headers: X-Server-Ip < Access-Control-Expose-Headers: X-Upstream-Ip < X-Client-Ip: 119.29.119.193 < X-Server-Ip: 27.221.81.38 < X-Upstream-Ip: < X-Cache-Lookup: Hit From Disktank < { [data not shown] 100 1320 100 1320 0 0 14928 0 --:--:-- --:--:-- --:--:-- 15000 * Connection #0 to host mat1.gtimg.com left intact
curl -H "Host:mat1.gtimg.com" 'http://61.156.15.28/www/images/qq2012/weiboIcon.png' -vo /dev/null * About to connect() to 61.156.15.28 port 80 (#0) * Trying 61.156.15.28... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 61.156.15.28 (61.156.15.28) port 80 (#0) > GET /www/images/qq2012/weiboIcon.png HTTP/1.1 > User-Agent: curl/7.29.0 > Accept: */* > Host:mat1.gtimg.com > < HTTP/1.1 200 OK < Server: X2_Platform < Connection: keep-alive < Date: Tue, 29 Aug 2017 12:41:52 GMT < Cache-Control: max-age=600 < Expires: Tue, 29 Aug 2017 12:51:52 GMT < Last-Modified: Wed, 03 Sep 2014 07:35:47 GMT < Content-Type: image/png < Content-Length: 1320 < X-NWS-LOG-UUID: 4b9db60e-8b43-4812-a5b9-41032ef7d443 aa3427e8cc9ad3ae6f9a23387443675b < Access-Control-Expose-Headers: X-Client-Ip < Access-Control-Expose-Headers: X-Server-Ip < Access-Control-Expose-Headers: X-Upstream-Ip < X-Client-Ip: 119.29.119.193 < X-Server-Ip: 61.156.15.28 < X-Upstream-Ip: < X-Cache-Lookup: Hit From Disktank < { [data not shown] 100 1320 100 1320 0 0 15634 0 --:--:-- --:--:-- --:--:-- 15714 * Connection #0 to host 61.156.15.28 left intact
curl -vo /dev/null 'http://mat1.gtimg.com/www/images/qq2012/weiboIcon.png' -H 'Range:bytes=0-0' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mat1.gtimg.com port 80 (#0) * Trying 123.6.0.15... * Connected to mat1.gtimg.com (123.6.0.15) port 80 (#0) > GET /www/images/qq2012/weiboIcon.png HTTP/1.1 > User-Agent: curl/7.29.0 > Host: mat1.gtimg.com > Accept: */* > Range:bytes=0-0 > < HTTP/1.1 206 Partial Content < Server: X2_Platform < Connection: keep-alive < Date: Thu, 09 Nov 2017 07:12:29 GMT < Cache-Control: max-age=600 < Expires: Thu, 09 Nov 2017 07:22:29 GMT < Last-Modified: Wed, 03 Sep 2014 07:35:47 GMT < Content-Range: bytes 0-0/1320 < Content-Type: image/png < Content-Length: 1 < X-NWS-LOG-UUID: c131b44c-3a82-43e8-9c9e-fc659b8081db 8a9f959e372c114c417ade199478a184 < Access-Control-Expose-Headers: X-Client-Ip < Access-Control-Expose-Headers: X-Server-Ip < Access-Control-Expose-Headers: X-Upstream-Ip < X-Client-Ip: 119.29.119.193 < X-Server-Ip: 123.6.0.15 < X-Upstream-Ip: < X-Cache-Lookup: Hit From Upstream < X-Cache-Lookup: Hit From Disktank < { [data not shown] 100 1 100 1 0 0 6 0 --:--:-- --:--:-- --:--:-- 6 * Connection #0 to host mat1.gtimg.com left intact
或者用-r
curl -vo /dev/null 'http://mat1.gtimg.com/www/images/qq2012/weiboIcon.png' -r 0-0 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mat1.gtimg.com port 80 (#0) * Trying 121.51.40.100... * Connected to mat1.gtimg.com (121.51.40.100) port 80 (#0) 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0> GET /www/images/qq2012/weiboIcon.png HTTP/1.1 > Range: bytes=0-0 > User-Agent: curl/7.29.0 > Host: mat1.gtimg.com > Accept: */* > < HTTP/1.1 206 Partial Content < Server: NWS_X2_MID < Connection: close < Date: Mon, 29 Apr 2019 13:27:09 GMT < Cache-Control: max-age=600 < Expires: Mon, 29 Apr 2019 13:37:09 GMT < Last-Modified: Tue, 27 Mar 2018 09:51:17 GMT < Content-Range: bytes 0-0/1320 < Content-Type: image/png < Content-Length: 1 < X-Verify-Code: 1cff81634f47748a53c331767b2e541c < X-NWS-UUID-VERIFY: 4f767e2ff453d56b7e66802318c3249d < X-NWS-LOG-UUID: 17680009143064706736 2eededd6368a07a42c7b7adfceedc11d < X-Cache-Lookup: Hit From Upstream < X-Cache-Lookup: Hit From Disktank < X-Daa-Tunnel: hop_count=1 < Vary: Origin < Access-Control-Expose-Headers: X-Client-Ip,X-Server-Ip,X-Upstream-Ip < X-Client-Ip: 119.29.119.193 < X-Server-Ip: 121.51.40.100 < X-Upstream-Ip: 182.254.48.125:80 < { [data not shown] 100 1 100 1 0 0 6 0 --:--:-- --:--:-- --:--:-- 6 * Closing connection 0
curl -vo /dev/null -d "user=admin&passwd=12345678" http://range3.bigmen.cn/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to range3.bigmen.cn port 80 (#0) * Trying 58.251.149.247... * Connected to range3.bigmen.cn (58.251.149.247) port 80 (#0) > POST / HTTP/1.1 > User-Agent: curl/7.29.0 > Host: range3.bigmen.cn > Accept: */* > Content-Length: 26 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 26 out of 26 bytes < HTTP/1.1 405 Method Not Allowed < Server: nginx/1.12.2 < Connection: keep-alive < Date: Wed, 05 Dec 2018 09:13:18 GMT < Content-Type: text/html < Content-Length: 173 < X-NWS-UUID-VERIFY: 5782ca0342cd20def62c564e95bff135 < X-Daa-Tunnel: hop_count=2 < X-NWS-LOG-UUID: 17420757374843346798 0be2170ce2df3d9f5cdeb972863048e7 < { [data not shown] 100 199 100 173 100 26 2616 393 --:--:-- --:--:-- --:--:-- 2621 * Connection #0 to host range3.bigmen.cn left intact
原创声明,本文系作者授权云+社区发表,未经许可,不得转载。
如有侵权,请联系 yunjia_community@tencent.com 删除。
我来说两句