This commit is contained in:
JasonYANG17 2024-03-30 17:48:25 +08:00 committed by GitHub
parent 1894586546
commit cb835089f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 25526 additions and 103 deletions

3420
build/main/Analysis-00.toc Normal file

File diff suppressed because it is too large Load Diff

2100
build/main/EXE-00.toc Normal file

File diff suppressed because it is too large Load Diff

2077
build/main/PKG-00.toc Normal file

File diff suppressed because it is too large Load Diff

BIN
build/main/PYZ-00.pyz Normal file

Binary file not shown.

1362
build/main/PYZ-00.toc Normal file

File diff suppressed because it is too large Load Diff

BIN
build/main/base_library.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
build/main/main.pkg Normal file

Binary file not shown.

73
build/main/warn-main.txt Normal file
View File

@ -0,0 +1,73 @@
This file lists modules PyInstaller was not able to find. This does not
necessarily mean this module is required for running your program. Python and
Python 3rd-party packages include a lot of conditional or optional modules. For
example the module 'ntpath' only exists on Windows, whereas the module
'posixpath' only exists on Posix systems.
Types if import:
* top-level: imported at the top-level - look at these first
* conditional: imported within an if-statement
* delayed: imported within a function
* optional: imported within a try-except-statement
IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
tracking down the missing module yourself. Thanks!
missing module named pyimod02_importers - imported by E:\Python\pythonProject8\.venv\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py (delayed), E:\Python\pythonProject8\.venv\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgres.py (delayed)
missing module named pwd - imported by posixpath (delayed, conditional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional), netrc (delayed, conditional), getpass (delayed), http.server (delayed, optional), webbrowser (delayed)
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
missing module named _posixsubprocess - imported by subprocess (optional), multiprocessing.util (delayed)
missing module named fcntl - imported by subprocess (optional)
missing module named 'org.python' - imported by copy (optional), xml.sax (delayed, conditional)
missing module named org - imported by pickle (optional)
missing module named posix - imported by shutil (conditional), importlib._bootstrap_external (conditional), os (conditional, optional)
missing module named resource - imported by posix (top-level)
missing module named _manylinux - imported by pkg_resources._vendor.packaging._manylinux (delayed, optional), packaging._manylinux (delayed, optional)
missing module named jnius - imported by pkg_resources._vendor.platformdirs.android (delayed, optional)
missing module named platformdirs - imported by pkg_resources._vendor.platformdirs.__main__ (top-level)
missing module named 'pkg_resources.extern.importlib_resources' - imported by pkg_resources._vendor.jaraco.text (optional)
missing module named 'typing.io' - imported by importlib.resources (top-level)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
missing module named pep517 - imported by importlib.metadata (delayed)
missing module named 'pkg_resources.extern.more_itertools' - imported by pkg_resources._vendor.jaraco.functools (top-level)
missing module named pkg_resources.extern.packaging - imported by pkg_resources.extern (top-level), pkg_resources (top-level)
missing module named pkg_resources.extern.platformdirs - imported by pkg_resources.extern (top-level), pkg_resources (top-level)
missing module named 'pkg_resources.extern.jaraco' - imported by pkg_resources (top-level), pkg_resources._vendor.jaraco.text (top-level)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named termios - imported by getpass (optional), tty (top-level)
missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
missing module named vms_lib - imported by platform (delayed, optional)
missing module named java - imported by platform (delayed)
missing module named _winreg - imported by platform (delayed, optional)
missing module named multiprocessing.BufferTooShort - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named multiprocessing.AuthenticationError - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
missing module named _posixshmem - imported by multiprocessing.resource_tracker (conditional), multiprocessing.shared_memory (conditional)
missing module named multiprocessing.get_context - imported by multiprocessing (top-level), multiprocessing.pool (top-level), multiprocessing.managers (top-level), multiprocessing.sharedctypes (top-level)
missing module named multiprocessing.TimeoutError - imported by multiprocessing (top-level), multiprocessing.pool (top-level)
missing module named multiprocessing.set_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
missing module named multiprocessing.get_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
missing module named asyncio.DefaultEventLoopPolicy - imported by asyncio (delayed, conditional), asyncio.events (delayed, conditional)
missing module named readline - imported by cmd (delayed, conditional, optional), code (delayed, conditional, optional), pdb (delayed, optional)
missing module named sets - imported by pytz.tzinfo (optional)
missing module named UserDict - imported by pytz.lazy (optional)
missing module named chardet - imported by requests.compat (optional), requests (optional), requests.packages (optional), bs4.dammit (optional)
missing module named cchardet - imported by bs4.dammit (optional)
missing module named bs4.builder.HTMLParserTreeBuilder - imported by bs4.builder (top-level), bs4 (top-level)
missing module named lxml - imported by bs4.builder._lxml (top-level)
missing module named 'html5lib.treebuilders' - imported by bs4.builder._html5lib (optional)
missing module named 'html5lib.constants' - imported by bs4.builder._html5lib (top-level)
missing module named html5lib - imported by bs4.builder._html5lib (top-level)
missing module named simplejson - imported by requests.compat (conditional, optional)
missing module named dummy_threading - imported by requests.cookies (optional)
missing module named zstandard - imported by urllib3.util.request (optional), urllib3.response (optional)
missing module named brotli - imported by urllib3.util.request (optional), urllib3.response (optional)
missing module named brotlicffi - imported by urllib3.util.request (optional), urllib3.response (optional)
missing module named socks - imported by urllib3.contrib.socks (optional)
missing module named cryptography - imported by urllib3.contrib.pyopenssl (top-level), requests (conditional, optional)
missing module named 'OpenSSL.crypto' - imported by urllib3.contrib.pyopenssl (delayed, conditional)
missing module named 'cryptography.x509' - imported by urllib3.contrib.pyopenssl (delayed, optional)
missing module named OpenSSL - imported by urllib3.contrib.pyopenssl (top-level)
missing module named pyodide - imported by urllib3.contrib.emscripten.fetch (top-level)
missing module named js - imported by urllib3.contrib.emscripten.fetch (top-level)

