[记录]成都信息工程大学打卡登录操作 | 祭夜博客
  • 欢迎光临,这个博客颜色有点多

[记录]成都信息工程大学打卡登录操作

php msojocs 4年前 (2020-07-16) 2778次浏览 已收录 0个评论 扫描二维码
文章目录[隐藏]

前言

疫情期间不是都流行打卡吗?但是,像我这种基本不出门的,理论上是没什么安全隐患的。

天天打卡挺麻烦的,写个程序自己打卡不香吗? #(墨镜滑稽)

(由于流程过于简单,在此不做分析,直接贴代码(无打卡操作),仅供学习与交流)

Start

 

// 模拟访问登录页面
$lopginpage = CUIT_loginPage();
// 模拟提交的数据
$body = "WinW=1304&WinH=768&txtId={$account['id']}&txtMM={$account['pass']}&verifycode=%B2%BB%B7%D6%B4%F3%D0%A1%D0%B4&codeKey={$lopginpage['codeKey']}&Login=Check&IbtnEnter.x=31&IbtnEnter.y=28";
// 由登录页面的cookie与要i教的数据组成验证数组
$verify = array(
        "cookie" => $lopginpage['cookie'],
        "body" => $body
        );
// 模拟登录,取得最终cookie
$cookie = CUIT_login($verify);

function CUIT_loginPage()
{
    $http = new EasyHttp();
    $response = $http->request("http://login.cuit.edu.cn/Login/xLogin/Login.asp", array(
        'method' => 'GET',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => null,
        'blocking' => true,        //	是否阻塞
        'headers' => null,    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => null,
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    $cookie = $response["headers"]["set-cookie"];
    $cookie = explode(";", $cookie)[0];
    preg_match_all ("/<input type=\"hidden\" name=\"codeKey\" value=\"(.*)\"><INPUT /U", $response['body'], $yzm);
    
    return array(
        "cookie" => $cookie,
        "codeKey" => $yzm[1][0]
        );
}

function CUIT_login($verify)
{
    $http = new EasyHttp();
    $response = $http->request("http://login.cuit.edu.cn/Login/xLogin/Login.asp", array(
        'method' => 'POST',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0",
        'blocking' => true,        //	是否阻塞
        'headers' => array(
            "cookie" => $verify['cookie'],
            "Referer" => "http://login.cuit.edu.cn/Login/xLogin/Login.asp"
            ),    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => $verify['body'],
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    // 据分析,该请求成功后会有302跳转操作
    if($response["response"]["code"] != 302)
    {
        return false;
    }
    // 操作另一个域名
    $response = $http->request("http://jszx-jxpt.cuit.edu.cn/jxgl/xs/netks/sj.asp?jkdk=Y", array(
        'method' => 'GET',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0",
        'blocking' => true,        //	是否阻塞
        'headers' => array(
            "Referer" => "http://jxgl.cuit.edu.cn/"
            ),    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => null,
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    $cookie1 = $response["headers"]["set-cookie"];
    $response = $http->request("http://jszx-jxpt.cuit.edu.cn/Jxgl/Login/tyLogin.asp", array(
        'method' => 'GET',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0",
        'blocking' => true,        //	是否阻塞
        'headers' => array(
            "cookie" => $cookie1,
            "Referer" => "http://jxgl.cuit.edu.cn/"
            ),    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => null,
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    
    preg_match_all("/;URL=(.*)\">/U", $response['body'], $ret);
    // 得到一个链接:http://login.cuit.edu.cn/Login/qqLogin.asp?Oid=jszx%2Djxpt%2Ecuit%2Eedu%2Ecn&OSid=*******
    // 这是绑定jszx-jxpt与login的关系吗?
    $response = $http->request($ret[1][0], array(
        'method' => 'GET',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0",
        'blocking' => true,        //	是否阻塞
        'headers' => array(
            "cookie" => $verify['cookie'],
            "Referer" => "http://jszx-jxpt.cuit.edu.cn/"
            ),    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => null,
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    // 从这里开始,似乎在激活cookie1
    $response = $http->request("http://jszx-jxpt.cuit.edu.cn/Jxgl/Login/tyLogin.asp", array(
        'method' => 'GET',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0",
        'blocking' => true,        //	是否阻塞
        'headers' => array(
            "cookie" => $cookie1,
            "Referer" => "http://jszx-jxpt.cuit.edu.cn/"
            ),    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => null,
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    $response = $http->request("http://jszx-jxpt.cuit.edu.cn/Jxgl/Login/syLogin.asp", array(
        'method' => 'GET',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0",
        'blocking' => true,        //	是否阻塞
        'headers' => array(
            "cookie" => $cookie1,
            "Referer" => "http://jszx-jxpt.cuit.edu.cn/"
            ),    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => null,
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    $response = $http->request("http://jszx-jxpt.cuit.edu.cn/Jxgl/UserPub/Login.asp?UTp=Xs&Func=Login", array(
        'method' => 'GET',        //	GET/POST
        'timeout' => 5,            //	超时的秒数
        'redirection' => 0,        //	最大重定向次数
        'httpversion' => '1.1',    //	1.0/1.1
        'user-agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.0 Safari/537.36 Edg/84.0.521.0",
        'blocking' => true,        //	是否阻塞
        'headers' => array(
            "cookie" => $cookie1,
            "Referer" => "http://jszx-jxpt.cuit.edu.cn/"
            ),    //	header信息
        'cookies' => null,    //	关联数组形式的cookie信息
        // 'cookies' => $cookies,
        'body' => null,
        'compress' => false,    //	是否压缩
        'decompress' => true,    //	是否自动解压缩结果
        'sslverify' => true,
        'stream' => false,
        'filename' => null        //	如果stream = true,则必须设定一个临时文件名
    ));
    return $cookie1;
}


祭夜の咖啡馆 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:[记录]成都信息工程大学打卡登录操作
喜欢 (2)
[1690127128@qq.com]
分享 (0)

您必须 登录 才能发表评论!