hanechiri / chd_portal_login Goto Github PK
View Code? Open in Web Editor NEW用于模拟登录长安大学信息门户的自定义包
用于模拟登录长安大学信息门户的自定义包
login(login_url, headers, home_page_url, file_name='cookies')
其中file_name参数传入后,在login.py本身可以读取到cookies文件,但是在test.py中无法读取到,需要重新输入账号密码来登陆。
即使换成绝对路径也不行:
login(login_url, headers, home_page_url,file_name='F:\\cookies')
自动保存cookies下次直接读取使用,以免测试时重复输入账号密码
登录失败
<class 'requests.cookies.RequestsCookieJar'>
ySQXSSVg6MP3_xyrPS0_iCrCXw_1DU4zLQWm3hSvQF_YpMxeFcot!1805597152
<RequestsCookieJar[, ]>
单独请求到的页面出现了验证码,从而使登录失败
下面是我单独构造的请求返回结果
<!DOCTYPE` html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta content="width=device-width,initial-scale=0.8, minimum-scale=0.8, maximum-scale=3"
name="viewport"/>
<meta name="renderer" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta property="qc:admins" content="754034015366713545637571540352652"/>
<meta property="wb:webmaster" content="1ad39047f32b5b6b"/>
<title>统一身份认证</title>
</head>
<script>
</script>
<link href="/authserver/custom/css/login.css" rel="stylesheet">
<link href="/authserver/custom/css/iCheck/custom.css" rel="stylesheet">
<script type="text/javascript">
var secure = "false";
var pwdDefaultEncryptSalt = "lVQvSNZOUfg4C72B";
</script>
<body onload="loadFresh();">
<!--<div class="auth_bg">
<img src="/authserver/custom/images/login-bg-autumn.jpg" alt="">
</div>
<div class="auth-language">Language:
<div class="auth-language-select">
<select id="language" onchange="changeLanguage()">
<option value="zh_CN">简体中文</option>
<option value="en">English</option>
</select>
</div>
</div>-->
<div class="auth_page_wrapper">
<div class="auth_logo">
<img class="logoimg" src="/authserver/custom/images/logos.png" alt="logo"/>
<div class="top-bar"><a href="http://www.chd.edu.cn/" target="_blank">长安大学主页</a> | <a href="http://bkjw.chd.edu.cn/eams/home.action" target="_blank">本科教务</a> | <a href="http://123.chd.edu.cn/" target="_blank">长大导航</a> | <!--<a href="javascript:void(0)" onclick="AddFavorite(window.location,document.title)">加入收藏</a> |--><span id="showfaq" style="cursor:pointer;" onMouseOver="loginHelp(1);" onMouseOut="loginHelp(0);" >登录帮助</span></div>
<div class="tip-area" id="loginhelp" style="z-index:99999;visibility: hidden;">
<h2>登录帮助说明</h2>
<div class="line-ccc"></div>
<ul>
<li><img src="custom/images/arrp.png" /> 账号规则:用户账号为本人教工号或学号。</li>
<li><img src="custom/images/arrp.png" /> 密码规则:初始密码为本人身份证后六位,如遇字母请分别尝试大小写字母。</li>
<li><img src="custom/images/arrp.png" /> 其他说明:如您无法登录请联系信息与网络管理处。电话:029-82334716 邮箱:[email protected]</li>
</ul>
</div>
</div>
<div class="auth_login_content">
<div class="auth_login_left">
<div class="auth_others">
<h4>您还可以使用以下方式登录</h4>
<ul>
<li>
<a href="combinedLogin.do?type=qq&success=http://ids.chd.edu.cn/authserver/login?service=http%3A%2F%2Fbkjw.chd.edu.cn%2Feams%2Fteach%2Fgrade%2Fcourse%2Fperson%21historyCourseGrade.action%3FprojectType%3DMAJOR"
style="display: inline-block;">
<span class="auth_icon_bg">
<i class="auth_icon_qq"></i>
</span>
<span class="auth_icon_text">使用腾讯QQ登录</span>
</a>
</li>
</ul>
</div>
</div>
<div class="auth_login_right">
<img class="mainbg" src="/authserver/custom/images/web-bg1.png" alt="">
<div class="auth_tab">
<div class="auth_tab_links">
<ul>
<li id="accountLogin" style="width:100%;" class="selected" tabid="01">
<img src="/authserver/custom/images/log-title.png" alt="">
</li>
</ul>
</div>
<div class="clearfloat"></div>
<div class="auth_tab_content">
<div tabid="01" class="auth_tab_content_item">
<form id="casLoginForm" class="fm-v clearfix amp-login-form" role="form" action="/authserver/login?service=http%3A%2F%2Fbkjw.chd.edu.cn%2Feams%2Fteach%2Fgrade%2Fcourse%2Fperson%21historyCourseGrade.action%3FprojectType%3DMAJOR" method="post">
<p>
<span class="auth_icon">用户名</span>
<input id="username" name="username" placeholder="学号/职工号/邮箱账号" class="auth_input" type="text" value=""/>
<span id="usernameError" style="display:none;" class="auth_error">请输入用户名</span>
</p>
<p>
<span class="auth_icon">密码</span>
<input id="password" placeholder="密码" class="auth_input" type="password" value="" autocomplete="off"/>
<input id="passwordEncrypt" name="password" style="display:none;" type="text" value=""/>
<span id="passwordError" style="display:none;" class="auth_error">请输入密码</span>
</p>
<p id="cpatchaDiv">
</p>
<p style="z-index: 1000;">
<span class="session-area"><input type="checkbox" class="chkbox" />记住我的密码</span>
<a id="getBackPasswordMainPage" href="getBackPasswordMainPage.do" class="auth_login_forgetp">
<small>忘记密码?</small>
</a>
</p>
<p>
<button type="submit" class="auth_login_btn primary full_width">登录
</button>
</p>
<div style="text-align: center;">
<span style="font-size: 17px;font-weight: 600;">你还可以用以下登录方式:</span>
<span>
<a href="combinedLogin.do?type=qq&success=http://ids.chd.edu.cn/authserver/login?service=http%3A%2F%2Fbkjw.chd.edu.cn%2Feams%2Fteach%2Fgrade%2Fcourse%2Fperson%21historyCourseGrade.action%3FprojectType%3DMAJOR"
style="display: inline-block;">
<span class="auth_icon_bg">
<i class="auth_icon_qq"></i>
</span>
</a>
</span>
</div>
<p style="text-align: center;margin-top: 10px;"><strong>当前登录: <font color="red">教务系统</font></strong></p>
<input type="hidden" name="lt" value="LT-862269-465Zmv72pQKLobNiDYLuQpfWh2deOQ1563758766062-9aOW-cas"/>
<input type="hidden" name="dllt" value="userNamePasswordLogin"/>
<input type="hidden" name="execution" value="e3s1"/>
<input type="hidden" name="_eventId" value="submit"/>
<input type="hidden" name="rmShown" value="1">
</form>
</div>
</div>
</div>
</div>
</div>
<div id="hidenCaptchaDiv" style="display: none;">
<span class="auth_icon">验证码</span>
<input type="text" placeholder="验证码" id="captchaResponse" name="captchaResponse"
class="auth_input captcha-input"/>
<img id="captchaImg" class="captcha-img" alt="验证码" title="验证码"/>
<span style="cursor: pointer;color: #1dadff;margin-left: 2px;" id="changeCaptcha"
class="chk_text"></span>
<span id="cpatchaError" style="display:none;" class="auth_error">请输入验证码</span>
</div>
<div class="clearfloat"></div>
<div class="auth_login_footer">
<img class="footbg" src="/authserver/custom/images/chd_mobile.jpg" alt="">
<div class="foottext">
<p><a href="http://ids.chd.edu.cn/authserver/warning/warning.htm" style="text-decoration: none;color:red;" target="_blank">统一身份认证防诈骗提醒</a></p>
<p><a href="http://app.chd.edu.cn/" style="text-decoration: none;color:#00AEAE;" target="_blank">长安大 学移动门户APP</a></p>
<p>版权所有©长安大学 |信息与网络管理处维护</p>
</div>
</div>
</div>
<script type="text/javascript" src="/authserver/custom/js/jquery.min.js"></script>
<script type="text/javascript" src="/authserver/custom/js/login-language.js"></script>
<script type="text/javascript" src="/authserver/custom/js/icheck.min.js"></script>
<script type="text/javascript" src="/authserver/custom/js/login.js"></script>
<script type="text/javascript" src="/authserver/custom/js/login-wisedu_v1.0.js"></script>
<script type="text/javascript" src="/authserver/custom/js/encrypt/encrypt.wisedu.js"></script>
<script type="text/javascript" src="/authserver/custom/js/encrypt/aes.js"></script>
<script type="text/javascript">
// 选中tab框
var dllt = '';
if (dllt != '' && dllt == 'dynamicLogin') {
selectLi($("#dyLogin"));
} else if (dllt != '' && dllt == 'qrLogin'){
getQrCode();
countDown();
selectLi($("#qrLogin"));
} else {
selectLi($("#accountLogin"));
}
function loginHelp(flag){
if(flag==1){
//document.getElementById("loginhelp").style.display=="block";
document.getElementById("loginhelp").style.visibility="visible";
}else{
//document.getElementById("loginhelp").style.display=="none";
document.getElementById("loginhelp").style.visibility="hidden";//隐藏
}
}
$(document).ready(function () {
$("#captchaImg").attr("src","captcha.html?ts=" + new Date().getMilliseconds());
var service = GetQueryString("service");
if (service) {
$("#getBackPasswordMainPage").attr("href", "getBackPasswordMainPage.do?service=" + encodeURIComponent(service));
}
});
</script>
</body>
</html>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.