Skip to content

Commit

Permalink
Add | 自动下载 LoCyanFrp
Browse files Browse the repository at this point in the history
  • Loading branch information
ltzXiaoYanMo committed Mar 17, 2024
1 parent 90a32d0 commit f3120ef
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import platform
import requests
import subprocess
import winreg
import zipfile


# 封装查询系统架构的函数
def get_system_architecture():
try:
key_name = r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_name) as key:
arch_value, _ = winreg.QueryValueEx(key, "PROCESSOR_ARCHITECTURE")
return arch_value.lower()
except Exception as err:
print(f"不支持此架构: {err}")
return None


# 检测系统架构并下载对应文件
def check_system_architecture():
os_name = platform.system()
arch_info = get_system_architecture()

if os_name != "Windows" or arch_info is None:
print("不支持的操作系统或无法获取处理器架构")
return

print(f"检测到系统环境是 {arch_info},正在下载适用于 {arch_info} 的软件包...")
requests.get(f"https://mirrors.nyanest.xyz/locyan/{arch_info}_windows.zip", stream=True)

def unzip_file(zip_path, target_path):
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(target_path)

unzip_file(f'{arch_info}_windows.zip', './LoCyanPureFrp')


# 调用检查函数
check_system_architecture()
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import urllib3

from launch import *
from download import *


# 定义主类
Expand Down

0 comments on commit f3120ef

Please sign in to comment.