├── app ├── .gitignore ├── src │ └── main │ │ ├── assets │ │ ├── native_init │ │ └── xposed_init │ │ ├── res │ │ ├── values-land │ │ │ └── dimens.xml │ │ ├── values-w1240dp │ │ │ └── dimens.xml │ │ ├── values-w600dp │ │ │ └── dimens.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── arrays.xml │ │ │ ├── themes.xml │ │ │ └── strings.xml │ │ ├── drawable │ │ │ ├── enable.xml │ │ │ ├── disable.xml │ │ │ ├── baseline_check_circle_outline_24.xml │ │ │ ├── settings.xml │ │ │ ├── baseline_block_24.xml │ │ │ ├── weburl.xml │ │ │ ├── dashboard.xml │ │ │ ├── error.xml │ │ │ ├── ic_launcher_foreground.xml │ │ │ └── ic_launcher_background.xml │ │ ├── values-night │ │ │ └── themes.xml │ │ ├── anim │ │ │ ├── slide_in_l.xml │ │ │ ├── slide_in_r.xml │ │ │ ├── slide_out_l.xml │ │ │ └── slide_out_r.xml │ │ ├── mipmap-anydpi │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── menu │ │ │ └── bottom_nav_menu.xml │ │ ├── values-v23 │ │ │ └── themes.xml │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ ├── settings_activity.xml │ │ │ └── fragment_settings_dashboard.xml │ │ └── xml │ │ │ └── root_preferences.xml │ │ ├── jniLibs │ │ └── arm64-v8a │ │ │ └── libnarchook.so │ │ ├── java │ │ └── icu │ │ │ └── lama │ │ │ ├── ukbeggar │ │ │ └── hooks │ │ │ │ ├── VersionType.java │ │ │ │ ├── FragmentSettingsOptions.java │ │ │ │ ├── XpConfig.java │ │ │ │ ├── HookUtils.java │ │ │ │ ├── RealMainActivity.java │ │ │ │ ├── FragmentSettingsDashboard.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── XpMain.java │ │ │ └── narchook │ │ │ ├── FakeDeviceID.java │ │ │ ├── NArcHook.java │ │ │ └── CURLHacks.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle.kts ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── deploymentTargetDropDown.xml ├── migrations.xml ├── misc.xml └── gradle.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle.kts ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/src/main/assets/native_init: -------------------------------------------------------------------------------- 1 | libnarchook.so -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | icu.lama.ukbeggar.hooks.XpMain -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /app/src/main/res/values-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 48dp 3 | -------------------------------------------------------------------------------- /app/src/main/res/values-w1240dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 200dp 3 | -------------------------------------------------------------------------------- /app/src/main/res/values-w600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 48dp 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libnarchook.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/jniLibs/arm64-v8a/libnarchook.so -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/VersionType.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | public enum VersionType { 4 | PLAYSTORE, CHINA 5 | } 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/7aGiven/BritishBeggarHooks/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF000000 4 | #FFFFFFFF 5 | #2c2c2c 6 | -------------------------------------------------------------------------------- /.idea/deploymentTargetDropDown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Nov 13 12:02:02 PST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | 16dp 5 | 16dp 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | moe.low.arc 4 | 5 | 6 | 7 | Pattern 8 | Offset 9 | Name 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/enable.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/narchook/FakeDeviceID.java: -------------------------------------------------------------------------------- 1 | package icu.lama.narchook; 2 | 3 | public class FakeDeviceID { 4 | public static native void prepareRandom(int seed); 5 | public static native String randomDeviceID(); 6 | public static native void setFakeDeviceID(String newDeviceID); 7 | public static native void toggleFeature(boolean status); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/disable.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_l.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_r.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_l.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_r.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/narchook/NArcHook.java: -------------------------------------------------------------------------------- 1 | package icu.lama.narchook; 2 | 3 | public class NArcHook { 4 | public static int NARCHOOK_API_VERSION = 9; 5 | 6 | public static native void toggleFeature(int feature, boolean status); 7 | public static native int getVersion(); 8 | public static native void end(); 9 | 10 | public static void init() { 11 | System.loadLibrary("narchook"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_check_circle_outline_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/settings.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_block_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/FragmentSettingsOptions.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | 6 | import androidx.preference.PreferenceFragmentCompat; 7 | 8 | public class FragmentSettingsOptions extends PreferenceFragmentCompat { 9 | 10 | @Override 11 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { 12 | this.getPreferenceManager().setSharedPreferencesMode(Context.MODE_WORLD_READABLE); 13 | setPreferencesFromResource(R.xml.root_preferences, rootKey); 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BritishBeggarHooks 2 | 3 | A LSPosed module for hooking a game owned by a british beggar. 4 | 5 | **This project is still WIP!** 6 | 7 | **No prebuilts will available!** 8 | 9 | ## How to use 10 | 11 | 1. Submit to confine. 12 | 2. Writ your acknowledgement to the heart. 13 | 3. The door shall be open only if you make it. 14 | 15 | ## Features 16 | 17 | - [x] Bypass SSLPinning 18 | + [x] Native layer 19 | + [x] Java layer 20 | - [ ] Custom API URL 21 | + [x] Native layer 22 | + [ ] Java layer 23 | - [ ] Fake device ID 24 | + [x] Native layer 25 | + [ ] Java layer 26 | - [ ] Auto check update 27 | - [ ] Version check 28 | + [x] Native layer 29 | + [ ] Java layer 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/weburl.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dashboard.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/main/res/drawable/error.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/XpConfig.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | 4 | import de.robv.android.xposed.XSharedPreferences; 5 | 6 | public class XpConfig { 7 | private static XSharedPreferences conf = new XSharedPreferences("icu.lama.ukbeggar.hooks", "config"); 8 | 9 | static String getCustomAPIV2Address() { 10 | if (conf.hasFileChanged()) { 11 | conf.reload(); 12 | } 13 | 14 | return conf.getString("hookApiV2", ""); 15 | } 16 | 17 | static void setCustomAPIV2Address(String url) { 18 | // set preference 19 | conf.edit().putString("hookApiV2", url).apply(); 20 | } 21 | 22 | static boolean shouldHookAPIV2() { 23 | if (conf.hasFileChanged()) { 24 | conf.reload(); 25 | } 26 | 27 | return conf.getString("hookApiV2", "").isEmpty(); 28 | } 29 | 30 | static boolean shouldHookSSL() { 31 | if (conf.hasFileChanged()) { 32 | conf.reload(); 33 | } 34 | 35 | return conf.getBoolean("mainSwitch", false); 36 | } 37 | 38 | static void setHookSSL(boolean hook) { 39 | conf.edit().putBoolean("mainSwitch", hook).apply(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Enables namespacing of each library's R class so that its R class includes only the 19 | # resources declared in the library itself and none from the library's dependencies, 20 | # thereby reducing the size of the R class for that library 21 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BritishBeggarHooks 3 | Settings 4 | 5 | RealMainActivity 6 | 7 | \nWrit your acknowledgement to the heart.\n\nSubmit to confine.\n\nThe door shall be open. 8 | 9 | Target Information 10 | Target Version 11 | Capability 12 | 13 | Generic Hooking Enabled 14 | Full Support 15 | No Support 16 | 17 | 18 | Loading… 19 | Loading… 20 | 21 | %s %s 22 | China 23 | Playstore 24 | SettingsActivity 25 | 26 | Dashboard 27 | Settings 28 | LSPosed Not Found 29 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/narchook/CURLHacks.java: -------------------------------------------------------------------------------- 1 | package icu.lama.narchook; 2 | 3 | public class CURLHacks { 4 | /** 5 | * Set to null to disable custom API-Legacy overriding. 6 | * If Legacy API is not been set and API-V2 set, all requests to API-Legacy will redirect to API-V2. 7 | * 8 | * @param url New API hostname 9 | */ 10 | public static native void setCustomAPI(String url); 11 | 12 | /** 13 | * Set to null to disable custom API-V2 overriding. 14 | * @param url New API hostname 15 | */ 16 | public static native void setCustomAPIV2(String url); 17 | public static native void toggleDisableSSLPinning(boolean status); 18 | 19 | /** 20 | * Ignore a specific curl option. 21 | * @param curlopt The curl option to ignore. 22 | */ 23 | public static native void addDenyList(int curlopt); 24 | 25 | /** 26 | * Remove a specific curl option from the ignore list. 27 | * @param curlopt The curl option to remove. 28 | */ 29 | public static native void removeDenyList(int curlopt); 30 | 31 | /** 32 | * Dump the client certificate. 33 | * Please run at least once the game and have at least once network request to dump the certificate. 34 | * @param path The output location. 35 | */ 36 | public static native void dumpCert(String path); 37 | public static native void toggleFeature(boolean status); 38 | } 39 | -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | } 4 | 5 | android { 6 | namespace = "icu.lama.ukbeggar.hooks" 7 | compileSdk = 33 8 | 9 | defaultConfig { 10 | applicationId = "icu.lama.ukbeggar.hooks" 11 | minSdk = 23 12 | versionCode = 1 13 | versionName = "1.0" 14 | 15 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | 18 | buildTypes { 19 | release { 20 | isMinifyEnabled = false 21 | proguardFiles( 22 | getDefaultProguardFile("proguard-android-optimize.txt"), 23 | "proguard-rules.pro" 24 | ) 25 | } 26 | } 27 | compileOptions { 28 | sourceCompatibility = JavaVersion.VERSION_1_8 29 | targetCompatibility = JavaVersion.VERSION_1_8 30 | } 31 | buildFeatures { 32 | viewBinding = true 33 | } 34 | ndkVersion = "26.1.10909125" 35 | dependenciesInfo { 36 | includeInApk = false 37 | includeInBundle = false 38 | } 39 | buildToolsVersion = "34.0.0" 40 | } 41 | 42 | dependencies { 43 | 44 | implementation("androidx.appcompat:appcompat:1.6.1") 45 | implementation("com.google.android.material:material:1.8.0") 46 | implementation("androidx.constraintlayout:constraintlayout:2.1.4") 47 | implementation("androidx.navigation:navigation-fragment:2.5.3") 48 | implementation("androidx.navigation:navigation-ui:2.5.3") 49 | implementation("androidx.preference:preference:1.2.0") 50 | 51 | compileOnly("de.robv.android.xposed:api:82") 52 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 15 | 16 | 19 | 22 | 25 | 28 | 29 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/settings_activity.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 17 | 18 | 29 | 30 | 42 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/HookUtils.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | import de.robv.android.xposed.XC_MethodHook; 4 | import de.robv.android.xposed.XposedHelpers; 5 | 6 | public class HookUtils { 7 | private static ClassLoader loader; 8 | 9 | interface CallbackOnEnter { 10 | void onEnter(XC_MethodHook.MethodHookParam param, Object... args) throws Throwable; 11 | } 12 | 13 | interface CallbackOnLeave { 14 | void onLeave(XC_MethodHook.MethodHookParam param, Object... args) throws Throwable; 15 | } 16 | 17 | public static void setup(ClassLoader cl) { 18 | loader = cl; 19 | } 20 | 21 | public static void onEnter(String target, CallbackOnEnter callback, Object... argsType) { 22 | String[] split = target.split("#"); 23 | String pkg = split[0]; 24 | String member = split[1]; 25 | 26 | Object[] args = new Object[argsType.length + 1]; 27 | Object hook = new XC_MethodHook() { 28 | @Override 29 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable { 30 | System.arraycopy(param.args, 0, args, 0, argsType.length); 31 | args[argsType.length] = param; 32 | callback.onEnter(param, args); 33 | } 34 | }; 35 | 36 | XposedHelpers.findAndHookMethod(pkg, loader, member, vargs(argsType, hook)); 37 | } 38 | 39 | public static void onLeave(String target, CallbackOnLeave callback, Object... argsType) { 40 | String[] split = target.split("#"); 41 | String pkg = split[0]; 42 | String member = split[1]; 43 | 44 | Object[] args = new Object[argsType.length + 1]; 45 | Object hook = new XC_MethodHook() { 46 | @Override 47 | protected void afterHookedMethod(MethodHookParam param) throws Throwable { 48 | System.arraycopy(param.args, 0, args, 0, argsType.length); 49 | args[argsType.length] = param; 50 | callback.onLeave(param, args); 51 | } 52 | }; 53 | 54 | XposedHelpers.findAndHookMethod(pkg, loader, member, vargs(argsType, hook)); 55 | } 56 | 57 | private static T[] vargs(T[] args, T... appending) { 58 | Object[] result = new Object[args.length + appending.length]; 59 | 60 | System.arraycopy(args, 0, result, 0, args.length); 61 | System.arraycopy(appending, 0, result, args.length, appending.length); 62 | 63 | return (T[]) result; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/RealMainActivity.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | import android.os.Bundle; 4 | 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import androidx.appcompat.widget.Toolbar; 7 | import androidx.fragment.app.Fragment; 8 | import androidx.fragment.app.FragmentContainerView; 9 | import androidx.fragment.app.FragmentTransaction; 10 | 11 | import com.google.android.material.bottomnavigation.BottomNavigationView; 12 | 13 | import icu.lama.narchook.NArcHook; 14 | 15 | public class RealMainActivity extends AppCompatActivity { 16 | public static String arcVersion = "Error"; 17 | public static VersionType versionType; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | 23 | if (!MainActivity.iWillObeyTheRules()) { 24 | this.finish(); 25 | } 26 | 27 | NArcHook.init(); 28 | setContentView(R.layout.settings_activity); 29 | 30 | final Toolbar appbar = this.findViewById(R.id.appbar); 31 | appbar.setTitle(R.string.app_name); 32 | 33 | 34 | this.findViewById(R.id.ui_nav_settings).setOnClickListener(v -> { 35 | final Fragment currentFrag = ((FragmentContainerView) findViewById(R.id.fragment_settings_view)).getFragment(); 36 | if (currentFrag instanceof FragmentSettingsOptions) return; 37 | 38 | getSupportFragmentManager().beginTransaction() 39 | .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) 40 | .setCustomAnimations(R.anim.slide_in_r, R.anim.slide_out_r) 41 | .replace(R.id.fragment_settings_view, new FragmentSettingsOptions()) 42 | .commit(); 43 | 44 | final BottomNavigationView navbar = this.findViewById(R.id.nav_view); 45 | navbar.setSelectedItemId(R.id.ui_nav_settings); 46 | }); 47 | 48 | this.findViewById(R.id.ui_nav_dashboard).setOnClickListener(v -> { 49 | final Fragment currentFrag = ((FragmentContainerView) findViewById(R.id.fragment_settings_view)).getFragment(); 50 | if (currentFrag instanceof FragmentSettingsDashboard) return; 51 | 52 | getSupportFragmentManager().beginTransaction() 53 | .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) 54 | .setCustomAnimations(R.anim.slide_in_l, R.anim.slide_out_l) 55 | .replace(R.id.fragment_settings_view, new FragmentSettingsDashboard()) 56 | .commit(); 57 | 58 | final BottomNavigationView navbar = this.findViewById(R.id.nav_view); 59 | navbar.setSelectedItemId(R.id.ui_nav_dashboard); 60 | }); 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /app/src/main/res/xml/root_preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | 53 | 54 | 59 | 60 | 61 | 67 | 68 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/FragmentSettingsDashboard.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.content.pm.PackageInfo; 6 | import android.content.pm.PackageManager; 7 | import android.os.Bundle; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.annotation.Nullable; 11 | import androidx.fragment.app.Fragment; 12 | 13 | import android.view.LayoutInflater; 14 | import android.view.View; 15 | import android.view.ViewGroup; 16 | import android.widget.TextView; 17 | 18 | import com.google.android.material.floatingactionbutton.FloatingActionButton; 19 | 20 | public class FragmentSettingsDashboard extends Fragment { 21 | 22 | @Override 23 | public void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | } 26 | 27 | @Override 28 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 29 | Bundle savedInstanceState) { 30 | return inflater.inflate(R.layout.fragment_settings_dashboard, container, false); 31 | } 32 | 33 | @Override 34 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 35 | final SharedPreferences prefs = getActivity().getSharedPreferences("icu.lama.ukbeggar.hooks_preferences", Context.MODE_PRIVATE); 36 | try { 37 | PackageInfo verInfo = getActivity().getPackageManager().getPackageInfo("moe.low.arc", 0); 38 | 39 | RealMainActivity.versionType = verInfo.versionName.contains("c") ? VersionType.CHINA : VersionType.PLAYSTORE; 40 | RealMainActivity.arcVersion = verInfo.versionName.replace("c", ""); 41 | } catch (PackageManager.NameNotFoundException e) { 42 | 43 | final TextView failed = getView().findViewById(R.id.versionFailed); 44 | failed.setVisibility(View.VISIBLE); 45 | } 46 | 47 | final TextView loading = getView().findViewById(R.id.loadingVersion); 48 | loading.setVisibility(View.INVISIBLE); 49 | 50 | final TextView failed; 51 | if (lsposedExists()) { 52 | failed = getView().findViewById(R.id.versionOK); 53 | failed.setText(R.string.generic_hooking_enabled); 54 | } else { 55 | failed = getView().findViewById(R.id.versionFailed); 56 | failed.setText(R.string.no_lsp_found); 57 | } 58 | 59 | failed.setVisibility(View.VISIBLE); 60 | 61 | final TextView versionDisplay = getView().findViewById(R.id.versionStringDisplay); 62 | versionDisplay.setText(getString(R.string.arc_read_version, 63 | RealMainActivity.arcVersion, 64 | (RealMainActivity.versionType == VersionType.CHINA ? 65 | getString(R.string.arc_version_china) : 66 | getString(R.string.arc_version_playstore)) 67 | )); 68 | 69 | final FloatingActionButton btnToggle = getView().findViewById(R.id.enableButton); 70 | 71 | btnToggle.setOnClickListener(it -> { 72 | boolean newState = !prefs.getBoolean("mainSwitch", false); 73 | prefs.edit().putBoolean("mainSwitch", newState).apply(); 74 | 75 | if (newState) { 76 | btnToggle.setImageResource(R.drawable.disable); 77 | } else { 78 | btnToggle.setImageResource(R.drawable.enable); 79 | } 80 | }); 81 | } 82 | 83 | public static boolean lsposedExists() { 84 | return false; 85 | } 86 | } -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/MainActivity.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | 7 | import com.google.android.material.snackbar.Snackbar; 8 | 9 | import androidx.appcompat.app.AppCompatActivity; 10 | 11 | import android.view.View; 12 | 13 | import androidx.core.view.WindowCompat; 14 | import androidx.navigation.NavController; 15 | import androidx.navigation.Navigation; 16 | import androidx.navigation.ui.AppBarConfiguration; 17 | import androidx.navigation.ui.NavigationUI; 18 | 19 | import icu.lama.ukbeggar.hooks.databinding.ActivityMainBinding; 20 | 21 | import android.view.Menu; 22 | import android.view.MenuItem; 23 | 24 | public class MainActivity extends AppCompatActivity { 25 | 26 | private AppBarConfiguration appBarConfiguration; 27 | private ActivityMainBinding binding; 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | 33 | binding = ActivityMainBinding.inflate(getLayoutInflater()); 34 | setContentView(binding.getRoot()); 35 | 36 | if (iWillObeyTheRules()) { // Please read the rules before using this software. 37 | Intent myIntent = new Intent(MainActivity.this, RealMainActivity.class); 38 | this.finish(); 39 | MainActivity.this.startActivity(myIntent); 40 | 41 | return; 42 | } 43 | 44 | new AlertDialog.Builder(MainActivity.this) 45 | .setTitle("The gate shall not be opened.") 46 | .setMessage(R.string.door_open_hint) 47 | .setPositiveButton("ACK", (di, id) -> { }).show(); 48 | } 49 | public static boolean iWillObeyTheRules() { 50 | final String[] RULES = new String[] { 51 | "You MUST obey the following rules to use this software:", 52 | "", 53 | "1. You are NOT allowed to make any profit with this software.", 54 | "2. You acknowledge that this software has no relations to Lowiro. Any keyword related to Lowiro is a coincident.", 55 | "3. You acknowledge that this software has no relations to Arcaea. Any keyword related to Arcaea is a coincident.", 56 | "4. You are not allowed to spread a modified version of this software if the following conditions are matched: ", 57 | " a) Your modification is related to MainActivity.", 58 | " b) You are publishing anything else than the source code.", 59 | " c) The only exception is the original author of this project, lamadaemon, grants you the permission to do so.", 60 | "5. You are NOT allowed to publish any tutorials if the following conditions are matched: ", 61 | " a) Your tutorial is guiding the reader/viewer to modify the source code.", 62 | " b) Your tutorial is guiding the reader/viewer to reverse engineering this application", 63 | " c) Your tutorial is guiding the reader/viewer to violate the rules", 64 | " d) The only exception is the original author of this project, lamadaemon, grants you the permission to do so.", 65 | "6. You acknowledge the library 'libnarchook.so' is closed source, and you are not allowed to reverse engineering.", 66 | " Specifically but not limited to these following actions are prohibited:", 67 | " a) Decompile", 68 | " b) Modify", 69 | " c) Republish modified version nor the original version", 70 | "7. THE CONSEQUENCES CAUSED BY THE USE OF THIS SOFTWARE SHALL BE BORNE BY THE USER.", 71 | " a) THE CONSEQUENCES may include but not limited to:", 72 | " i) Your game account get banned.", 73 | " ii) Your house get burned.", 74 | " iii) The third world war.", 75 | " iv) The god decided to punish people and you are the first one.", 76 | "", 77 | "", 78 | "Any violation of the rules will cause the author of this project to suspend updates." 79 | }; 80 | 81 | final String HINT_A = "Make this function return true to represent that you have read the rules and will obey them."; 82 | final String HINT_B = "If you are using smali editor, make this function return 1 (1 means true)"; 83 | return true; 84 | } 85 | } -------------------------------------------------------------------------------- /app/src/main/java/icu/lama/ukbeggar/hooks/XpMain.java: -------------------------------------------------------------------------------- 1 | package icu.lama.ukbeggar.hooks; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.pm.PackageInfo; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | 9 | import de.robv.android.xposed.IXposedHookLoadPackage; 10 | import de.robv.android.xposed.XSharedPreferences; 11 | import de.robv.android.xposed.callbacks.XC_LoadPackage; 12 | import icu.lama.narchook.CURLHacks; 13 | import icu.lama.narchook.FakeDeviceID; 14 | import icu.lama.narchook.NArcHook; 15 | 16 | public class XpMain implements IXposedHookLoadPackage { 17 | private static final String TARGET_PACKAGE = "moe.low.arc"; 18 | private static final String SELF_PACKAGE = "icu.lama.ukbeggar.hooks"; 19 | 20 | @Override 21 | public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable { 22 | if (TARGET_PACKAGE.equals(loadPackageParam.packageName)) { 23 | XSharedPreferences prefs = new XSharedPreferences("icu.lama.ukbeggar.hooks", "preferences"); 24 | if (!prefs.getBoolean("master_sw", true)) { 25 | Log.i("XpMain", "Master switch is off. Abort!"); 26 | return; 27 | } 28 | 29 | try { 30 | HookUtils.setup(loadPackageParam.classLoader); 31 | NArcHook.init(); 32 | 33 | if (prefs.getBoolean("disable_ssl_pinning", false)) { 34 | Log.i("XpMain", "Disabling SSL pinning"); 35 | CURLHacks.toggleFeature(true); 36 | } 37 | 38 | if (prefs.getBoolean("enable_fake_device_id", false)) { 39 | Log.i("XpMain", "Enabling fake device id"); 40 | 41 | String fakeDeviceIDValue = prefs.getString("fake_device_id", ""); 42 | if (fakeDeviceIDValue.isEmpty()) { 43 | Log.e("XpMain", "Fake device id is empty! Generating a random one."); 44 | 45 | FakeDeviceID.prepareRandom((int) (((int) (System.currentTimeMillis() ^ 0xCA0ADA) * (Math.round(Math.random() * 100))) >> 14)); 46 | fakeDeviceIDValue = FakeDeviceID.randomDeviceID(); 47 | prefs.edit().putString("fake_device_id", fakeDeviceIDValue).apply(); 48 | 49 | Log.i("XpMain", "Generated fake device id: " + fakeDeviceIDValue); 50 | } 51 | 52 | FakeDeviceID.setFakeDeviceID(fakeDeviceIDValue); 53 | FakeDeviceID.toggleFeature(true); 54 | } 55 | 56 | if (NArcHook.getVersion() != NArcHook.NARCHOOK_API_VERSION) { 57 | Log.e("XpMain", "API version mismatch! Expected: " + NArcHook.NARCHOOK_API_VERSION + " Got: " + NArcHook.getVersion() + ". Abort!"); 58 | return; 59 | } 60 | 61 | Log.i("XpMain", "Library loaded successfully."); 62 | } catch (Throwable e) { 63 | Log.e("XpMain", "Failed to load native hook library", e); 64 | } 65 | 66 | Log.i("XpMain", "Waiting for target to load to get version string"); 67 | 68 | try { 69 | HookUtils.onEnter("low.moe.AppActivity#onCreate", (param, args) -> { 70 | Activity target = (Activity) param.thisObject; 71 | PackageInfo info = target.getApplicationContext().getPackageManager().getPackageInfo("moe.low.arc", 0); 72 | 73 | CURLHacks.toggleFeature(true); 74 | FakeDeviceID.toggleFeature(true); 75 | 76 | Log.i("XpMain", "Hook enabled! Target version is: " + info.versionName); 77 | }, Bundle.class); 78 | 79 | HookUtils.onEnter("low.moe.AppActivity#logCrashlytics", (param, args) -> { 80 | Log.i("XpMain", "Crashlytics report rejected: " + args[0]); 81 | 82 | param.setResult(null); 83 | }, String.class); 84 | 85 | HookUtils.onEnter("com.google.firebase.FirebaseApp#initializeApp", (param, args) -> { 86 | Log.i("XpMain", "Rejected firebase initialization"); 87 | 88 | param.setResult(null); 89 | }, Context.class); 90 | 91 | 92 | } catch (Throwable t) { 93 | Log.e("XpMain", "Failed to hook AppActivity", t); 94 | } 95 | } 96 | 97 | if (SELF_PACKAGE.equals(loadPackageParam.packageName)) { 98 | HookUtils.setup(loadPackageParam.classLoader); 99 | 100 | HookUtils.onEnter("icu.lama.ukbeggar.hooks.FragmentSettingsDashboard#lsposedExists", (param, args) -> { 101 | param.setResult(true); 102 | }); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_settings_dashboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 26 | 27 | 34 | 35 | 38 | 39 | 40 | 54 | 55 | 56 | 69 | 70 | 71 | 85 | 86 | 99 | 100 | 101 | 117 | 118 | 135 | 136 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | --------------------------------------------------------------------------------