16261
build/main/xref-main.html Normal file

File diff suppressed because it is too large Load Diff

10
data.json Normal file
View File

@ -0,0 +1,10 @@
{
"class": "123",
"lat": "123",
"lng": "123",
"acc": "123",
"time": 123,
"cookie": "123",
"scheduletime": "",
"pushplus": "123"
}

10
dist/data.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"class": "123",
"lat": "123",
"lng": "123",
"acc": "123",
"time": 123,
"cookie": "123",
"scheduletime": "",
"pushplus": "123"
}

BIN
dist/main.exe vendored Normal file

Binary file not shown.

279
main.py
View File

@ -1,103 +1,176 @@
import requests import requests
import re import re
import time import time
import os import os
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import json
# 主机用户 import schedule
ClassID = input("请输入班级ID") from datetime import datetime
X = input("请输入纬度:") # 读取外部 JSON 文件中的数据
Y = input("请输入经度:") with open('data.json', 'r') as file:
ACC = input("请输入海拔:") json_data = json.load(file)
SearchTime = int(input("请输入检索时长,建议>60s")) # 普通用户
MyCookie = input("请输入你的Cookie")
token = input("请输入pushplus密钥")
print("----------提醒----------")
# 输出用户输入的内容 print("项目地址https://github.com/JasonYANG170/AutoCheckBJMF")
print("开始执行检索") print("请查看教程以获取Cookie和班级ID")
print("提示你可以在json文件中输入配置信息程序将会直接导入")
# GitHub Actions自动任务 print("----------配置信息(必填)----------")
# ClassID = os.environ['ClassID'] if (json_data['class'] == "123"):
# X = os.environ['X'] print("请通过查看教程抓包获取班级ID")
# Y = os.environ['Y'] ClassID = input("请输入班级ID")
# ACC = os.environ['ACC'] else:
# SearchTime = os.environ['SearchTime'] ClassID = json_data['class']
# MyCookie = os.environ['MyCookie'] print("输入的经纬度格式为x.x.x")
# token = os.environ['e'] if (json_data['lat'] == "123"):
X = input("请输入纬度:")
# 本地面板运行 else:
#ClassID = '' X = json_data['lat']
#X = '' if (json_data['lng'] == "123"):
#Y = '' Y = input("请输入经度:")
#ACC = '' else:
#SearchTime = 60 Y = json_data['lng']
#MyCookie = '' if (json_data['acc'] == "123"):
#token = '' #在pushplus网站中可以找到 ACC = input("请输入海拔:")
else:
title = '班级魔法自动签到任务' # 改成你要的标题内容 ACC = json_data['acc'] # input("请输入海拔:")
url = 'http://k8n.cn/student/course/' + ClassID + '/punchs' if (json_data['time'] == 123):
SearchTime = int(input("请输入检索间隔,建议>=60s"))
headers = { else:
'User-Agent': 'Mozilla/5.0 (Linux; Android 12; PAL-AL00 Build/HUAWEIPAL-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 XWEB/1160065 MMWEBSDK/20231202 MMWEBID/1136 MicroMessenger/8.0.47.2560(0x28002F35) WeChat/arm64 Weixin NetType/4G Language/zh_CN ABI/arm64', SearchTime = json_data['time'] # int(input("请输入检索时长,建议>60s"))
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/wxpic,image/tpg,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', print("----------配置Cookie----------")
'X-Requested-With': 'com.tencent.mm', print("请通过查看教程抓包获取Cookie")
'Referer': 'http://k8n.cn/student/course/75717', print("使用电脑抓取的Cookie会在电脑微信关闭时失效失效后请重新抓取")
'Accept-Encoding': 'gzip, deflate', if (json_data['cookie'] == "123"):
'Accept-Language': 'zh-CN,zh-SG;q=0.9,zh;q=0.8,en-SG;q=0.7,en-US;q=0.6,en;q=0.5', MyCookie = input("请输入你的Cookie")
'Cookie': MyCookie else:
} scheduletime = json_data['cookie'] # int(input("请输入检索时长,建议>60s"))
print("----------配置定时任务(可选)----------")
while True: print("格式为00:00,不设置定时请留空")
response = requests.get(url, headers=headers) print("提示:请使用英文符号“:”不要使用中文符号“:”")
print("响应:", response) if (json_data['scheduletime'] == ""):
scheduletime = input("请输入开启时间:")
# 创建 Beautiful Soup 对象解析 HTML else:
soup = BeautifulSoup(response.text, 'html.parser') scheduletime = json_data['scheduletime'] # int(input("请输入检索时长,建议>60s"))
print("----------配置通知(可选)----------")
# 使用正则表达式从 HTML 文本中提取所有 punch_gps() 中的数字 if (json_data['pushplus'] == "123"):
pattern = re.compile(r'punch_gps\((\d+)\)') token = input("请输入pushplus密钥,不需要请留空:")
matches = pattern.findall(response.text) else:
print("找到GPS定位签到:", matches) token = json_data['pushplus'] # input("请输入pushplus密钥")
pattern2 = re.compile(r'punchcard_(\d+)') print("----------信息----------")
matches2 = pattern2.findall(response.text) print("班级ID:"+ClassID)
print("找到扫码签到:", matches2) print("经度:" + Y)
matches.extend(matches2) print("纬度:" + X)
if matches: print("海拔:" + ACC)
for match in matches: print("检索间隔:" + str(SearchTime))
print(match) print("Cookie值:" + MyCookie)
url = "http://k8n.cn/student/punchs/course/" + ClassID + "/" + match print("定时:" + scheduletime)
payload = { print("通知token:" + token)
'id': match, print("---------------------")
'lat': X, # 输出用户输入的内容
'lng': Y, print("程序已执行")
'acc': ACC,
'res': '', # GitHub Actions自动任务
'gps_addr': '' # ClassID = os.environ['ClassID']
} # X = os.environ['X']
# Y = os.environ['Y']
response = requests.post(url, headers=headers, data=payload) # ACC = os.environ['ACC']
# SearchTime = os.environ['SearchTime']
if response.status_code == 200: # MyCookie = os.environ['MyCookie']
print("请求成功") # token = os.environ['token']
print("响应:", response) #scheduletime = os.environ['scheduletime']
# 解析响应的 HTML 内容 # 本地面板运行
soup_response = BeautifulSoup(response.text, 'html.parser') #ClassID = ''
h1_tag = soup_response.find('h1') #X = ''
#Y = ''
if h1_tag: #ACC = ''
h1_text = h1_tag.text #SearchTime = 60
print(h1_text) #MyCookie = ''
# encoding:utf-8 #token = '' #在pushplus网站中可以找到
url = 'http://www.pushplus.plus/send?token=' + token + '&title=' + title + '&content=' + h1_text # 不使用请注释 #scheduletime =''
requests.get(url) # 不使用请注释 def job():
continue # 返回到查找进行中的签到循环 current_time = datetime.now()
else: print("进入检索,当前时间为:", current_time)
print("未找到 <h1> 标签,可能存在错误") title = '班级魔法自动签到任务' # 改成你要的标题内容
else: url = 'http://k8n.cn/student/course/' + ClassID + '/punchs'
print("请求失败,状态码:", response.status_code)
else: headers = {
print("未找到在进行的签到") 'User-Agent': 'Mozilla/5.0 (Linux; Android 9; AKT-AK47 Build/USER-AK47; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 XWEB/1160065 MMWEBSDK/20231202 MMWEBID/1136 MicroMessenger/8.0.47.2560(0x28002F35) WeChat/arm64 Weixin NetType/4G Language/zh_CN ABI/arm64',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/wxpic,image/tpg,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
# 可以设置一个间隔时间,避免过于频繁地请求 'X-Requested-With': 'com.tencent.mm',
time.sleep(SearchTime) # 暂停10秒后重新尝试 'Referer': 'http://k8n.cn/student/course/'+ClassID,
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'zh-CN,zh-SG;q=0.9,zh;q=0.8,en-SG;q=0.7,en-US;q=0.6,en;q=0.5',
'Cookie': MyCookie
}
while True:
response = requests.get(url, headers=headers)
print("响应:", response)
# 创建 Beautiful Soup 对象解析 HTML
soup = BeautifulSoup(response.text, 'html.parser')
# 使用正则表达式从 HTML 文本中提取所有 punch_gps() 中的数字
pattern = re.compile(r'punch_gps\((\d+)\)')
matches = pattern.findall(response.text)
print("找到GPS定位签到:", matches)
pattern2 = re.compile(r'punchcard_(\d+)')
matches2 = pattern2.findall(response.text)
print("找到扫码签到:", matches2)
matches.extend(matches2)
if matches:
for match in matches:
print(match)
url = "http://k8n.cn/student/punchs/course/" + ClassID + "/" + match
payload = {
'id': match,
'lat': X,
'lng': Y,
'acc': ACC,#未知,可能是高度
'res': '',#未知,抓取时该函数为空,可能是密码签到
'gps_addr': ''#未知,抓取时该函数为空
}
response = requests.post(url, headers=headers, data=payload)
if response.status_code == 200:
print("请求成功")
print("响应:", response)
# 解析响应的 HTML 内容
soup_response = BeautifulSoup(response.text, 'html.parser')
h1_tag = soup_response.find('h1')
if h1_tag:
h1_text = h1_tag.text
print(h1_text)
# encoding:utf-8
if(token!=""):
url = 'http://www.pushplus.plus/send?token=' + token + '&title=' + title + '&content=' + h1_text # 不使用请注释
requests.get(url) # 不使用请注释
continue # 返回到查找进行中的签到循环
else:
print("未找到 <h1> 标签,可能存在错误")
else:
print("请求失败,状态码:", response.status_code)
else:
print("未找到在进行的签到")
# 可以设置一个间隔时间,避免过于频繁地请求
time.sleep(SearchTime) # 暂停10秒后重新尝试
if(scheduletime!=""):
print("等待设定时间"+scheduletime+"到达")
# 设置定时任务在每天的早上8点触发
schedule.every().day.at(scheduletime).do(job)
while True:
schedule.run_pending()
time.sleep(1)
else:
job()

37
main.spec Normal file
View File

@ -0,0 +1,37 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)