mirror of
https://github.com/LSPosed/MagiskOnWSALocal.git
synced 2025-05-06 06:46:35 +08:00
All Python scripts use relative path
This commit is contained in:
parent
975bdcf4d8
commit
86759ad241
@ -29,17 +29,12 @@ import shutil
|
|||||||
arch = sys.argv[1]
|
arch = sys.argv[1]
|
||||||
|
|
||||||
zip_name = ""
|
zip_name = ""
|
||||||
wsa_zip_path_raw = sys.argv[2]
|
wsa_zip_path = Path(sys.argv[2])
|
||||||
|
rootdir = Path(sys.argv[3])
|
||||||
wsa_zip_path = Path(wsa_zip_path_raw).resolve()
|
env_file = Path(sys.argv[4])
|
||||||
rootdir = Path(sys.argv[3]).resolve()
|
|
||||||
env_file_raw = sys.argv[4]
|
|
||||||
print(
|
|
||||||
f"wsa_zip_path_raw: {wsa_zip_path_raw}, env_file_raw: {env_file_raw}", flush=True)
|
|
||||||
env_file = Path(env_file_raw).resolve()
|
|
||||||
|
|
||||||
workdir = rootdir / "wsa"
|
workdir = rootdir / "wsa"
|
||||||
archdir = Path(workdir / arch).resolve()
|
archdir = Path(workdir / arch)
|
||||||
pridir = workdir / archdir / 'pri'
|
pridir = workdir / archdir / 'pri'
|
||||||
xmldir = workdir / archdir / 'xml'
|
xmldir = workdir / archdir / 'xml'
|
||||||
if not Path(rootdir).is_dir():
|
if not Path(rootdir).is_dir():
|
||||||
|
@ -29,8 +29,8 @@ from pathlib import Path
|
|||||||
arch = sys.argv[1]
|
arch = sys.argv[1]
|
||||||
brand = sys.argv[2]
|
brand = sys.argv[2]
|
||||||
variant = sys.argv[3]
|
variant = sys.argv[3]
|
||||||
download_dir = Path.cwd().parent / \
|
arg4 = sys.argv[4]
|
||||||
"download" if sys.argv[4] == "" else Path(sys.argv[4]).resolve()
|
download_dir = Path.cwd().parent / "download" if arg4 == "" else Path(arg4)
|
||||||
tempScript = sys.argv[5]
|
tempScript = sys.argv[5]
|
||||||
android_api = sys.argv[6]
|
android_api = sys.argv[6]
|
||||||
file_name = sys.argv[7]
|
file_name = sys.argv[7]
|
||||||
|
@ -29,7 +29,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
arch = sys.argv[1]
|
arch = sys.argv[1]
|
||||||
download_dir = Path.cwd().parent / \
|
download_dir = Path.cwd().parent / \
|
||||||
"download" if sys.argv[2] == "" else Path(sys.argv[2]).resolve()
|
"download" if sys.argv[2] == "" else Path(sys.argv[2])
|
||||||
tempScript = sys.argv[3]
|
tempScript = sys.argv[3]
|
||||||
kernelVersion = sys.argv[4]
|
kernelVersion = sys.argv[4]
|
||||||
file_name = sys.argv[5]
|
file_name = sys.argv[5]
|
||||||
|
@ -25,7 +25,7 @@ import requests
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
magisk_ver = sys.argv[1]
|
magisk_ver = sys.argv[1]
|
||||||
download_dir = Path.cwd().parent / "download" if sys.argv[2] == "" else Path(sys.argv[2]).resolve()
|
download_dir = Path.cwd().parent / "download" if sys.argv[2] == "" else Path(sys.argv[2])
|
||||||
tempScript = sys.argv[3]
|
tempScript = sys.argv[3]
|
||||||
print(f"Generating Magisk download link: release type={magisk_ver}", flush=True)
|
print(f"Generating Magisk download link: release type={magisk_ver}", flush=True)
|
||||||
if not magisk_ver:
|
if not magisk_ver:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import html
|
import html
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -32,7 +33,7 @@ from requests import Session
|
|||||||
|
|
||||||
|
|
||||||
class Prop(OrderedDict):
|
class Prop(OrderedDict):
|
||||||
def __init__(self, props: str=...) -> None:
|
def __init__(self, props: str = ...) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
for i, line in enumerate(props.splitlines(False)):
|
for i, line in enumerate(props.splitlines(False)):
|
||||||
if '=' in line:
|
if '=' in line:
|
||||||
@ -44,19 +45,21 @@ class Prop(OrderedDict):
|
|||||||
def get(self, key: str) -> str:
|
def get(self, key: str) -> str:
|
||||||
return self[key]
|
return self[key]
|
||||||
|
|
||||||
|
logging.captureWarnings(True)
|
||||||
arch = sys.argv[1]
|
arch = sys.argv[1]
|
||||||
|
|
||||||
release_name_map = {"retail": "Retail", "RP": "Release Preview",
|
release_name_map = {"retail": "Retail", "RP": "Release Preview",
|
||||||
"WIS": "Insider Slow", "WIF": "Insider Fast"}
|
"WIS": "Insider Slow", "WIF": "Insider Fast"}
|
||||||
release_type = sys.argv[2] if sys.argv[2] != "" else "Retail"
|
release_type = sys.argv[2] if sys.argv[2] != "" else "Retail"
|
||||||
release_name = release_name_map[release_type]
|
release_name = release_name_map[release_type]
|
||||||
download_dir = Path.cwd().parent / "download" if sys.argv[3] == "" else Path(sys.argv[3]).resolve()
|
download_dir = Path.cwd().parent / \
|
||||||
|
"download" if sys.argv[3] == "" else Path(sys.argv[3])
|
||||||
ms_account_conf = download_dir/".ms_account"
|
ms_account_conf = download_dir/".ms_account"
|
||||||
tempScript = sys.argv[4]
|
tempScript = sys.argv[4]
|
||||||
cat_id = '858014f3-3934-4abe-8078-4aa193e74ca8'
|
cat_id = '858014f3-3934-4abe-8078-4aa193e74ca8'
|
||||||
user = ''
|
user = ''
|
||||||
session = Session()
|
session = Session()
|
||||||
|
session.verify = False
|
||||||
if ms_account_conf.is_file():
|
if ms_account_conf.is_file():
|
||||||
with open(ms_account_conf, "r") as f:
|
with open(ms_account_conf, "r") as f:
|
||||||
conf = Prop(f.read())
|
conf = Prop(f.read())
|
||||||
@ -68,8 +71,7 @@ with open(Path.cwd().parent / ("xml/GetCookie.xml"), "r") as f:
|
|||||||
out = session.post(
|
out = session.post(
|
||||||
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx',
|
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx',
|
||||||
data=cookie_content,
|
data=cookie_content,
|
||||||
headers={'Content-Type': 'application/soap+xml; charset=utf-8'},
|
headers={'Content-Type': 'application/soap+xml; charset=utf-8'}
|
||||||
verify=False
|
|
||||||
)
|
)
|
||||||
doc = minidom.parseString(out.text)
|
doc = minidom.parseString(out.text)
|
||||||
cookie = doc.getElementsByTagName('EncryptedData')[0].firstChild.nodeValue
|
cookie = doc.getElementsByTagName('EncryptedData')[0].firstChild.nodeValue
|
||||||
@ -80,8 +82,7 @@ with open(Path.cwd().parent / "xml/WUIDRequest.xml", "r") as f:
|
|||||||
out = session.post(
|
out = session.post(
|
||||||
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx',
|
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx',
|
||||||
data=cat_id_content,
|
data=cat_id_content,
|
||||||
headers={'Content-Type': 'application/soap+xml; charset=utf-8'},
|
headers={'Content-Type': 'application/soap+xml; charset=utf-8'}
|
||||||
verify=False
|
|
||||||
)
|
)
|
||||||
|
|
||||||
doc = minidom.parseString(html.unescape(out.text))
|
doc = minidom.parseString(html.unescape(out.text))
|
||||||
@ -107,12 +108,12 @@ if not download_dir.is_dir():
|
|||||||
download_dir.mkdir()
|
download_dir.mkdir()
|
||||||
tmpdownlist = open(download_dir/tempScript, 'a')
|
tmpdownlist = open(download_dir/tempScript, 'a')
|
||||||
|
|
||||||
def send_req(i,v,out_file,out_file_name):
|
|
||||||
|
def send_req(i, v, out_file, out_file_name):
|
||||||
out = session.post(
|
out = session.post(
|
||||||
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured',
|
'https://fe3.delivery.mp.microsoft.com/ClientWebService/client.asmx/secured',
|
||||||
data=FE3_file_content.format(user, i, v, release_type),
|
data=FE3_file_content.format(user, i, v, release_type),
|
||||||
headers={'Content-Type': 'application/soap+xml; charset=utf-8'},
|
headers={'Content-Type': 'application/soap+xml; charset=utf-8'}
|
||||||
verify=False
|
|
||||||
)
|
)
|
||||||
doc = minidom.parseString(out.text)
|
doc = minidom.parseString(out.text)
|
||||||
for l in doc.getElementsByTagName("FileLocation"):
|
for l in doc.getElementsByTagName("FileLocation"):
|
||||||
@ -123,6 +124,7 @@ def send_req(i,v,out_file,out_file_name):
|
|||||||
tmpdownlist.writelines(f' dir={download_dir}\n')
|
tmpdownlist.writelines(f' dir={download_dir}\n')
|
||||||
tmpdownlist.writelines(f' out={out_file_name}\n')
|
tmpdownlist.writelines(f' out={out_file_name}\n')
|
||||||
|
|
||||||
|
|
||||||
threads = []
|
threads = []
|
||||||
for i, v, f in identities:
|
for i, v, f in identities:
|
||||||
if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", f):
|
if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", f):
|
||||||
@ -142,7 +144,7 @@ for i, v, f in identities:
|
|||||||
out_file = download_dir / out_file_name
|
out_file = download_dir / out_file_name
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
th = Thread(target=send_req, args=(i,v,out_file,out_file_name))
|
th = Thread(target=send_req, args=(i, v, out_file, out_file_name))
|
||||||
threads.append(th)
|
threads.append(th)
|
||||||
th.daemon = True
|
th.daemon = True
|
||||||
th.start()
|
th.start()
|
||||||
|
@ -26,7 +26,7 @@ from pathlib import Path
|
|||||||
arch = sys.argv[1]
|
arch = sys.argv[1]
|
||||||
|
|
||||||
zip_name = ""
|
zip_name = ""
|
||||||
wsa_zip_path= Path(sys.argv[2]).resolve()
|
wsa_zip_path= Path(sys.argv[2])
|
||||||
|
|
||||||
with zipfile.ZipFile(wsa_zip_path) as zip:
|
with zipfile.ZipFile(wsa_zip_path) as zip:
|
||||||
for f in zip.filelist:
|
for f in zip.filelist:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user