diff --git a/.gitignore b/.gitignore index 753760c..d3967cb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ original tools __pycache__ -.venv \ No newline at end of file +.venv +*.jks +*.pass diff --git a/main.py b/main.py index a2a5fcf..860a72a 100644 --- a/main.py +++ b/main.py @@ -110,7 +110,7 @@ def decompile_apk(apk: str): def compile_apk(apk: str): print("Компилируем apk...") try: - result = subprocess.run( + subprocess.run( "tools/apktool b decompiled -o " + os.path.join("modified", apk), shell=True, check=True, @@ -118,6 +118,29 @@ def compile_apk(apk: str): stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, ) + subprocess.run( + "zipalign -v 4 " + os.path.join("modified", apk) + " " + os.path.join("modified", apk.replace(".apk", "-aligned.apk")), + shell=True, + check=True, + text=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.PIPE, + ) + subprocess.run( + "apksigner sign " + + "--v1-signing-enabled false " + + "--v2-signing-enabled true " + + "--v3-signing-enabled true " + + "--ks keystore.jks " + + "--ks-pass file:keystore.pass " + + "--out " + os.path.join("modified", apk.replace(".apk", "-mod.apk")) + + " " + os.path.join("modified", apk.replace(".apk", "-aligned.apk")), + shell=True, + check=True, + text=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.PIPE, + ) except subprocess.CalledProcessError as e: print("Ошибка при выполнении команды:") print(e.stderr) diff --git a/patches/change_server.py b/patches/change_server.py index ac66248..9149e7d 100644 --- a/patches/change_server.py +++ b/patches/change_server.py @@ -27,4 +27,14 @@ def apply(config: dict) -> bool: 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"]}"')) + content = "" + tqdm.write("Удаление динамического выбора сервера") + filepath = './decompiled/smali_classes2/com/swiftsoft/anixartd/DaggerApp_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.smali' + 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