自动化脚本下的Portal认证
自动化脚本下的Portal认证
步骤
- 1. $ curl -v "http://baidu.com"
- ====>location1:http://192.168.254.60:80/auth/device/client?info=D92677D5D3F2BA2677D5DC7FFA1A72DBA6D18E93AABBA8B19DAFBFA9AEDAF8BFE8B9BEE2BFEDEABEBEB8E3EEEFBEEEE3EAE3EBEEEEBEECEABBE2B8B8E3ECED85E2DC77D5D3F2BA&origiF
- 2. $ curl -v "$location1"
- ===>location2:http://192.168.254.60/portal/content/GLOBAL/default/anonymous/index.html?TN=45&PDN=e2cd8e70ddb945d4909144d60a8bb967&AVI=0&info=D92677D5D3F2BA2677D5DC7FFA1A72DBA6D18E93AABBA8B19DAFBFA9AEDAF8BFE8B9BEEh
- 3. $ curl -v "$location2"
- ====>info:info=D92677D5D3F2BA2677D5DC7FFA1A72DBA6D18E93AABBA8B19DAFBFA9AEDAF8BFE8B9BEE2BFEDEABEBEB8E3EEEFBEEEE3EAE3EBEEEEBEECEABBE2B8B8E3ECED85E2DC77D5D3F2BA
- 4. $ curl -d "$info" "http://192.168.254.60/auth/device/client/authority/click?callback=jQuery21407833887651230478_1493949274731"
- ====>final_url:http://10.10.111.111/auth/client?auth=DBDB2677D5DC7FFADADADADBDADADAE1DA&redirecturl=http%3A%2F%2F192.168.254.60%2Fportal%2Fcontent%2FGLOBAL%2Fdefault%2Fwelcome%2Findex.html%3FPDN%3De2"
- 5. $ curl -v "$final_url"
-
自动化脚本
-
- location1=$(curl -v "http://baidu.com" 2>&1 | awk '/Location/{print $3}')
- echo "====>location1:$location1"
- [ -z "$location1" ] && exit 0
- location2=$(curl -v "$location1" 2>&1 | awk '/Location/{print $3}')
- echo "===>location2:$location2"
- [ -z "$location2" ] && exit 0
- info=$(echo "$location2" | awk -F'&' '{print $4}')
- echo "====>info:$info"
-
- [ -n "$info" ] && {
- final_url="http:`curl -d "$info" "http://192.168.254.60/auth/device/client/authority/click?callback=jQuery21407833887651230478_1493949274731" 2>&1 | awk -F':' '/redirecturl/{print $3}'`"
- echo "====>final_url:$final_url"
-
- [ -n "$final_url" ] && curl -v "$final_url"
-
- }
-
-
-
nicephil@gmail.com 2017-5-5