赞
踩
curl -I -x 140.205.32.8:80 "http://www.aliyun.com"
curl -I -s -k 'https://140.205.32.8/' -H 'Host:www.aliyun.com'
使用过程中,调整期望的IP以及域名。比如:其他测试通过代理访问http://blog.csdn.net/ 那命令如下:
curl -I -x x.x.x.x:80 "http://blog.csdn.net"
对应的IP,调整为对应的代理服务器的IP。
- #循环100次使用代理访问https://www.aliyun.com/,返回Response Headers
- for i in {1..100};do curl -I -s -k 'https://140.205.32.8/' -H 'Host:www.aliyun.com'; done
- #通过代理服务器访问,查看网站内容
- curl -s -k 'https://140.205.32.8/' -H 'Host:www.aliyun.com'
- -s/--silent #静音模式。不输出任何东西
- -I/--head #只显示文档信息
- -k/--insecure #允许不使用证书到SSL站点
- -x/--proxy <host[:port]> #在给定的端口上使用HTTP代理
综上编写了一个简单的脚本:
准备工作:
- cat ~/.bash_profile
- alias web_Proxy='bash /root/Proxy/Proxy.sh'
脚本内容
- #!/bin/bash
-
- http(){
- curl -I -x $2 "http://"$1
- }
- https(){
- curl -I -k 'https://'$2 -H 'Host:'$1
- }
-
- if [[ $1 == 'http' ]];then
- if [[ ! -n $4 ]];then
- http $2 $3
- else
- for ((i=0;i<$4;i++))
- do
- date;
- http $2 $3;
-
- done
- fi
- elif [[ $1 == 'https' ]]; then
- # https $2 $3
- if [[ ! -n $4 ]];then
- https $2 $3
- else
- for ((i=0;i<$4;i++))
- do
- date;
- https $2 $3;
-
- done
- fi
-
-
- else
- echo -e 'Usage: \nweb_Proxy http www.baidu.com 8.8.8.8:80 10 \nweb_Proxy 协议 域名 地址:端口 循环访问次数'
- fi

使用示例:
- Mac-Pro:~ Test$ web_Proxy http www.aliyun.com 140.205.172.20:80 2
- 2018年 2月19日 星期一 00时07分20秒 CST
- HTTP/1.1 301 Moved Permanently
- Date: Sun, 18 Feb 2018 16:07:20 GMT
- Content-Type: text/html
- Content-Length: 286
- Connection: keep-alive
- Location: https://www.aliyun.com/
- Server: Tengine/Aserver
- EagleEye-TraceId: 0b83df9215189700406686721e7a8c
- Timing-Allow-Origin: *
-
- 2018年 2月19日 星期一 00时07分20秒 CST
- HTTP/1.1 301 Moved Permanently
- Date: Sun, 18 Feb 2018 16:07:20 GMT
- Content-Type: text/html
- Content-Length: 286
- Connection: keep-alive
- Location: https://www.aliyun.com/
- Server: Tengine/Aserver
- EagleEye-TraceId: 0b83a4e715189700407331684e84d1
- Timing-Allow-Origin: *

更多内容见Man Curl。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。