自动化脚本下的Portal认证

自动化脚本下的Portal认证

步骤

  1. 1. $ curl -v "http://baidu.com" 
  2. ====>location1:http://192.168.254.60:80/auth/device/client?info=D92677D5D3F2BA2677D5DC7FFA1A72DBA6D18E93AABBA8B19DAFBFA9AEDAF8BFE8B9BEE2BFEDEABEBEB8E3EEEFBEEEE3EAE3EBEEEEBEECEABBE2B8B8E3ECED85E2DC77D5D3F2BA&origiF 
  3. 2. $ curl -v "$location1" 
  4. ===>location2:http://192.168.254.60/portal/content/GLOBAL/default/anonymous/index.html?TN=45&PDN=e2cd8e70ddb945d4909144d60a8bb967&AVI=0&info=D92677D5D3F2BA2677D5DC7FFA1A72DBA6D18E93AABBA8B19DAFBFA9AEDAF8BFE8B9BEEh 
  5. 3. $ curl -v "$location2" 
  6. ====>info:info=D92677D5D3F2BA2677D5DC7FFA1A72DBA6D18E93AABBA8B19DAFBFA9AEDAF8BFE8B9BEE2BFEDEABEBEB8E3EEEFBEEEE3EAE3EBEEEEBEECEABBE2B8B8E3ECED85E2DC77D5D3F2BA 
  7. 4. $ curl -d "$info" "http://192.168.254.60/auth/device/client/authority/click?callback=jQuery21407833887651230478_1493949274731" 
  8. ====>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" 
  9. 5. $ curl -v "$final_url" 
  10.  

自动化脚本

  1. #!/bin/sh 
  2.  
  3. location1=$(curl -v "http://baidu.com" 2>&1 | awk '/Location/{print $3}'
  4. echo "====>location1:$location1" 
  5. [ -z "$location1" ] && exit
  6. location2=$(curl -v "$location1" 2>&1 | awk '/Location/{print $3}'
  7. echo "===>location2:$location2" 
  8. [ -z "$location2" ] && exit
  9. info=$(echo "$location2" | awk -F'&' '{print $4}'
  10. echo "====>info:$info" 
  11.  
  12. [ -n "$info" ] && { 
  13. 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}'`" 
  14. echo "====>final_url:$final_url" 
  15.  
  16. [ -n "$final_url" ] && curl -v "$final_url" 
  17.  

  18.  
  19.  
  20.  

nicephil@gmail.com 2017-5-5

posted on 2017-05-05 11:13  nicephil  阅读(1147)  评论(0编辑  收藏  举报

导航