Files
zjt-attendance-research/README.md
2025-12-22 22:44:34 +08:00

109 lines
3.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 关于职教智慧云的签到研究
本项目记录对“职教智慧云” App 及其 Flutter 框架的研究,以及如何从日志中获取 Cookie、请求课程与打卡信息并完成打卡的基本实践。理论上可以直接跳过蓝牙设备验证进行远程打卡
- 目标:从日志中截取 `token`,获取课程与打卡信息,并执行打卡。
- 平台Android命令示例包含 Windows PowerShell 与 Linux/macOS 两种形式。
## 1. 抓取 Cookietoken
连接 Android 设备后,查看 Flutter 在 Dart 层输出的日志并筛选包含 `cookie` 的行。
WindowsPowerShell
在此之前您需要安装安卓调试工具platform-tools
```powershell
adb shell
logcat -s flutter | grep -i cookie
```
Linux/macOS
```bash
adb logcat -s flutter | grep -i cookie
```
从输出中截取形如 `token=XXXX` 的值,后续作为请求头中的 Cookie 使用。
## 2. 获取课程与打卡信息
接口地址:`https://m-zjt.kefang.net/api/zms/zhijiaotong/page/homePageData`
通用请求头(表单):
```http
User-Agent: Dart/3.6 (dart:io)
Accept-Encoding: gzip
Content-Type: application/x-www-form-urlencoded
Cookie: token=YOUR_TOKEN
```
示例PowerShell/curl
```powershell
curl --silent `
-H "User-Agent: Dart/3.6 (dart:io)" `
-H "Accept-Encoding: gzip" `
-H "Content-Type: application/x-www-form-urlencoded" `
-H "Cookie: token=YOUR_TOKEN" `
"https://m-zjt.kefang.net/api/zms/zhijiaotong/page/homePageData"
```
示例Linux/macOS/curl
```bash
curl -s \
-H "User-Agent: Dart/3.6 (dart:io)" \
-H "Accept-Encoding: gzip" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Cookie: token=YOUR_TOKEN" \
"https://m-zjt.kefang.net/api/zms/zhijiaotong/page/homePageData"
```
从响应中提取 `contentId` 以及后续需要的 `attendanceId` 等字段。
## 3. 提交打卡
接口地址:`https://m-zjt.kefang.net/api/zms/attendance/attendanceRecord/punchCourseByStudent`
方法:`PUT``Content-Type``application/x-www-form-urlencoded`
示例PowerShell/curl
```powershell
curl -X PUT `
-H "User-Agent: Dart/3.6 (dart:io)" `
-H "Accept-Encoding: gzip" `
-H "Content-Type: application/x-www-form-urlencoded" `
-H "Cookie: token=YOUR_TOKEN" `
-d "attendanceId=YOUR_ATTENDANCE_ID" `
"https://m-zjt.kefang.net/api/zms/attendance/attendanceRecord/punchCourseByStudent"
```
示例Linux/macOS/curl
```bash
curl -X PUT \
-H "User-Agent: Dart/3.6 (dart:io)" \
-H "Accept-Encoding: gzip" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Cookie: token=YOUR_TOKEN" \
-d "attendanceId=YOUR_ATTENDANCE_ID" \
"https://m-zjt.kefang.net/api/zms/attendance/attendanceRecord/punchCourseByStudent"
```
您可在项目文件 main.py 中查看示例脚本
返回结果若包含“操作成功”的 `message`,则表示打卡成功。
## 4. 常见问题
- `token` 过期:重新通过日志抓取;或在 App 内重新登录再抓取。
- 403/401检查 `Cookie` 是否正确;确认 `Content-Type` 是否为表单。
- 字段变动:以实际接口响应为准,名称或层级可能更新。
## 5. 注意事项
- 仅用于学习与研究,请勿用于任何不当用途。
- 请妥善保护个人隐私与账号安全。
- 操作前请确保已安装 `adb` 并正确连接设备。