This commit is contained in:
+55
-40
@@ -6,58 +6,73 @@
|
||||
}
|
||||
"""
|
||||
|
||||
priority = 0
|
||||
|
||||
# imports
|
||||
__author__ = "wowlikon <wowlikon@gmail.com>"
|
||||
__version__ = "1.0.0"
|
||||
import json
|
||||
from typing import Any, Dict
|
||||
|
||||
import requests
|
||||
from tqdm import tqdm
|
||||
from typing import Dict, Any
|
||||
from pydantic import Field
|
||||
from tqdm import tqdm
|
||||
|
||||
from utils.config import PatchConfig
|
||||
from utils.config import PatchTemplate
|
||||
|
||||
#Config
|
||||
class Config(PatchConfig):
|
||||
|
||||
class Patch(PatchTemplate):
|
||||
priority: int = Field(frozen=True, exclude=True, default=0)
|
||||
server: str = Field("https://anixarty.0x174.su/patch", description="URL сервера")
|
||||
|
||||
# Patch
|
||||
def apply(config: Config, base: Dict[str, Any]) -> bool:
|
||||
response = requests.get(config.server) # Получаем данные для патча
|
||||
assert response.status_code == 200, f"Failed to fetch data {response.status_code} {response.text}"
|
||||
def apply(self, base: Dict[str, Any]) -> bool:
|
||||
response = requests.get(self.server) # Получаем данные для патча
|
||||
assert (
|
||||
response.status_code == 200
|
||||
), f"Failed to fetch data {response.status_code} {response.text}"
|
||||
|
||||
new_api = json.loads(response.text)
|
||||
for item in new_api['modifications']: # Применяем замены API
|
||||
tqdm.write(f"Изменение {item['file']}")
|
||||
filepath = './decompiled/smali_classes2/com/swiftsoft/anixartd/network/api/'+item['file']
|
||||
new_api = json.loads(response.text)
|
||||
for item in new_api["modifications"]: # Применяем замены API
|
||||
tqdm.write(f"Изменение {item['file']}")
|
||||
filepath = (
|
||||
"./decompiled/smali_classes2/com/swiftsoft/anixartd/network/api/"
|
||||
+ item["file"]
|
||||
)
|
||||
|
||||
with open(filepath, 'r') as f:
|
||||
with open(filepath, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
with open(filepath, "w") as f:
|
||||
if content.count(item["src"]) == 0:
|
||||
tqdm.write(f"⚠ Не найдено {item['src']}")
|
||||
f.write(content.replace(item["src"], item["dst"]))
|
||||
|
||||
tqdm.write(
|
||||
f"Изменение Github ссылки"
|
||||
) # Обновление ссылки на поиск серверов в Github
|
||||
filepath = "./decompiled/smali_classes2/com/swiftsoft/anixartd/utils/anixnet/GithubPagesNetFetcher.smali"
|
||||
|
||||
with open(filepath, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
with open(filepath, 'w') as f:
|
||||
if content.count(item['src']) == 0:
|
||||
tqdm.write(f"⚠ Не найдено {item['src']}")
|
||||
f.write(content.replace(item['src'], item['dst']))
|
||||
with open(filepath, "w") as f:
|
||||
f.write(
|
||||
content.replace(
|
||||
'const-string v1, "https://anixhelper.github.io/pages/urls.json"',
|
||||
f'const-string v1, "{new_api["gh"]}"',
|
||||
)
|
||||
)
|
||||
|
||||
tqdm.write(f"Изменение Github ссылки") # Обновление ссылки на поиск серверов в Github
|
||||
filepath = './decompiled/smali_classes2/com/swiftsoft/anixartd/utils/anixnet/GithubPagesNetFetcher.smali'
|
||||
tqdm.write(
|
||||
"Удаление динамического выбора сервера"
|
||||
) # Отключение автовыбора сервера
|
||||
filepath = "./decompiled/smali_classes2/com/swiftsoft/anixartd/DaggerApp_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.smali"
|
||||
|
||||
with open(filepath, 'r') as f:
|
||||
content = f.read()
|
||||
content = ""
|
||||
with open(filepath, "r") as f:
|
||||
for line in f.readlines():
|
||||
if "addInterceptor" in line:
|
||||
continue
|
||||
content += line
|
||||
|
||||
with open(filepath, 'w') as f:
|
||||
f.write(content.replace('const-string v1, "https://anixhelper.github.io/pages/urls.json"', f'const-string v1, "{new_api["gh"]}"'))
|
||||
with open(filepath, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
tqdm.write("Удаление динамического выбора сервера") # Отключение автовыбора сервера
|
||||
filepath = './decompiled/smali_classes2/com/swiftsoft/anixartd/DaggerApp_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.smali'
|
||||
|
||||
content = ""
|
||||
with open(filepath, 'r') as f:
|
||||
for line in f.readlines():
|
||||
if "addInterceptor" in line: continue
|
||||
content += line
|
||||
|
||||
with open(filepath, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
return True
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user