Skip to content

Instantly share code, notes, and snippets.

@Zxilly
Created September 21, 2020 12:16
Show Gist options
  • Save Zxilly/ba5c02cdce2d752bb1d035440c8ced02 to your computer and use it in GitHub Desktop.
Save Zxilly/ba5c02cdce2d752bb1d035440c8ced02 to your computer and use it in GitHub Desktop.
#!/bin/sh
curl 'https://www.baidu.com/s?ie=UTF-8&wd=curl%20useragent' \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 Edg/85.0.564.51' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Sec-Fetch-User: ?1' \
-H 'Sec-Fetch-Dest: document' \
-H 'Referer: https://www.baidu.com/' \
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' \
--compressed --connect-timeout 2 --retry 2 > /dev/null 2>&1
if [ $? -eq 0 ]
then
#已经登录
logger "【Dr.COM网页认证】连接正常"
else
#尚未登录
logger "【Dr.COM网页认证】尚未登录"
IP=`ubus call network.interface.wan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'`
echo ${IP}
curl 'http://192.168.167.46/a70.htm' \
-H 'Connection: keep-alive' \
-H 'Cache-Control: max-age=0' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'Origin: http://192.168.167.46' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'Referer: http://192.168.167.46/a70.htm' \
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' \
-H 'Cookie: program=ip; vlan=0; md5_login2=账号%7C密码; ip=${IP}' \
--data-raw 'DDDDD=账号&upass=密码&R1=0&R2=&R6=0&para=00&0MKKey=123456&buttonClicked=&redirect_url=&err_flag=&username=&password=&user=&cmd=&Login=&R7=0' \
--insecure &>/dev/null
logger "【Dr.COM网页认证】现已登录"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment