Giter VIP home page Giter VIP logo

nju_health-checkin's Introduction

Hi, I'm Peijie Diao.

wakatime

My Github Data

nju_health-checkin's People

Contributors

64log2 avatar coegle avatar do1e avatar i-pear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nju_health-checkin's Issues

关于cookies

authserver和ehall的cookies都是临时的。
建议使用app的cookies,这是永久的。

关于cookies

不是ehallapp.nju.edu.cn的cookies
是南京大学app的sessionToken

关于登录部分

我写了登录部分的代码,想发送给您,请问您的邮箱是?

打卡出现未知错误

https://img.kartone.site/img/image-20221126134700047.png
昨天出现了这个未知错误,并且我的邮箱收到了一封打卡失败的邮件,当时没在意。自动打卡从11.9就正常打卡,但是不知道为什么昨天就寄掉了。
我没有修改登录密码,也没有做其他操作,但是它就是失败了。今天又收到一封,赶紧到GitHub来看,发现失败了

ValueError: not enough values to unpack (expected 4, got 3)

您好 我修改了config.json里面的用户名&密码,User_Agent 保持默认
测试时发现日志显示登陆成功,然后在https://github.com/Do1e/NJU_Health-Checkin/blob/main/checkin.py#L21 处,r.text的值如下:

<script>
	if (window.parent != window){
		window.top.location.href = window.top.location.href;
	}
    var getCodetips = "手机号未绑定,请至南大APP“认证账号设置”绑定";
    var getCodeSuccesstips = "动态口令已发送到手机";
    var getCodeFailtips = "发送动态码失败";
    var GetDynamicCodetips = "获取验证码";
    var ReGetDynamicCodetips = "重新获取";

    var pwdDefaultEncryptSalt = "a1ElkkntyB20MrlD";
</script>

<!DOCTYPE html>
<html>
<head>
    
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/authserver/css/mobile/mobile-index.css"/>
    <link rel="stylesheet" href="/authserver/css/mobile/mobile-reAuth.css"/>
    <script type="text/javascript" src="/authserver/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="/authserver/custom/js/login-wisedu.js"></script>
    
</head>
<style type="text/css">
#reAuthLogin
{
	background: url(../authserver/custom/mobile/custom/images/bg1.png) no-repeat center center;
    background-size: cover;
    background-size: 100% 100%;
    background-attachment: fixed;
}
.reAuthLoginContent 
{
    width: 100%;
    height: auto;
    text-align: center;
	background-color: unset;
}
.app-icon {
    margin-top: 10%;
    width: auto;
    height: auto;
}
#reAuthLoginArticle
{
    padding: 0 0.55rem;
    background: rgba(0, 0, 0, 0.4);
    margin: 0 17px;
    border-radius: 15px;
	min-height: 400px!important;
}
#reAuthLogin > header
{
	height: 90px;
}
#loginTip{
	line-height: 42px;
    padding: 10px 0;
    margin-top: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.5);
    color: #ffffff;
    font-size: 17px;
}
.login-button {
    width: 84%;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    border-style: solid;
    background: #009de4;
    background: #90138b;
    border: solid 1px #90138b;
    font-size: 1rem;
    height: 2.8rem;
}
.help-tip {
    padding: 5% 0;
}
#attentionTip{
	color: #ffffff;
    line-height: 20px;
    margin-bottom: 5px;
    margin: 0px 0px 5px 0px;
    text-align: left;
}
.color-dark-green{
	font-weight:bold;
}
</style>
<body id="reAuthLogin">
<header>
</header>
<article id="reAuthLoginArticle">
<!--<a href="/authserver/logout?service=http://ehallapp.nju.edu.cn/xgfw/sys/yqfxmrjkdkappnju/apply/getApplyInfoList.do" class="form-btn-primary login-button">&lt;返回登录</a> -->
           
		   <a href="logout?service=http%3a%2f%2fehallapp.nju.edu.cn%2fxgfw%2fsys%2fyqfxmrjkdkappnju%2fapply%2fgetApplyInfoList.do"class="form-btn-primary login-button">&lt;返回登录</a>
