From ef00997ea4bb6c570859126dccdb9771d4700d5b Mon Sep 17 00:00:00 2001 From: Fox2Code Date: Mon, 31 Jan 2022 16:05:03 +0100 Subject: [PATCH] Improve Androidacy api for config with certificate pinning + minor code changes. --- app/src/main/AndroidManifest.xml | 1 + .../com/fox2code/mmm/ActionButtonType.java | 2 +- .../mmm/androidacy/AndroidacyWebAPI.java | 34 ++++++++++++++ .../mmm/installer/InstallerActivity.java | 47 +++++++++---------- .../main/res/xml/network_security_config.xml | 10 ++++ 5 files changed, 68 insertions(+), 26 deletions(-) create mode 100644 app/src/main/res/xml/network_security_config.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5a6ab48..d143063 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,6 +28,7 @@ android:theme="@style/Theme.MagiskModuleManager" android:fullBackupContent="@xml/full_backup_content" android:dataExtractionRules="@xml/data_extraction_rules" + android:networkSecurityConfig="@xml/network_security_config" android:usesCleartextTraffic="false" tools:targetApi="s"> = + Constants.MAGISK_VER_CODE_INSTALL_COMMAND && + (noExtensions || MainApplication.isUsingMagiskCommand())) { + installCommand = "magisk --install-module \"" + file.getAbsolutePath() + "\""; + installExecutable = new File(InstallerInitializer.peekMagiskPath() + .equals("/sbin") ? "/sbin/magisk" : "/system/bin/magisk"); + } else { + installExecutable = this.extractInstallScript("module_installer_compat.sh"); + if (installExecutable == null) { + this.setInstallStateFinished(false, + "! Failed to extract module install script", ""); + return; + } + installCommand = "sh \"" + installExecutable.getAbsolutePath() + "\"" + + " /dev/null 1 \"" + file.getAbsolutePath() + "\""; + } + installerMonitor = new InstallerMonitor(installExecutable); if (noExtensions) { installJob = Shell.su( // No Extensions "cd \"" + this.moduleCache.getAbsolutePath() + "\"", - "magisk --install-module \"" + file.getAbsolutePath() + "\"") - .to(installerController, installerMonitor); + installCommand).to(installerController, installerMonitor); } else { installJob = Shell.su("export MMM_EXT_SUPPORT=1", "export MMM_USER_LANGUAGE=" + (MainApplication.isForceEnglish() ? @@ -225,27 +241,8 @@ public class InstallerActivity extends CompatActivity { "export MMM_APP_VERSION=" + BuildConfig.VERSION_NAME, "export MMM_TEXT_WRAP=" + (this.textWrap ? "1" : "0"), "cd \"" + this.moduleCache.getAbsolutePath() + "\"", - "magisk --install-module \"" + file.getAbsolutePath() + "\"") - .to(installerController, installerMonitor); - } - } else { - File installScript = this.extractInstallScript("module_installer_compat.sh"); - if (installScript == null) { - this.setInstallStateFinished(false, - "! Failed to extract module install script", ""); - return; + installCommand).to(installerController, installerMonitor); } - installerMonitor = new InstallerMonitor(installScript); - installJob = Shell.su("export MMM_EXT_SUPPORT=1", - "export MMM_USER_LANGUAGE=" + (MainApplication.isForceEnglish() ? - "en-US" : Resources.getSystem() - .getConfiguration().locale.toLanguageTag()), - "export MMM_APP_VERSION=" + BuildConfig.VERSION_NAME, - "export MMM_TEXT_WRAP=" + (this.textWrap ? "1" : "0"), - "cd \"" + this.moduleCache.getAbsolutePath() + "\"", - "sh \"" + installScript.getAbsolutePath() + "\"" + - " /dev/null 1 \"" + file.getAbsolutePath() + "\"") - .to(installerController, installerMonitor); } boolean success = installJob.exec().isSuccess(); // Wait one UI cycle before disabling controller or processing results diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..9510e98 --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,10 @@ + + + + androidacy.com + + V6pbbd2/CCaa1dr+vGnpUrA1xoZ/GgncNuYzD26dikw= + FEzVOUp4dF3gI0ZVPRJhFbSJVXR+uQmMH65xhs1glH4= + + + \ No newline at end of file