一个简易的抓包脚本:
----- url_check.sh -----
#!/bin/bash
if ! [ $# -eq 1 ]
then
echo "Usage For example:"
echo "$0 www.yy.com"
exit -1
fi
domain=$1
echo "输入URL:"$domain
echo ""
echo "开始curl检测:"
curl -o /dev/null -s -w \
"http状态:%{http_code}\n"\
"域名解析时间:%{time_namelookup}s\n"\
"建立连接时间:%{time_connect}s\n"\
"从建立连接到准备传输时间:%{time_pretransfer}s\n"\
"从建立连接到开始传输时间:%{time_starttransfer}s\n"\
"总耗时:%{time_total}s\n"\
"下载字节:%{size_download}B\n"\
"下载速度:%{speed_download}B/s\n" $domain