<div class="content reAuthLoginContent">
		
		
		
		
			<form id="casDynamicLoginForm" action="/authserver/login?service=http%3A%2F%2Fehallapp.nju.edu.cn%2Fxgfw%2Fsys%2Fyqfxmrjkdkappnju%2Fapply%2FgetApplyInfoList.do" method="post">
				
				<div>
					<img class="app-icon" src="/authserver/custom/mobile/custom/images/mobile-logo.jpg">
					<p style="color: #fff;font-weight: bold;font-size: 18px">确认授权</p>
				</div>
				<div class="input-div mt20 disabled-input">
					<img class="icon-person" src="/authserver/css/images/person.png"/>
					<input value="***" disabled="disabled" class="input-input disabled-input"/>
				</div>
				<div class="input-div mt10">
					<img class="icon-lock" src="/authserver/css/images/lock.png"/>
					<input name="dynamicCode" type="text" class="input-input input-code"
						   placeholder="验证码"/>
					<button id="getCode" type="button" onclick="sendMessage(this,'reAuthDynamicCodeType')" class="get-code" 
					 style="background:#fff;color:#90138b;font-size:15px">
						获取验证码</button>
				</div>
				<span class="forget-tip"></span>
				<div class="form-footer">
					<input type="submit" class="form-btn form-btn-primary login-button"
						   value="确认"/>
				</div>
				<input type="hidden" id="username" name="username" value="**************"/>
				<input type="hidden" name="execution" value="e3s1"/>
				<input type="hidden" name="_eventId" value="submit"/>
			</form>
		
		<div class="help-tip">
			<label class="form-label">
				<p style="line-height: 20px;color: #ffffff;text-align: left;margin: 0px;font-size:16px">注意:</p>
				<p  id="attentionTip" style="font-size:16px">
					您即将访问应用系统,为保护您的数据安全,
					
					
					请使用<span class="color-dark-green">手机短信</span>验证码进行身份确认
					
					。</p>
				<p style="color: #ffffff;text-align: left;"></p></label>
		</div>
	</div>
</article>
<script type="text/javascript" src="/authserver/js/mobile/mobile-index.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>
</body>

</html>
<script type="text/javascript">
    var canSee = false;
    //点击更改密码可见状态
    function changePwdSee() {
        if (!canSee) {
            $('#password')[0].type = 'text';
        } else {
            $('#password')[0].type = 'password';
        }
        $('.icon-visibility').toggle();
        $('.icon-visibilityoff').toggle();
        canSee = !canSee;
    }

    //密码加密
     function encryptPassword(pwd0) {
     try{
     var pwd1 = encryptAES(pwd0,$("#casLoginForm").find("#pwdDefaultEncryptSalt").val());
     $("#casLoginForm").find("#passwordEncrypt").val(pwd1);
     }catch(e){
     $("#casLoginForm").find("#passwordEncrypt").val(pwd0);
     }
     }

    $("#casLoginForm").submit(function () {
        var username = $('#username');
        var password = $('#password');
        if (username.val() == '' || password.val() == '') {
            toast('非空选项');
            return false;
        }
        //密码加密
        encryptPassword(password.val());//密码加密
    });
    var msg = $("#msg");
    if (msg.text() != '') {
        toast(msg.text());
    }

    //发送验证码.
    function sendMessage(obj, authCodeTypeName) {
        $.ajax({
            type: "POST",
            url: "getDynamicCode.do",
            dataType: "json",
            data: {userName: $("#casDynamicLoginForm").find("#username").val(), authCodeTypeName: authCodeTypeName},
            success: function (data) {
                var res = data.res;
                var returnMessage = data.returnMessage;
                var mobile = data.mobile;
                if (res == "success") {
                    toast(returnMessage + mobile);
                    countDown($(obj), 120);
                } else if (res == "wechat_success") {
                    toast(returnMessage);
                    countDown($(obj), 120);
                } else if (res == "cpdaily_success") {
                    toast(returnMessage);
                    countDown($(obj), 120);
                } else {
                    toast(returnMessage);
                    $("#casDynamicLoginForm").find("#username").focus();
                }
            }
        });
    }

    //动态码120s倒计时
    var t;
    function countDown($btn, time) {
        $btn.addClass("button-disabled");
        if (time == 0) {
            $btn.removeAttr("disabled");
            $btn.html("获取验证码");
            $btn.removeClass("button-disabled");
            clearTimeout(t)
        } else {
            $btn.attr("disabled", "disabled");
            $btn.html(time + "s");
            time--;
            t = setTimeout(function () {
                countDown($btn, time);
            }, 1000);
        }
    }
</script>

        </body>
        <script type="text/javascript"
                src="/authserver/custom/js/jquery.min.js"></script>
        <script type="text/javascript" src=""></script>

</html>

这导致了json解析失败,并在https://github.com/Do1e/NJU_Health-Checkin/blob/main/checkin.py#L24 处返回了3个值,从而触发了:

ValueError: not enough values to unpack (expected 4, got 3)

看起来并没有登陆成功,请问是否见过这种情况,或者是否是NJUlogin的问题?感谢

希望增加14天内离宁选项控制

目前的打卡程序似乎14天内离宁默认是程序控制,希望能在config里面增加修改默认的选项,改成一直填是、否或者用程序控制

关于每天执行两次action

为防止随机性错误,我之前设置了每日执行2次action,但查看最近4天的记录发现,你我每天只执行了一次,是何原因?

建议添加'UTC'时区支持

yesterday计算方法与'**''China'相同,测试代码如下:

>>> import time, datetime
>>> time.strftime('%Z', time.gmtime())
'UTC'
>>> datetime.datetime.now()
datetime.datetime(2022, 10, 19, 10, 35, 30, 112328)  # 返回值与本地时间一致

Python版本:

Python 3.9.7 (default, Oct 12 2021, 10:15:30) 
[Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

操作系统版本:macOS Big Sur 11.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.