Shell 利用 curl 模擬登陸


-b 參數 指定使用cookie文件

-c是往cookie文件中寫cookie

-d 是指定此次登錄所需的參數,通過httpfox查看

-L 指定頁面自動跳轉

#curl -c ck.txt --user-agent Mozilla/4.0 -d "username=****&password=*****&server_id=1&submit=true" 登陸的url 
#curl -c ck.txt -b ck.txt --user-agent Mozilla/4.0 請求的url
#! /bin/Bash
###############################
#          2013-10-23         #
#        author jackluo       #
#      net.webjoy@gmail.com   #
###############################
server_url=url
login_url=${server_url}account/login #登陸地址
for server_id in 1 2;do
        login_server_info="username=****&password=******&server_id=${server_id}&submit=true" #登陸 服務器帳號信息
        curl -c server_cookie_${server_id}.txt --user-agent Mozilla/4.0 -d ${login_server_info} ${login_url}
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}import/export_logLogin >> log.log #導入數據
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/user_keep_rate >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/device >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/recharge >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/allpropslist >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/allacslist >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/online >> log.log
        curl -c server_cookie_${server_id}.txt -b server_cookie_${server_id}.txt --user-agent Mozilla/4.0 ${server_url}cron/ltv >> log.log
done;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM