Skip to content

Instantly share code, notes, and snippets.

@saddit
Created March 22, 2021 15:04
Show Gist options
  • Save saddit/ddad90e8c5e52f5fa8f0febea6109f24 to your computer and use it in GitHub Desktop.
Save saddit/ddad90e8c5e52f5fa8f0febea6109f24 to your computer and use it in GitHub Desktop.
青春浙江-青年大学习打卡脚本
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"])
@saddit
Copy link
Author

saddit commented Sep 23, 2022

@lthero-big 江西系统与这个相似,据了解使用随机生成的openid可以打任何人的卡,会留下后台打卡记录

@lthero-big
Copy link

好吧,我现在明白了。抓包时留意: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