惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tenable Blog
T
Tailwind CSS Blog
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
Webroot Blog
Webroot Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Cloudflare Blog
T
Threat Research - Cisco Blogs
V
Visual Studio Blog
Jina AI
Jina AI
V
V2EX
I
InfoQ
Latest news
Latest news
P
Proofpoint News Feed
T
Threatpost
Engineering at Meta
Engineering at Meta
P
Proofpoint News Feed
美团技术团队
The Register - Security
The Register - Security
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
Cloudbric
Cloudbric
Microsoft Azure Blog
Microsoft Azure Blog
C
Cisco Blogs
U
Unit 42
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
V
Vulnerabilities – Threatpost
TaoSecurity Blog
TaoSecurity Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Recent Commits to openclaw:main
Recent Commits to openclaw:main
W
WeLiveSecurity
博客园 - 司徒正美
T
The Exploit Database - CXSecurity.com
小众软件
小众软件
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
N
News and Events Feed by Topic

折腾不停 – 魔帆博客

Python包管理的血泪史:从混乱到秩序的漫长征 | 魔帆博客 使用 GNU/Linux 搭建多出口软路由 | 魔帆博客 配置和使用 Windows Dev Drive 开发驱动器 | 魔帆博客 解锁iOS侧载自由:使用sideStore轻松搞定ipa签名 | 魔帆博客 Git配置:如何优雅的配置多用户并使用 ssh 密钥验证 | 魔帆博客 Fedora 系统升级 32->34 跨版本升级 | 魔帆博客 教程:如何更新安装 docker-compose V2 和使用 docker switch | 魔帆博客 Windows10 系统盘开启 Bitlocker | 魔帆博客 2022 年 Android 下的安卓浏览器使用指北-Firefox向 | 魔帆博客 Docker WSL1/2 迁移 Linux 发行版目录 | 魔帆博客 Spotify 主题 spicetify-fluent - 微软 win11 风格美化 | 魔帆博客 双重验证 Authy 导出所有 TOTP token 和 golang 配置 GOPROXY 解决网络问题 | 魔帆博客 powershll 像 bash 一样为单个命令设置临时环境变量 | 魔帆博客 Linux 教程:Linux 初学者必了解的概念 | 魔帆博客 安卓电池充电保护-智能充电/温控切断(Root方案) | 魔帆博客 备用机养成方案 - Tasker 安卓短信转发到 telegram | 魔帆博客 VS Code C/C++ 环境配置 | 魔帆博客 创建支持安全启动(Secure Boot)的 Arch Linux ISO 安装镜像 | 魔帆博客 使用 Aria2 搭建离线下载服务器 | 魔帆博客
微信小程序健康打卡自动填报程序-使用 Fiddler 抓包 | 魔帆博客
筱枫 · 2021-01-11 · via 折腾不停 – 魔帆博客

应在不瞒报的前提下使用自动化健康打卡程序。
您应当知晓使用自动化程序可能造成学校处分等后果。

抓包

使用软件 Fiddler 4 进行抓包。
前期具体步骤:
Android 用户可参考:使用fiddler实现手机抓包 – 简书
iOS 用户可参考:fiddler抓苹果手机上app包的方法… – CSDN

值得注意的是,许多浏览器已不支持 TLS1.0/1.1,因此需要手动在 ToolsOptionsHTTPS 中修改 Protocols

<client>;ssl3;tls1.2
修改 HTTPS Protocols
修改 HTTPS Protocols

配置好后,试着进行打卡,发现向服务器传送了数据。

POST https: //▇▇▇.▇▇▇.edu.cn/v1/temperatures/ HTTP/1.1
Host: ▇▇▇.▇▇▇.edu.cn
Content-Type: application/json; charset=utf-8
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Accept: application/json
User-Agent: ▇▇▇
Authorization: JWT ▇▇▇▇
Referer: https: //servicewechat.com/▇▇▇/▇▇/▇▇▇.html
Content-Length: 234

{
    "value": "36",
    "condition": "A",
    "home_condition": "A",
    "watched": false,
    "watched_location": "",
    "stayed": false,
    "stayed_contacted": false,
    "family_conditions": "",
    "is_contacted": false,
    "contacted_health": "",
    "personid": "",
    "notes": "",
    "location": {}
}

我们可以看到,关键的信息是 Header 中的 Authorization 和 JSON。
JSON 当中是填报的表单,其中 value 是体温值(摄氏度)。
试着退出打卡系统重新登录,发现向服务器传送数据如下。

POST https://▇▇▇.▇▇▇.edu.cn/▇▇▇/▇▇▇/login/ HTTP/1.1
Host: ▇▇▇.▇▇▇.edu.cn
Content-Type: application/json; charset=utf-8
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Accept: application/json
User-Agent: ▇▇▇
Referer: https://servicewechat.com/▇▇▇/▇▇/▇▇▇.html
Content-Length: 59
Accept-Language: zh-cn

{"username":"▇▇▇▇▇▇","password":"▇▇▇▇▇▇","type":""}

其中 usernamepassword 均为明文,不需要做改动。
响应后返回的 JSON 为

{
    "token": "▇▇▇",
    "token_expiration_datetime": "2021-07-09 21:12:38"
}

这里的 token 加上前缀 JWT 即为上文中 header 内的 Authorization 的值。
至此,抓包部分结束。

程序设计

由于之前没有学过 Python ,但是觉得 Python 应该可以简单实现并在服务器上部署,决定用 Python 试一试。
在网上查阅资料后,相关设计步骤如下。
需要引用 requestsjson 包,用于发送 POST 请求和解析 JSON 数据。
程序如下。

import requests
import json
url = 'https://▇▇▇.▇▇▇.edu.cn/v1/temperatures/'
datas = {
    "value": "36",
    "condition": "A",
    "home_condition": "A",
    "watched": 0,
    "watched_location": "",
    "stayed": 0,
    "stayed_contacted": 0,
    "family_conditions": "",
    "is_contacted": 0,
    "contacted_health": "",
    "personid": "",
    "notes": "",
    "location": {}
}
headers={"Authorization": "JWT ▇▇▇"}
morning =requests.post(url,data=datas,headers=headers)
print(morning)
print(morning.text)

也可以设计成填入账号密码就可以自动获取 token 打卡的形式。

import requests
import json
url_morning = 'https://▇▇▇.▇▇▇.edu.cn/v1/temperatures/'
url_login = 'https://▇▇▇.▇▇▇.edu.cn/▇▇▇/▇▇▇/login/'

#下文中的学号和密码自行修改
datas_login = {"username":"▇▇▇▇▇▇","password":"▇▇▇▇▇▇","type":""}

datas_morning = {
    "value": "36",
    "condition": "A",
    "home_condition": "A",
    "watched": 0,
    "watched_location": "",
    "stayed": 0,
    "stayed_contacted": 0,
    "family_conditions": "",
    "is_contacted": 0,
    "contacted_health": "",
    "personid": "",
    "notes": "",
    "location": {}
}
login = requests.post(url_login,data=datas_login)
print("登录状态",login)
dic = json.loads(login.text)
token = "JWT "+dic['token']
headers={"Authorization": token}
morning = requests.post(url_morning,data=datas_morning,headers=headers)
print("---------------------")
print("晨报状态",morning)
print("晨报返回值",morning.text)

自动运行

对于服务器,可以配置好 Python 后设置定时任务。注意安装对应的包。
个人电脑来讲,每天手动运行或者用其他方法令其自动运行即可。