Compare commits
10 Commits
746353decb
...
068a1862f5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
068a1862f5 | ||
|
|
71556315bc | ||
|
|
b34d2eb2e2 | ||
|
|
1e9d77b2d4 | ||
|
|
96ceb13e99 | ||
|
|
5aec9db57d | ||
|
|
4ae812936f | ||
|
|
77c0bf866c | ||
|
|
718ef4f3b1 | ||
|
|
3e4f5eb56a |
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
@@ -28,9 +28,10 @@ jobs:
|
||||
run: |
|
||||
git config --global user.name github-actions
|
||||
git config --global user.email github-actions@github.com
|
||||
git config --global pull.rebase true
|
||||
git remote add upstream https://github.com/Limourli-liu/daily_fudan.git
|
||||
git pull upstream master --allow-unrelated-histories
|
||||
git push origin master
|
||||
git push origin master --force
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
|
||||
90
README.md
90
README.md
@@ -1,92 +1,14 @@
|
||||
10.26 更新:
|
||||
信息办加了图形验证
|
||||
|
||||
# 免责声明
|
||||
郑重声明:本人只是使用该脚本测试微信通知功能,并不了解脚本本身功能,未参与脚本开发,不承担一切相关与连带责任。
|
||||
以下大部分为原作者的内容
|
||||
[Limourli-liu](https://github.com/Limourli-liu)添加了验证码识别及微信通知功能
|
||||
|
||||
# Daily_Fudan
|
||||
> 一键平安复旦小脚本
|
||||
>
|
||||
|
||||
> 无用的前情提要:https://zhuanlan.zhihu.com/p/136340395
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 💭声明
|
||||
一眨眼过了一年,没想到时至今日还要填这个煞笔玩意,呵呵呵。
|
||||
|
||||
|
||||
> 🔺 此脚本原理是拉取你上一次提交的信息,然后再次上传。所以跟你前一天信息一样,如果你需要修改,请停止此脚本运行,并手动提交。
|
||||
>
|
||||
|
||||
> 🛑 由于本人水平零蛋, 此脚本能跑起来属实意外,本人怀着探讨的目的上传到网络平台交流,并未授权任何人,造成的一切后果概不负责。
|
||||
|
||||
|
||||
这个人很懒,此Readme文档直接拿[genshin-impact-helper](https://github.com/y1ndan/genshin-impact-helper)
|
||||
改的
|
||||
|
||||
## 📐部署
|
||||
<details>
|
||||
<summary>查看教程</summary>
|
||||
|
||||
- 项目地址:[github/daily_fudan](https://github.com/k652/daily_fudan)
|
||||
- 点击右上角`Fork`到自己的账号下
|
||||
|
||||

|
||||
|
||||
- 将仓库默认分支设置为 master 分支
|
||||
|
||||
|
||||
### 3. 添加 账号密码 至 Secrets
|
||||
|
||||
- 回到项目页面,依次点击`Settings`-->`Secrets`-->`New secret`
|
||||
|
||||

|
||||
|
||||
- 建立名为`FUDAN`的 secret,值为`学号`+`(空格)`+`密码`,最后点击`Add secret`
|
||||
- secret名字必须为`FUDAN`!
|
||||
- secret名字必须为`FUDAN`!
|
||||
- secret名字必须为`FUDAN`!
|
||||
- 如果要开启成功填写的通知,在 http://iyuu.cn/ 申请token 然后在密码后面+ `(空格)`+`token`
|
||||
- `学号`+`(空格)`+`密码`+ `(空格)`+`token`
|
||||
|
||||
### 4. 启用 Actions
|
||||
|
||||
> Actions 默认为关闭状态,Fork 之后需要手动执行一次,若成功运行其才会激活。
|
||||
|
||||
返回项目主页面,点击上方的`Actions`,再点击左侧的`Daily Fudan`,再点击`Run workflow`
|
||||
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
至此,部署完毕。
|
||||
|
||||
## 🔍结果
|
||||
|
||||
当你完成上述流程,可以在`Actions`页面点击`Daily Fudan`-->`build`-->`Run sign`查看结果。
|
||||
|
||||
<details>
|
||||
<summary>查看结果</summary>
|
||||
|
||||
### 签到成功
|
||||
|
||||
如果成功,会输出类似`成功`的信息:
|
||||
|
||||
|
||||
### 签到失败
|
||||
|
||||
如果失败,会输出类似`啥`的信息:
|
||||
|
||||
|
||||
同时你会收到一封来自GitHub、标题为`Run failed: Daily Fudan - master`的邮件。
|
||||
|
||||
</details>
|
||||
各位可跟进这位
|
||||
|
||||
查看:https://github.com/k652/daily_fudan/pull/15
|
||||
|
||||
|
||||
世事繁忙,无力维护,山高水长,后会无期
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
__pycache__/captcha_break.cpython-39.pyc
Normal file
BIN
__pycache__/captcha_break.cpython-39.pyc
Normal file
Binary file not shown.
92
captcha_break.py
Normal file
92
captcha_break.py
Normal file
@@ -0,0 +1,92 @@
|
||||
import base64
|
||||
import json
|
||||
import sys
|
||||
import requests
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
|
||||
def base64_api(uname, pwd, img, typeid):
|
||||
base64_data = base64.b64encode(img)
|
||||
b64 = base64_data.decode()
|
||||
data = {"username": uname, "password": pwd, "typeid": typeid, "image": b64}
|
||||
result = json.loads(requests.post("http://api.ttshitu.com/predict", json=data).text)
|
||||
return result
|
||||
|
||||
def reportError(id):
|
||||
data = {"id": id}
|
||||
result = json.loads(requests.post("http://api.kuaishibie.cn/reporterror.json", json=data).text)
|
||||
if result['success']:
|
||||
return "报错成功"
|
||||
else:
|
||||
return result["message"]
|
||||
|
||||
from sys import exit as sys_exit
|
||||
def getCaptchaData(zlapp):
|
||||
url = 'https://zlapp.fudan.edu.cn/backend/default/code'
|
||||
headers = {'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',
|
||||
'accept-encoding': 'gzip',
|
||||
'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
||||
'dnt': '1',
|
||||
'referer': 'https://zlapp.fudan.edu.cn/site/ncov/fudanDaily',
|
||||
'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
|
||||
'sec-ch-ua-mobile': '?0',
|
||||
'sec-fetch-dest': 'image',
|
||||
'sec-fetch-mode': 'no-cors',
|
||||
'sec-fetch-site': 'same-origin',
|
||||
"User-Agent": zlapp.UA}
|
||||
res = zlapp.session.get(url, headers=headers)
|
||||
return res.content
|
||||
|
||||
class DailyFDCaptcha:
|
||||
zlapp = None
|
||||
uname = ''
|
||||
pwd = ''
|
||||
typeid = 2 # 纯英文
|
||||
info = lambda x: x
|
||||
id = 0
|
||||
def __init__(self,
|
||||
uname, pwd,
|
||||
zlapp,
|
||||
info_callback):
|
||||
self.zlapp = zlapp
|
||||
self.uname = uname
|
||||
self.pwd = pwd
|
||||
self.info = info_callback
|
||||
def __call__(self):
|
||||
img = getCaptchaData(self.zlapp)
|
||||
result = base64_api(self.uname,self.pwd,img,self.typeid)
|
||||
print(result)
|
||||
if result['success']:
|
||||
self.id = result["data"]["id"]
|
||||
return result["data"]["result"]
|
||||
else:
|
||||
self.info(result["message"])
|
||||
def reportError(self):
|
||||
if self.id != 0:
|
||||
self.info(reportError(self.id))
|
||||
|
||||
if __name__ == "__main__":
|
||||
def base64_api(uname, pwd, img, typeid):
|
||||
return {
|
||||
"success": False,
|
||||
"code": "-1",
|
||||
"message": "用户名或密码错误",
|
||||
"data": ""
|
||||
}
|
||||
print(base64_api(0,0,0,0))
|
||||
test = DailyFDCaptcha(0,0,0,print)
|
||||
test(0)
|
||||
def base64_api(uname, pwd, img, typeid):
|
||||
return {
|
||||
"success": True,
|
||||
"code": "0",
|
||||
"message": "success",
|
||||
"data": {
|
||||
"result": "hhum",
|
||||
"id": "00504808e68a41ad83ab5c1e6367ae6b"
|
||||
}
|
||||
}
|
||||
print(test(0))
|
||||
def reportError(id):
|
||||
return id
|
||||
test.reportError()
|
||||
@@ -1,5 +1,6 @@
|
||||
import time
|
||||
from json import loads as json_loads
|
||||
from json import dumps as json_dumps
|
||||
from os import path as os_path
|
||||
from sys import exit as sys_exit
|
||||
from sys import argv as sys_argv
|
||||
@@ -13,6 +14,7 @@ logging.basicConfig(level=logging.INFO,
|
||||
# WeChat notice
|
||||
#get token via http://iyuu.cn/
|
||||
import requests
|
||||
from captcha_break import DailyFDCaptcha
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
def iyuu(IYUU_TOKEN):
|
||||
@@ -167,13 +169,21 @@ class Zlapp(Fudan):
|
||||
if last_info["d"]["info"]["date"] == today:
|
||||
logging.info("今日已提交")
|
||||
self.close()
|
||||
global gl_info
|
||||
gl_info = last_info
|
||||
geo_api_info = json_loads(last_info["d"]["info"]["geo_api_info"])
|
||||
province = geo_api_info["addressComponent"].get("province", "")
|
||||
city = geo_api_info["addressComponent"].get("city", "") or province
|
||||
district = geo_api_info["addressComponent"].get("district", "")
|
||||
gl_info['dailyFudan'] = " ".join(set_q((province, city, district)))
|
||||
gl_info = json_dumps(gl_info, indent=4, ensure_ascii=False)
|
||||
return True
|
||||
else:
|
||||
logging.info("未提交")
|
||||
self.last_info = last_info["d"]["info"]
|
||||
return False
|
||||
|
||||
def checkin(self):
|
||||
def checkin(self, captcha):
|
||||
"""
|
||||
提交
|
||||
"""
|
||||
@@ -201,15 +211,26 @@ class Zlapp(Fudan):
|
||||
}
|
||||
)
|
||||
# logging.debug(self.last_info)
|
||||
for i in range(3):
|
||||
captcha_text = captcha()
|
||||
#captcha_text = 'abcd'
|
||||
self.last_info.update({
|
||||
'sfzx': 1,
|
||||
'code': captcha_text
|
||||
})
|
||||
save = self.session.post(
|
||||
'https://zlapp.fudan.edu.cn/ncov/wap/fudan/save',
|
||||
data=self.last_info,
|
||||
headers=headers,
|
||||
allow_redirects=False)
|
||||
|
||||
save = self.session.post(
|
||||
'https://zlapp.fudan.edu.cn/ncov/wap/fudan/save',
|
||||
data=self.last_info,
|
||||
headers=headers,
|
||||
allow_redirects=False)
|
||||
|
||||
save_msg = json_loads(save.text)["m"]
|
||||
logging.info(save_msg)
|
||||
save_msg = json_loads(save.text)["m"]
|
||||
logging.info(save_msg)
|
||||
if save_msg != '验证码错误':
|
||||
break
|
||||
else:
|
||||
captcha.reportError()
|
||||
print('captcha.reportError')
|
||||
|
||||
def get_account():
|
||||
"""
|
||||
@@ -218,32 +239,49 @@ def get_account():
|
||||
uid, psw, *IYUU_TOKEN = sys_argv[1].strip().split(' ')
|
||||
return uid, psw, IYUU_TOKEN
|
||||
|
||||
gl_info = "快去手动填写!"
|
||||
if __name__ == '__main__':
|
||||
uid, psw, IYUU_TOKE = get_account()
|
||||
if IYUU_TOKE: #有token则通知,无token不通知
|
||||
if len(IYUU_TOKE) != 3:
|
||||
logging.error("请正确配置微信通知功能和验证码打码功能~\n")
|
||||
sys_exit(1)
|
||||
uname = IYUU_TOKE[1]
|
||||
pwd = IYUU_TOKE[2]
|
||||
IYUU_TOKE = IYUU_TOKE[0]
|
||||
iy_info = iyuu(IYUU_TOKE)
|
||||
if IYUU_TOKE.startswith('IYUU'):
|
||||
iy_info = iyuu(IYUU_TOKE)
|
||||
else:
|
||||
def iy_info(text, desp=""):
|
||||
pass
|
||||
else:
|
||||
def iy_info(text, desp=""):
|
||||
pass
|
||||
logging.error("请按readme操作,以正确完成配置~\n")
|
||||
sys_exit(1)
|
||||
|
||||
# logging.debug("ACCOUNT:" + uid + psw)
|
||||
zlapp_login = 'https://uis.fudan.edu.cn/authserver/login?' \
|
||||
'service=https://zlapp.fudan.edu.cn/site/ncov/fudanDaily'
|
||||
daily_fudan = Zlapp(uid, psw, url_login=zlapp_login)
|
||||
if not daily_fudan.login():
|
||||
iy_info("平安复旦:登陆失败")
|
||||
iy_info("平安复旦:登陆失败", gl_info)
|
||||
sys_exit()
|
||||
|
||||
if daily_fudan.check():
|
||||
iy_info("平安复旦:今日已提交")
|
||||
iy_info("平安复旦:今日已提交", gl_info)
|
||||
sys_exit()
|
||||
daily_fudan.checkin()
|
||||
|
||||
def captcha_info(message):
|
||||
iy_info(message, gl_info)
|
||||
captcha = DailyFDCaptcha(uname,pwd,daily_fudan,captcha_info)
|
||||
daily_fudan.checkin(captcha)
|
||||
|
||||
# 再检查一遍
|
||||
if daily_fudan.check():
|
||||
iy_info("平安复旦:今日已提交")
|
||||
iy_info("平安复旦:今日已提交", gl_info)
|
||||
else:
|
||||
iy_info("平安复旦:本次提交失败")
|
||||
iy_info("平安复旦:本次提交失败", gl_info)
|
||||
|
||||
daily_fudan.close()
|
||||
sys_exit()
|
||||
sys_exit()
|
||||
|
||||
Reference in New Issue
Block a user