对分易自动签到
针对一款叫对分易的软件写的签到程序,打开后按要求登录就可以监控签到了,大学生的福利。
支持两种登录方式。
支持两种签到方式。
演示图
下载链接
打包成了exe大家可以上github下载exe文件。
https://github.com/liuzhijie443/duifene_auto_sign/releases/tag/v1.0.0
源码
import re
from datetime import datetime
import tkinter as tk
from tkinter import messagebox, ttk
import requests
import urllib3
from bs4 import BeautifulSoup
host = "https://www.duifene.com"
UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.40(0x1800282a) NetType/WIFI Language/zh_CN'
course_id = None
class_id = None
class_json = []
seconds = 5
job_id = ""
username = ""
password = ""
stu_id = ""
urllib3.disable_warnings()
x = requests.Session()
x.headers['User-Agent'] = UA
# x.proxies = {"https": "127.0.0.1:8888"}
x.verify = False
r = x.get(url=host)
def get_user_id():
global stu_id
r1 = x.get(url=host + "/_UserCenter/MB/index.aspx")
if r1.status_code == 200:
soup = BeautifulSoup(r1.text, "lxml")
code = soup.find(id="hidUID").get("value")
stu_id = code
def sign(code):
status = False
if len(code) == 4:
headers = {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Referer": "https://www.duifene.com/_CheckIn/MB/CheckInStudent.aspx?moduleid=16&pasd="
}
params = f"action=studentcheckin&studentid={stu_id}&checkincode={code}"
r1 = x.post(
url=host + "/_CheckIn/CheckIn.ashx", data=params, headers=headers)
if r1.status_code == 200:
msg = r1.json()["msgbox"]
text_box.insert(tk.END, f"\n\n{msg}\n")
if msg == "签到成功!":
text_box.insert(tk.END, f"\n")
text_box.insert(tk.END, f"\n")
text_box.insert(tk.END, f"\n")
status = True
else:
r1 = x.get(url=host + "/_CheckIn/MB/QrCodeCheckOK.aspx?state=" + code)
if r1.status_code == 200:
soup = BeautifulSoup(r1.text, "lxml")
msg = soup.find(id="DivOK").get_text()
if "签到成功" in msg:
text_box.insert(tk.END, f"\n\n{msg}\n")
text_box.insert(tk.END, f"\n")
text_box.insert(tk.END, f"\n")
text_box.insert(tk.END, f"\n")
status = True
else:
text_box.insert(tk.END, f"非微信链接登录,二维码无法签到")
return status
def get_code():
global job_id
sign_status = False
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
text_box.insert(tk.END, f"\n\n持续监控:{current_time}") # 插入当前时间
text_box.see(tk.END) # 滚动到最后一行
r1 = x.get(
url=host + f"/_CheckIn/MB/TeachCheckIn.aspx?classid={class_id}&temps=0&checktype=1&isrefresh=0&timeinterval=0&roomid=0&match=")
if r1.status_code == 200:
if "HFCheckCodeKey" in r1.text:
soup = BeautifulSoup(r1.text, "lxml")
code = soup.find(id="HFCheckCodeKey").get("value")
HFSeconds = soup.find(id="HFSeconds").get("value")
HFChecktype = soup.find(id="HFChecktype").get("value")
HFCheckInID = soup.find(id="HFCheckInID").get("value")
# 数字签到
if HFChecktype == '1':
text_box.insert(tk.END, f"\t未到签到时间\t倒计时:{HFSeconds}秒\t签到码:{code}")
if code is not None and int(HFSeconds) >", select_tab)
frame_left = tk.Frame(tab_control)
frame_left.pack(side=tk.LEFT, fill=tk.BOTH, pady=(40, 0))
text4 = tk.Label(frame_left, text="支持二维码和签到码", font=('宋体', 10))
text4.pack(pady=5)
text = tk.Label(frame_left, text="查看右侧说明进行登录", font=('宋体', 10))
text.pack(pady=5)
text2 = tk.Label(frame_left, text="链接", font=('宋体', 10))
text2.pack(pady=5)
link_entry = tk.Entry(frame_left, font=('宋体', 12))
link_entry.pack(pady=5, padx=10)
login_button = tk.Button(frame_left, text="登录", command=login_link, font=('宋体', 14))
login_button.pack(pady=5)
frame_left_2 = tk.Frame(tab_control)
text3 = tk.Label(frame_left_2, text="不支持二维码签到", font=('宋体', 10))
text3.pack(pady=5)
username_label = tk.Label(frame_left_2, text="账号", font=('宋体', 15))
username_label.pack(padx=10)
username_entry = tk.Entry(frame_left_2, font=('宋体', 12))
username_entry.pack(padx=10)
password_label = tk.Label(frame_left_2, text="密码", font=('宋体', 15))
password_label.pack(padx=10)
password_entry = tk.Entry(frame_left_2, show="*", font=('宋体', 12))
password_entry.pack(padx=10)
username_label = tk.Label(frame_left_2, text="剩余倒计时X秒后签到", font=('宋体', 10))
username_label.pack(pady=5)
seconds_entry = tk.Entry(frame_left_2, font=('宋体', 12), width=5)
seconds_entry.insert(0, "5")
seconds_entry.pack(pady=5)
login_button = tk.Button(frame_left_2, text="登录", command=login, font=('宋体', 14))
login_button.pack(pady=5)
frame_mid = tk.Frame(root)
frame_mid.pack(side=tk.TOP)
f2lable = tk.Label(frame_mid, text="选择课程")
f2lable.pack(side=tk.TOP, fill=tk.BOTH, pady=(10, 0))
combo_var = tk.StringVar()
combo = ttk.Combobox(frame_mid, textvariable=combo_var, state="readonly")
combo.bind(">", on_combo_change)
combo.pack(side=tk.LEFT, )
f2btn = tk.Button(frame_mid, text="开始监听签到", command=enter)
f2btn.pack(side=tk.RIGHT, padx=10, pady=10)
frame_right = tk.Frame(root)
frame_right.pack(side=tk.RIGHT)
text_box = tk.Text(frame_right, width=90, height=20, font=('宋体', 9))
text_box.pack(pady=(0, 10), padx=(0, 10))
root.mainloop()