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

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

筱枫 – 魔帆博客

日文中的衬线、非衬线混排 | 魔帆博客 网页排版中的字体衬线 | 魔帆博客 中兴 CPE (4G) 设置 IPv6 联网 | 魔帆博客 使用 Aria2 搭建离线下载服务器 | 魔帆博客 使用 Jinja2 从模板生成网页 | 魔帆博客 使用 Excel 在地图上标注城市 | 魔帆博客 替换 PHP creat_function() 函数 | 魔帆博客 PC 使用 iTunes 将照片向 iPhone 的不同相册导入 | 魔帆博客 MediaWiki 的伪静态设置 (Apache 环境) | 魔帆博客 【机房技巧】关于解除 机房管理助手 程序及摆脱控制的研究 | 魔帆博客 【Javascript】自动删除QQ空间说说 | 魔帆博客 【短文】雨·呼喊·愤懑 | 魔帆博客 如何使用js调试工具Console制作彩蛋/输出信息 | 魔帆博客 【酷站】OldWeb-怀旧专用 看看我们网络的黑历史 | 魔帆博客 【娱乐向】为什么你的金鱼养着养着就挂了? | 魔帆博客 【哲学】关于颜色的思考 | 魔帆博客 【实用】在学校机房玩电脑的技巧 | 魔帆博客 催泪电影《忠犬八公的故事》 | 魔帆博客 温暖人心电影《背影》 | 魔帆博客
微信小程序健康打卡自动填报程序-使用 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 后设置定时任务。注意安装对应的包。
个人电脑来讲,每天手动运行或者用其他方法令其自动运行即可。