Created
March 22, 2021 15:04
-
-
Save saddit/ddad90e8c5e52f5fa8f0febea6109f24 to your computer and use it in GitHub Desktop.
青春浙江-青年大学习打卡脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import re | |
import sys | |
if __name__ == "__main__": | |
getToken_url = 'https://qczj.h5yunban.com/qczj-qndxx/cgi-bin/login/we-chat/callback' | |
getUserInfo_url = 'https://qczj.h5yunban.com/qczj-qndxx/cgi-bin/user-api/course/last-info' | |
getClass_url = 'https://qczj.h5yunban.com/qczj-qndxx/cgi-bin/common-api/course/current' | |
checkin_url = 'https://qczj.h5yunban.com/qczj-qndxx/cgi-bin/user-api/course/join' | |
openId = { | |
'appid':'wx56b888a1409a2920', | |
'openid': ''#在这里填入你的openId | |
} | |
headers = { | |
'Content-Type': 'text/plain' | |
} | |
try: | |
getToken = requests.get(url=getToken_url,params=openId,headers=headers) | |
Token_raw = getToken.text | |
Token = re.findall('[A-Z0-9]{8}[-][A-Z0-9]{4}[-][A-Z0-9]{4}[-][A-Z0-9]{4}[-][A-Z0-9]{12}', Token_raw)[0] | |
print('获取Token为:'+Token) | |
except: | |
print('获取Token失败,请检查openId是否正确') | |
accessToken = { | |
'accessToken':Token | |
} | |
try: | |
getUserInfo = requests.get(getUserInfo_url,params=accessToken,headers=headers) | |
userInfo = getUserInfo.json() | |
cardNo = userInfo["result"]["cardNo"] | |
nid = userInfo["result"]["nid"] | |
getClass = requests.get(getClass_url,params=accessToken,headers=headers) | |
Class = getClass.json() | |
classId = Class["result"]["id"] | |
infos: list = userInfo['result']['nodes'] | |
Faculty = [item['title'] for item in infos] | |
print('签到课程为:'+classId,'\n您填写的个人信息为:'+ cardNo,'\n您的签到所属组织为:' + str(Faculty)) | |
except Exception as e: | |
print(f'获取历史信息失败,请您手动打卡:{e}') | |
checkinData = { | |
'course':classId, | |
'subOrg':None, | |
'nid':nid, | |
'cardNo':cardNo | |
} | |
checkin = requests.post(checkin_url,params=accessToken,data=json.dumps(checkinData),headers=headers) | |
result = checkin.json() | |
if(result["status"]==200): | |
print("签到成功") | |
else: | |
print('出现错误,错误码:') | |
print(result["status"]) | |
print('错误信息:'+result["message"]) |
现在好像失效了。
现在好像失效了。
是的 有时间会修复一下
现在好像失效了。
是的 有时间会修复一下
加油大佬,现在自己一点头绪都没。。accessToken怎么生成的包都抓不到。。。。
现在好像失效了。
是的 有时间会修复一下
加油大佬,现在自己一点头绪都没。。accessToken怎么生成的包都抓不到。。。。
解决了:把代码里面的qczj-qndxx全部替换成qczj-youth-learning,其实的没变。另外,抓包可以直接从链接的参数得到accessToken,反而是openID我始终没找到。
@lthero-big 江西系统与这个相似,据了解使用随机生成的openid可以打任何人的卡,会留下后台打卡记录
好吧,我现在明白了。抓包时留意:qczj.h5yunban.com/qczj-youth-learning/cgi-bin/user-api/info在这个链接的包。它的响应里面有openid,openid和账号是唯一对应。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
对,每个人都需要重新获取openid