雷神加速器,游戏退出后自动暂停Python源码
# 看了论坛有相似的程序,因为是封装版有可能导致你的账号发送到其他不安全的地方。这个python源码放心使用。保存本地的配置文件也是加密的。
# 仅作学习研究用,不得用于其他用途。
# 你可以自己更换秘钥。
import hashlib# 导入hashlib模块,用于加密密码
import requests# 导入requests模块,用于发送HTTP请求
import json# 导入json模块,用于处理JSON格式的数据
import psutil# 导入psutil模块,用于获取系统进程信息
import time# 导入time模块,用于处理时间
import os# 导入os模块,用于执行操作系统命令
import rsa
class ThorAccelerator:
def __init__(self):
self.LOGIN_API = 'https://webapi.leigod.com/api/auth/login'# 登录API接口
self.PAUSE_API = 'https://webapi.leigod.com/api/user/pause'# 暂停API接口
self.INFO_API = 'https://webapi.leigod.com/api/user/info'# 用户信息API接口
self.BROWSER_HEADERS = {
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
'Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188'
}
self.KEY_LENGTH = 4096
self.BLOCK_SIZE = int(self.KEY_LENGTH // 8 - 11)
self.PUBKEY = rsa.PublicKey.load_pkcs1(
b'-----BEGIN RSA PUBLIC KEY-----\nMIICCgKCAgEAqAnfvjiNj5rfxJBiZfMD4PHSsFBNbGtYCnrW+ShtDMUL/LUJqZxQ'
b'\nlCRzU7/Zp1eUG7sXIVqMz2Y6bKLuOYfV7WsS8gF4Jda6XRG2ZLsHl0ZIc6yM2cOG\nihs5lWLBDKHW3HubYbJ'
b'+ubDiKORx5NH9ZJfVYTLCwSEBJKLyqQwxxzdJevUpZiDX'
b'\nS6nhQwugLLBRtPPB7gMH4JrxIZd8ihfAlsD6bCNPJNksLfM1ZR0Io2HnMVlGRSb6\nW/0Plen2RQ'
b'+vY6DlqAQf7yVnvyLe9nZGVCvqEbZ+YdgdtwHYmslUTwzD2KleENtN'
b'\nvXN7B3ocsgNH7l3RKihXTabcTanRWvt6qFkjYEXxmiLIBDEBtXgwIiGrKML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9PcMbH5e8SLNGzSih7O9bGb5\noPN5s2Mft+WmSMQS56oTdDDtqvszwWOGr/ALwQQg0wJpe'
b'+3zkKjTu/Qj2DDQ/yhS\nRtpi+LukqKmAWKooeTXTWk4uYJgf6d2MhK/QYCSrXwnajFY4EmZCs0M371KWsr5G'
b'\nhIi9Lm5Tb0Z5uhUS8Vn8MBaNBpkymSJOkMg958lQVm5zpc+dynIdScKQZbmQmBNO\nFRpwi'
b'+84tShCF0qIfAfzO2H3iEkrpQKCAREAtb9weZA0t569ucxRUPdrAl6QuTNc'
b'\nOD8euGADStaaOfgfuqML6OASIROP1MxZmwc9cq8MEWpM9S1k8G81AGrZDYwjCiPH\nv7qiEjYTmX/C4mQ95LvQvjtGkm9kdiSHWS'
b'/zYmzRG/1SZl2hUYRytVlwbNq+1xMy\njJXccgzQpzhOFXuKNqj84u20rc0Daup+XSR+ltCVboulE4cuyWC4eWYBbdeMMPNl'
b'\nDsKETm0c5xjwK7iYk3Pi6lgTv4/BK1aWSpY1F9baxOTFDOHOQzP3mIYfpHX+V/vt\nMghXvP5UJc4ug4MYn94KBaM2QMD6Jeb'
b'/zKDIM4cuI6Wa6oaSgfXhmCXagH1gDtCJ\nUrT2nqcejB+ieVk=\n-----END RSA PRIVATE KEY-----\n'
)
self.USER_INFO = {}
def read_config(self):
config_file_path = 'config.rsa-4096'# 读取配置文件
if os.path.isfile(config_file_path):
# 打开文件
with open(file=config_file_path, mode='rb') as f:
content = f.read()
# 解密文件
result = b""
for i in range(0, len(content), self.KEY_LENGTH // 8):
result += rsa.decrypt(content, self.PRIVKEY)
self.USER_INFO = json.loads(result.decode())
else:
# 用户输入
self.USER_INFO = {
'登录信息': {
"country_code": 86,
"username": input('输入账号:'),
"password": hashlib.md5(input('输入密码:').encode("utf-8")).hexdigest(),
},
'特征信息': {
"account_token": None,
"lang": "zh_CN"
},
'进程名字': input('输入进程名:'),
'延时暂停': input('延时暂停:'),
}
# 发送登录请求,获取特征码
r = requests.post(url=self.LOGIN_API, headers=self.BROWSER_HEADERS, data=self.USER_INFO['登录信息'])
if r.status_code == 200:
r = json.loads(r.text)
if r['msg'] == '成功':
# 更新特征码
self.USER_INFO['特征信息']['account_token'] = r['data']['login_info']['account_token']
# 加密并保存
content = str.encode(json.dumps(self.USER_INFO))
crypto = b""
for i in range(0, len(content), self.BLOCK_SIZE):
crypto += rsa.encrypt(content, self.PUBKEY)
with open(file='config.rsa-4096', mode='wb') as f:
f.write(crypto)
# 发送用户信息请求,检查特征码是否过期。加密、保存
r = requests.post(self.INFO_API, headers=self.BROWSER_HEADERS, data=self.USER_INFO['特征信息'])
if r.status_code == 200:
if json.loads(r.text)['msg'] == '账号未登录':
r = requests.post(url=self.LOGIN_API, headers=self.BROWSER_HEADERS, data=self.USER_INFO['登录信息'])
if r.status_code == 200:
r = json.loads(r.text)
if r['msg'] == '成功':
self.USER_INFO['特征信息']['account_token'] = r['data']['login_info']['account_token']
# 加密并保存
content = str.encode(json.dumps(self.USER_INFO))
crypto = b""
for i in range(0, len(content), self.BLOCK_SIZE):
crypto += rsa.encrypt(content, self.PUBKEY)
with open(file='config.rsa-4096', mode='wb') as f:
f.write(crypto)
def check_process(self):
# 检查进程是否存在
if ".exe" not in self.USER_INFO['进程名字']:
self.USER_INFO['进程名字'] = self.USER_INFO['进程名字'] + ".exe"
for process in psutil.process_iter():
if process.name() == self.USER_INFO['进程名字']:
return True
return False
def pause_accelerator(self):
# 暂停加速
requests.post(url=self.PAUSE_API, headers=self.BROWSER_HEADERS, data=self.USER_INFO['特征信息'])
r = requests.post(url=self.INFO_API, headers=self.BROWSER_HEADERS, data=self.USER_INFO['特征信息'])
if r.status_code == 200:
if json.loads(r.text)['data']['pause_status'] == '暂停中':
return True
return False
def main(self):
# 实时监控游戏进程
t1 = 0
while True:
if self.check_process():
break
else:
os.system('cls')
print(f'\r等待启动游戏:{t1}', end='', flush=True)
t1 += 1
time.sleep(1)
# 游戏启动了
start_time = time.time()# 记录开始时间
while True:
if self.check_process():
current_time = time.time() - start_time# 计算当前时间与开始时间的差值
hours = int(current_time / 3600)# 计算小时数
minutes = int((current_time % 3600) / 60)# 计算分钟数
seconds = int(current_time % 60)# 计算秒数
time_str = f"{hours:02d}:{minutes:02d}:{seconds:02d}"# 格式化时间字符串
os.system('cls')
print(f'\r游戏已经启动:{time_str}', end='', flush=True)
else:
if self.pause_accelerator():
os.system('cls')
print('\r加速器已经退出!!!', end='', flush=True)
input()
exit()
time.sleep(1)
if __name__ == '__main__':
thor_accelerator = ThorAccelerator()
try:
thor_accelerator.read_config()
# print(thor_accelerator.USER_INFO)
thor_accelerator.main()
except BaseException as e:
print(e)
页:
[1]