beetcb / cea Goto Github PK
View Code? Open in Web Editor NEW高校高校统一身份认证 Node.js 优雅可扩展示例,已集成今日校园签到(支持多平台一键部署)
License: MIT License
高校高校统一身份认证 Node.js 优雅可扩展示例,已集成今日校园签到(支持多平台一键部署)
License: MIT License
cause 098765
will be treated as 98765
after rendering
本项目中的 签到插件
属于一个逆向抓包工程,在上游发生更新后,下游必然处于被动状态,需要修改代码以应对这些不可控更新
我作为一个开发者能做的只是及时发现问题,尽量在下次签到之前修复问题
此 Issue 相当于一个公告栏,我写好应对更新的补丁(也就是 @beetcb/cea
模块也会更新)后会以评论的方式上报至此,请关注此 Issue
GitHub:无需重新部署,自动向前兼容
腾讯云:云函数 -> 函数代码 -> 保存并安装依赖 即可
注:很少会需要重新部署,如有,我会加以说明,届时只需按照部署指南文档重新部署一遍即可
Coding 持续集成:无需重新部署,自动向前兼容
// if we got here, this site definitely uses AJAX to get those props (`iap`)
// we need to request those properties manually
headers.Referer = res.headers.get('location')
const ltWrapper = new URL(headers.Referer).search
if (Object.keys(hiddenInputNameValueMap).length === 0) {
res = await fetch(`${school.casOrigin}${schoolEdgeCases.lt}${ltWrapper}`)
const { result } = await res.json()
Object.defineProperties(hiddenInputNameValueMap, {
lt: { value: result._lt, enumerable: true },
needCaptcha: { value: result.needCapt, enumerable: true },
dllt: { value: '', enumerable: true },
iap: { value: true, enumerable: true },
})
// seems dcampus forgot to impl _encryptSalt, comment it out temporarily
// pwdSalt = result._encryptSalt
}
此处想知道具体执行逻辑,我以前做过HENU的模拟登录,更新后debug发现在获取MOD_AUTH_CAS这个cookie无返回,获取HWWAFSESID会返回一个errorMessage:程序出现错误,非ajax方式直接跳转到错误处理页面
部分学校的学工系统无法使用国外服务器访问,这种情况下需要自行部署代理服务
代理服务器只需覆盖登录页面的请求,并处理好 Cookie 和 反爬虫相关 HTTP Headers,可以参考 proxy-of-whpu 项目
然后 Fork 本项目,类似于下面这样修改相关代码:
Lines 263 to 266 in 6dcacec
注:国内服务器(如腾讯云不会存在这种问题)
START RequestId: 646f306d-af4a-455e-8620-fe95d5b23c84
Event RequestId: 646f306d-af4a-455e-8620-fe95d5b23c84
2021-05-21T23:32:38.066Z 646f306d-af4a-455e-8620-fe95d5b23c84 尝试从配置文件加载配置
2021-05-21T23:32:38.067Z 646f306d-af4a-455e-8620-fe95d5b23c84 用户 one 已加载
2021-05-21T23:32:38.436Z 646f306d-af4a-455e-8620-fe95d5b23c84 你的学校 河南大学 已完成设定
2021-05-21T23:32:39.119Z 646f306d-af4a-455e-8620-fe95d5b23c84 用户one:登录失败,Unauthorized
2021-05-21T23:32:39.119Z 646f306d-af4a-455e-8620-fe95d5b23c84 用户one:无效的 Cookie,尝试重新登录
2021-05-21T23:32:39.751Z 646f306d-af4a-455e-8620-fe95d5b23c84 用户one:登录失败,Unauthorized
2021-05-21T23:32:39.754Z 646f306d-af4a-455e-8620-fe95d5b23c84 ┌─────────┬──────────────────┐
│ (index) │ 签到结果 │
├─────────┼──────────────────┤
│ one │ '今日签到任务已完成,取消签到' │
└─────────┴──────────────────┘
END RequestId: 646f306d-af4a-455e-8620-fe95d5b23c84
Report RequestId: 646f306d-af4a-455e-8620-fe95d5b23c84 Duration:1694ms Memory:256MB MemUsage:47.5859MB
删除用户:
(node:17564) UnhandledPromiseRejectionWarning: ReferenceError: get is not defined at i.deleteUser (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:14:1985) at C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:21:234 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:17564) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:17564) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
配置学校:
(node:16216) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of null at c.schoolApi (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:14:3281) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async c.init (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:14:2330) at async C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:21:277 (node:16216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:16216) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
签到:
(node:10616) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'login' of undefined at module.exports (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:8:456) at t (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:12:210) at C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:12:616 at Array.map (<anonymous>) at r.e.handleCookie (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:12:561) at C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:18:220 at Object.parcelRequire.PTk1.../src/index (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:18:266) at f (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:3:468) at p (C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:3:544) at C:\Users\cyl\AppData\Roaming\npm\node_modules\@beetcb\cea\dist\cli.js:21:376 (node:10616) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:10616) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
GitHub Actions workflow not triggering at scheduled time
遗漏请假签到任务:
Line 55 in 50a344b
{
"code": "0",
"message": "SUCCESS",
"datas": {
"dayInMonth": "2021-05-01",
"codeRcvdTasks": [],
"signedTasks": [],
"unSignedTasks": [],
"leaveTasks": [
{
"stuSignWid": "9444387",
"signInstanceWid": "30727",
"signWid": "822443",
"signRate": "1",
"taskType": "0",
"taskName": "本科生每日健康管理及健康打卡",
"senderUserName": "",
"signStatus": "5",
"isMalposition": "0",
"isLeave": "1",
"leavePcUrl": null,
"leaveMobileUrl": null,
"currentTime": "2021-05-01 10:25",
"singleTaskBeginTime": null,
"singleTaskEndTime": null,
"rateSignDate": "2021-05-01 (周六)",
"rateTaskBeginTime": "06:00",
"rateTaskEndTime": "22:30"
}
]
}
}
返回结果:{"errorCode":-1,"errorMessage":"user code exception caught","requestId":"49ef2437-b85a-4bc0-ad82-a7ceb8afcbeb","stackTrace":"TypeError: a.text is not a function\n at c.schoolApi (/var/user/node_modules/@beetcb/cea/dist/index.js:18:3487)\n at process._tickCallback (internal/process/next_tick.js:68:7)","statusCode":430}
日志:START RequestId: 49ef2437-b85a-4bc0-ad82-a7ceb8afcbeb
Event RequestId: 49ef2437-b85a-4bc0-ad82-a7ceb8afcbeb
2021-05-25T16:04:08.360Z 49ef2437-b85a-4bc0-ad82-a7ceb8afcbeb ⚠ 警示 尝试从配置文件加载配置
2021-05-25T16:04:08.361Z 49ef2437-b85a-4bc0-ad82-a7ceb8afcbeb ✔ 成功 用户 one 已加载
END RequestId: 49ef2437-b85a-4bc0-ad82-a7ceb8afcbeb
Report RequestId: 49ef2437-b85a-4bc0-ad82-a7ceb8afcbeb Duration:1081ms Memory:256MB MemUsage:51.6562MB
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.