zoukankan      html  css  js  c++  java
  • 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;
  • 相关阅读:
    【JavaWeb】Hibernate Dao层设计
    【C#】身份证识别(一):身份证号定位
    【JavaWeb】SpringMVC重定向页面取值
    关于chrome扩展的东西
    【C#】基于Opencv/Emgucv的身份证识别
    Bashware
    【java多线程】分段阶乘计算
    【java】多项式计算(中缀转后缀)
    iOS  OTA问题排查【itms-servers协议在线安装ipa包】
    【深度学习】BP算法分类iris数据集
  • 原文地址:https://www.cnblogs.com/jackluo/p/3384816.html
Copyright © 2011-2022 走看看