commit a96922952b49f52f44286fcbc9cc401041acb3df Author: kidultff Date: Mon Mar 23 14:21:52 2020 +0800 First commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..04c2645 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# 研究生招生分数查询系统监控器 +仅在Windows系统下有效。 +本监控器包含两个学校: +* 中国科学技术大学 +* 中南财经政法大学 + +中国科学技术大学监控工作流程为:一旦发现页面发生更改,则通过Windows Toast发送通知,并打开浏览器叫你看一看 +中南财经政法大学监控流程为:不断尝试登录,一旦登录成功并且成绩页面的状态码不是5xx或提示系统内部错误,则发送通知,并打印网页源代码。 +可以根据需要修改代码。 + +注意!中南财经政法大学的需要修改第18行,加入你的证件号码的加密文本。想知道这个文本的,请通过控制台抓包获取。 \ No newline at end of file diff --git a/ustc_monitor.py b/ustc_monitor.py new file mode 100644 index 0000000..5cb6efe --- /dev/null +++ b/ustc_monitor.py @@ -0,0 +1,32 @@ +#encoding:utf-8 +from win10toast import ToastNotifier +import requests as r +import os +import time + +toaster = ToastNotifier() +oritxt = r.get('http://yzb2.ustc.edu.cn/cjcx').text +if oritxt.find(u'未开通') == -1: + print(u'[NOTICE] 可能已经可以查分了,帮你打开浏览器,快去看看') + os.system('start http://yzb2.ustc.edu.cn/cjcx') +toaster.show_toast(u"USTC查分网监控器", + u"查分网站内容发生变更时我会通知您,并自动打开浏览器", duration=10) + +print(u'[NOTICE] 监控开始') +while True: + time.sleep(15) + os.system('cls') + print(u'http://yzb2.ustc.edu.cn/cjcx:获取中...') + try: + current = r.get('http://yzb2.ustc.edu.cn/cjcx').text + if current == oritxt: + print(time.strftime('[NOTICE] %X\tNO...',time.localtime(time.time()))) + else: + os.system('start http://yzb2.ustc.edu.cn/cjcx') + toaster.show_toast(u"监控程序", + u"好像可以查询成绩了,帮你打开浏览器,快去看看", duration=60) + exit() + except KeyboardInterrupt: + exit() + except Exception, e: + print("[ERROR] ", e) \ No newline at end of file diff --git a/zuel_monitor.py b/zuel_monitor.py new file mode 100644 index 0000000..cc82687 --- /dev/null +++ b/zuel_monitor.py @@ -0,0 +1,41 @@ +#encoding:utf-8 +from win10toast import ToastNotifier +import requests as r +import os +import time + +toaster = ToastNotifier() +toaster.show_toast(u"zuel查分网监控器", + u"可以查分的时候我会提醒你~", duration=10) + +print(u'[NOTICE] 监控开始') + +while True: + time.sleep(20) + os.system('cls') + try: + print(u'[NOTICE] 登陆中...') + login_session = r.post('http://stu.znufe.yanzhao.edu.cn/ssxscx.do', {'zjhm':'!此处填写你的证件号码加密后的文本。你可以通过控制台抓包获取!', 'ksbh':''}) + if login_session.text.find(u'登录信息有误,请重新填写') != -1: + #print(login_session.text) + print(u'[NOTICE] 登陆失败,信息未录入...') + continue + ybb_cookies = login_session.cookies + print(u'[NOTICE] 登陆成功') + login_get_score = r.get('http://stu.znufe.yanzhao.edu.cn/showPreliminaryScoreInfo.do', cookies=ybb_cookies) + pos = login_get_score.text.find(u'500 - 系统内部错误') + if pos != -1 or login_get_score.status_code / 100 == 5: + print(login_get_score.text) + print(u'[NOTICE] 成绩未录入,20秒后重新登陆(HTTP %d)' % login_get_score.status_code) + else: + print(u'[NOTICE] 成绩好像有了!帮你打开浏览器,快去看看!!!') + print(u'[NOTICE] 成绩信息:') + print(login_get_score.text) + os.system('start http://stu.znufe.yanzhao.edu.cn/ssxscx.do') + toaster.show_toast(u"zuel查分网监控器", + u"成绩好像有了!快去看看!!", duration=10) + os.system('pause') + except KeyboardInterrupt: + exit() + except Exception, e: + print("[ERROR] ", e)