diff --git a/app/src/main/assets/aliuhook/LICENSE b/app/src/main/assets/aliuhook/LICENSE new file mode 100644 index 0000000..ed6906a --- /dev/null +++ b/app/src/main/assets/aliuhook/LICENSE @@ -0,0 +1,3 @@ +**/liblsplant.so Copyright 2022 LSPosed , LGPL3.0, see https://www.gnu.org/licenses/lgpl-3.0.en.html + +See https://github.com/Aliucord/hook diff --git a/app/src/main/assets/aliuhook/arm64-v8a/libaliuhook.so b/app/src/main/assets/aliuhook/arm64-v8a/libaliuhook.so new file mode 100644 index 0000000..34ec1a4 Binary files /dev/null and b/app/src/main/assets/aliuhook/arm64-v8a/libaliuhook.so differ diff --git a/app/src/main/assets/aliuhook/arm64-v8a/libc++_shared.so b/app/src/main/assets/aliuhook/arm64-v8a/libc++_shared.so new file mode 100644 index 0000000..6bdccac Binary files /dev/null and b/app/src/main/assets/aliuhook/arm64-v8a/libc++_shared.so differ diff --git a/app/src/main/assets/aliuhook/arm64-v8a/liblsplant.so b/app/src/main/assets/aliuhook/arm64-v8a/liblsplant.so new file mode 100644 index 0000000..d53ba87 Binary files /dev/null and b/app/src/main/assets/aliuhook/arm64-v8a/liblsplant.so differ diff --git a/app/src/main/assets/aliuhook/armeabi-v7a/libaliuhook.so b/app/src/main/assets/aliuhook/armeabi-v7a/libaliuhook.so new file mode 100644 index 0000000..ad4d85b Binary files /dev/null and b/app/src/main/assets/aliuhook/armeabi-v7a/libaliuhook.so differ diff --git a/app/src/main/assets/aliuhook/armeabi-v7a/libc++_shared.so b/app/src/main/assets/aliuhook/armeabi-v7a/libc++_shared.so new file mode 100644 index 0000000..f633c88 Binary files /dev/null and b/app/src/main/assets/aliuhook/armeabi-v7a/libc++_shared.so differ diff --git a/app/src/main/assets/aliuhook/armeabi-v7a/liblsplant.so b/app/src/main/assets/aliuhook/armeabi-v7a/liblsplant.so new file mode 100644 index 0000000..1557380 Binary files /dev/null and b/app/src/main/assets/aliuhook/armeabi-v7a/liblsplant.so differ diff --git a/app/src/main/assets/aliuhook/classes.dex b/app/src/main/assets/aliuhook/classes.dex new file mode 100644 index 0000000..105afcf Binary files /dev/null and b/app/src/main/assets/aliuhook/classes.dex differ diff --git a/app/src/main/assets/aliuhook/x86/libaliuhook.so b/app/src/main/assets/aliuhook/x86/libaliuhook.so new file mode 100644 index 0000000..b91f567 Binary files /dev/null and b/app/src/main/assets/aliuhook/x86/libaliuhook.so differ diff --git a/app/src/main/assets/aliuhook/x86/libc++_shared.so b/app/src/main/assets/aliuhook/x86/libc++_shared.so new file mode 100644 index 0000000..99d0522 Binary files /dev/null and b/app/src/main/assets/aliuhook/x86/libc++_shared.so differ diff --git a/app/src/main/assets/aliuhook/x86/liblsplant.so b/app/src/main/assets/aliuhook/x86/liblsplant.so new file mode 100644 index 0000000..075dfae Binary files /dev/null and b/app/src/main/assets/aliuhook/x86/liblsplant.so differ diff --git a/app/src/main/assets/aliuhook/x86_64/libaliuhook.so b/app/src/main/assets/aliuhook/x86_64/libaliuhook.so new file mode 100644 index 0000000..c1fa2d5 Binary files /dev/null and b/app/src/main/assets/aliuhook/x86_64/libaliuhook.so differ diff --git a/app/src/main/assets/aliuhook/x86_64/libc++_shared.so b/app/src/main/assets/aliuhook/x86_64/libc++_shared.so new file mode 100644 index 0000000..0ca6a48 Binary files /dev/null and b/app/src/main/assets/aliuhook/x86_64/libc++_shared.so differ diff --git a/app/src/main/assets/aliuhook/x86_64/liblsplant.so b/app/src/main/assets/aliuhook/x86_64/liblsplant.so new file mode 100644 index 0000000..43fe031 Binary files /dev/null and b/app/src/main/assets/aliuhook/x86_64/liblsplant.so differ diff --git a/app/src/main/assets/pine/LICENSE b/app/src/main/assets/pine/LICENSE deleted file mode 100644 index 4780a49..0000000 --- a/app/src/main/assets/pine/LICENSE +++ /dev/null @@ -1,46 +0,0 @@ -Copyright (c) canyie - -"Anti 996" License Version 1.0 (Draft) - -Permission is hereby granted to any individual or legal entity -obtaining a copy of this licensed work (including the source code, -documentation and/or related items, hereinafter collectively referred -to as the "licensed work"), free of charge, to deal with the licensed -work for any purpose, including without limitation, the rights to use, -reproduce, modify, prepare derivative works of, distribute, publish -and sublicense the licensed work, subject to the following conditions: - -1. The individual or the legal entity must conspicuously display, -without modification, this License and the notice on each redistributed -or derivative copy of the Licensed Work. - -2. The individual or the legal entity must strictly comply with all -applicable laws, regulations, rules and standards of the jurisdiction -relating to labor and employment where the individual is physically -located or where the individual was born or naturalized; or where the -legal entity is registered or is operating (whichever is stricter). In -case that the jurisdiction has no such laws, regulations, rules and -standards or its laws, regulations, rules and standards are -unenforceable, the individual or the legal entity are required to -comply with Core International Labor Standards. - -3. The individual or the legal entity shall not induce, suggest or force -its employee(s), whether full-time or part-time, or its independent -contractor(s), in any methods, to agree in oral or written form, to -directly or indirectly restrict, weaken or relinquish his or her -rights or remedies under such laws, regulations, rules and standards -relating to labor and employment as mentioned above, no matter whether -such written or oral agreements are enforceable under the laws of the -said jurisdiction, nor shall such individual or the legal entity -limit, in any methods, the rights of its employee(s) or independent -contractor(s) from reporting or complaining to the copyright holder or -relevant authorities monitoring the compliance of the license about -its violation(s) of the said license. - -THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION WITH THE -LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. diff --git a/app/src/main/assets/pine/README.md b/app/src/main/assets/pine/README.md deleted file mode 100644 index 6877295..0000000 --- a/app/src/main/assets/pine/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Pine - -https://github.com/canyie/pine - -classes.dex is pine-core 0.2.5 and pine-xposed 0.0.8 merged - -### Building from source -Use [the script](make_artifacts.sh) or read it and do the steps manually diff --git a/app/src/main/assets/pine/arm64-v8a/libpine.so b/app/src/main/assets/pine/arm64-v8a/libpine.so deleted file mode 100644 index dde49ae..0000000 Binary files a/app/src/main/assets/pine/arm64-v8a/libpine.so and /dev/null differ diff --git a/app/src/main/assets/pine/armeabi-v7a/libpine.so b/app/src/main/assets/pine/armeabi-v7a/libpine.so deleted file mode 100644 index 664e367..0000000 Binary files a/app/src/main/assets/pine/armeabi-v7a/libpine.so and /dev/null differ diff --git a/app/src/main/assets/pine/classes.dex b/app/src/main/assets/pine/classes.dex deleted file mode 100644 index 7ac364f..0000000 Binary files a/app/src/main/assets/pine/classes.dex and /dev/null differ diff --git a/app/src/main/assets/pine/make_artifacts.sh b/app/src/main/assets/pine/make_artifacts.sh deleted file mode 100644 index 0576a71..0000000 --- a/app/src/main/assets/pine/make_artifacts.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -# Simple script to compile all the required files for pine -# - Prompts you for Aliucord & pine dir -# - Compiles pine core and xposed -# - Merges core and xposed classes into one jar -# - Compiles the jar to DEX bytecode via d8 -# - Copies classes.jar to Aliucord/.assets -# - Copies libpine.so builds and the compiled classes.dex to the Aliucord/installer/.../assets - -set -e - -RED="\033[0;31m" -YELLOW="\033[0;33m" -RESET="\033[0m" - -# Usage: message... -die() { - printf "$RED%s$RESET\n" "$*" - exit 1 -} >&2 - -# Usage: message... -log() { - echo - printf "$YELLOW%s$RESET" "$*" - echo - sleep .3 -} - -# Usage: OutVariableName FolderName expectedChildren... -prompt_folder() { - varname="$1" - shift - log "Please specify the $1 directory. You may use a relative path or even . " - printf "> " - read -r response - case "$response" in - ~*) response="$HOME/$(printf "%s" "$response" | cut -c 2-)" ;; - esac - dir="$(realpath "$response")" - shift - for file in "$@"; do - [ -e "$dir/$file" ] || die "$dir/$file doesn't exist. Are you sure you specified the correct directory?" - done - eval "$varname=$dir" -} - -ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}" -[ -d "$ANDROID_HOME" ] || die "Android SDK not found. Please set ANDROID_HOME and try again." -BUILD_TOOLS="$(find "$ANDROID_HOME/build-tools" -maxdepth 1 | sort | tail -n 1)" -[ -x "$BUILD_TOOLS/d8" ] || die "Couldn't find your buildtools. Make sure ANDROID_HOME is correct" - -for dep in zip unzip; do - command -v "$dep" >/dev/null || die "$dep not found. Please install it then try again" -done - -prompt_folder PINE Pine core xposed gradlew -echo -prompt_folder ALIUCORD Aliucord installer .assets - -( - -cd "$PINE" -chmod +x gradlew - -log "Assembling Pine Core" -./gradlew core:assemble -log "Assembling Pine Xposed" -./gradlew xposed:assemble - -CORE="$(mktemp -d)" -XPOSED="$(mktemp -d)" -CLASSES="$(mktemp -d)" - -log "Extracting Pine Core & Xposed builds" -unzip core/build/outputs/aar/core-release.aar -d "$CORE" -unzip xposed/build/outputs/aar/xposed-release.aar -d "$XPOSED" - -log "Merging Pine Core & Xposed classes" -cd "$CLASSES" -unzip "$CORE/classes.jar" -unzip "$XPOSED/classes.jar" -zip -r classes.jar -- * - -log "Compiling to DEX bytecode" -"$BUILD_TOOLS/d8" classes.jar - -log "Copying files to Aliucord assets dir" -PINE_ASSETS="$ALIUCORD/installer/android/app/src/main/assets/pine" -cp classes.dex "$PINE_ASSETS" -cp classes.jar "$ALIUCORD/.assets/pine.jar" -for dir in "$CORE/jni/"*; do - outdir="$PINE_ASSETS/$(basename "$dir")" - mkdir -p "$outdir" - cp "$dir/libpine.so" "$outdir" -done - -log "Done! Successfully built and copied all pine artifacts to the installer assets." - -) diff --git a/app/src/main/kotlin/com/aliucord/manager/ui/screens/InstallScreen.kt b/app/src/main/kotlin/com/aliucord/manager/ui/screens/InstallScreen.kt index 45b4ae2..1005ec2 100644 --- a/app/src/main/kotlin/com/aliucord/manager/ui/screens/InstallScreen.kt +++ b/app/src/main/kotlin/com/aliucord/manager/ui/screens/InstallScreen.kt @@ -91,8 +91,8 @@ fun InstallerScreen(navigator: DestinationsNavigator, apk: File?) { val cacheDir = context.cacheDir.absolutePath if (!patched) (1..3).forEach { i -> - openEntry("classes" + (if (i == 1) "" else i) + ".dex") - extractEntry(cacheDir + "/classes" + (i + 1) + ".dex") + openEntry("classes${if (i == 1) "" else i}.dex") + extractEntry("$cacheDir/classes${i + 1}.dex") closeEntry() } @@ -106,18 +106,21 @@ fun InstallerScreen(navigator: DestinationsNavigator, apk: File?) { val assetManager = context.assets with(Zip(outputApk.absolutePath, 6, 'a')) { - - if (!patched) { - (1..3).forEach { i -> deleteEntry("classes${if (i == 1) "" else i}.dex") } - } else { + if (patched) { deleteEntry("classes.dex") deleteEntry("classes5.dex") deleteEntry("classes6.dex") + } else { + (1..3).forEach { i -> deleteEntry("classes${if (i == 1) "" else i}.dex") } } deleteEntry("AndroidManifest.xml") - deleteEntry("lib/arm64-v8a/libpine.so") - deleteEntry("lib/armeabi-v7a/libpine.so") + + listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64").forEach { arch -> + listOf("/libaliuhook.so", "/liblsplant.so", "/libc++_shared.so").forEach { file -> + deleteEntry("lib/$arch$file") + } + } if (!patched) for (i in 2..4) { val name = "classes$i.dex" @@ -133,10 +136,13 @@ fun InstallerScreen(navigator: DestinationsNavigator, apk: File?) { compressFile(injector.absolutePath) closeEntry() - writeEntry("classes5.dex", assetManager.open("pine/classes.dex")) + writeEntry("classes5.dex", assetManager.open("aliuhook/classes.dex")) - writeEntry("lib/arm64-v8a/libpine.so", assetManager.open("pine/arm64-v8a/libpine.so")) - writeEntry("lib/armeabi-v7a/libpine.so", assetManager.open("pine/armeabi-v7a/libpine.so")) + listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64").forEach { arch -> + listOf("/libaliuhook.so", "/liblsplant.so", "/libc++_shared.so").forEach { file -> + writeEntry("lib/$arch$file", assetManager.open("aliuhook/$arch$file")) + } + } writeEntry("classes6.dex", assetManager.open("kotlin/classes.dex"))