├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── libs
│ └── XposedBridgeApi-54.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── fx
│ │ └── totoro
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── xposed_init
│ ├── java
│ │ └── com
│ │ │ └── fx
│ │ │ └── totoro
│ │ │ ├── MainActivity.java
│ │ │ ├── MainHook.java
│ │ │ ├── hook
│ │ │ ├── BuildHook.java
│ │ │ ├── DisplayHook.java
│ │ │ ├── HookBase.java
│ │ │ ├── LocationHook.java
│ │ │ ├── NetworkHook.java
│ │ │ ├── TelephonyHook.java
│ │ │ └── WifiHook.java
│ │ │ └── utils
│ │ │ ├── Common.java
│ │ │ └── Constant.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── fx
│ └── totoro
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 | *.apk
11 | *.json
12 | *.txt
13 | *.class
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # totoro
2 |
3 | ## 简介
4 |
5 | 基于xposed修改手机信息,修改的内容包括:
6 | * 1、系统和硬件信息
7 | * 2、屏幕分辨率
8 | * 3、基站和GPS定位信息
9 | * 4、网络信息
10 | * 5、wifi信息
11 | * 6、Telephony信息
12 |
13 | ## 依赖环境
14 |
15 | * JDK1.6+
16 | * Android SDK r22+
17 | * Android Studio
18 |
19 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.fx.totoro"
7 | minSdkVersion 22
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | provided fileTree(include: ['*.jar'], dir: 'libs')
23 | implementation 'com.android.support:appcompat-v7:26.1.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.0'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | provided files('libs/XposedBridgeApi-54.jar')
29 | }
30 |
--------------------------------------------------------------------------------
/app/libs/XposedBridgeApi-54.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/libs/XposedBridgeApi-54.jar
--------------------------------------------------------------------------------
/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
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/fx/totoro/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.fx.totoro", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/assets/xposed_init:
--------------------------------------------------------------------------------
1 | com.fx.totoro.MainHook
2 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro;
2 |
3 | import android.os.Bundle;
4 | import android.content.SharedPreferences.Editor;
5 | import android.util.Log;
6 | import android.content.SharedPreferences;
7 | import android.app.Activity;
8 | import android.content.Context;
9 | import com.fx.totoro.utils.Constant;
10 | import com.fx.totoro.utils.Common;
11 |
12 | public class MainActivity extends Activity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 | Log.i("page:", "start");
19 |
20 | /*执行命令获取root权限*/
21 | Common.execRootCmdSilent("ls");
22 |
23 | SharedPreferences xsp = getSharedPreferences(Constant.XSP_FILE, Context.MODE_WORLD_READABLE);
24 | Editor xspEdit = xsp.edit();
25 | xspEdit.clear();
26 | xspEdit.commit();
27 |
28 | for(String b: Constant.BUILD_ARR) {
29 | xspEdit.putString(b, "111");
30 | }
31 |
32 | for(String b: Constant.BUILD_METHOD) {
33 | xspEdit.putString(b, "44444");
34 | }
35 |
36 | for(String v: Constant.VERSION_ARR) {
37 | xspEdit.putString(v,"34");
38 | }
39 |
40 | for(String t: Constant.TEL_ARR) {
41 | xspEdit.putString(t,"3");
42 | }
43 |
44 | for(String t: Constant.NETWORK_ARR) {
45 | xspEdit.putString(t,"4");
46 | }
47 |
48 | for(String t: Constant.INET_ARR) {
49 | xspEdit.putString(t,"127.0.0.1");
50 | }
51 |
52 | for(String t: Constant.WIFI_ARR) {
53 | xspEdit.putString(t,"5");
54 | }
55 |
56 | for(String t: Constant.WIFI_SCAN) {
57 | xspEdit.putString(t,"6");
58 | }
59 |
60 | for(String t: Constant.DISPLAY_ARR) {
61 | xspEdit.putString(t,"500");
62 | }
63 |
64 | String[] DISPLAY_METRICS = {"widthPixels", "heightPixels", "density", "densityDpi", "scaledDensity"};
65 | xspEdit.putString("widthPixels", "540");
66 | xspEdit.putString("heightPixels", "960");
67 | xspEdit.putString("density", "1.5");
68 | xspEdit.putString("densityDpi", "240");
69 | xspEdit.putString("scaledDensity", "1.5");
70 |
71 | for(String t: Constant.LOCATION) {
72 | xspEdit.putString(t,"12009");
73 | }
74 | xspEdit.putString("androidId", "2323bn");
75 | xspEdit.commit();
76 | Log.i("page:", "end");
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/MainHook.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro;
2 |
3 | import de.robv.android.xposed.IXposedHookLoadPackage;
4 | import de.robv.android.xposed.XC_MethodHook;
5 | import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
6 | import de.robv.android.xposed.XC_MethodReplacement;
7 | import de.robv.android.xposed.XSharedPreferences;
8 | import de.robv.android.xposed.XposedBridge;
9 | import de.robv.android.xposed.XposedHelpers;
10 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
11 | import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
12 | import android.util.Log;
13 |
14 | import com.fx.totoro.hook.BuildHook;
15 | import com.fx.totoro.utils.Constant;
16 | import com.fx.totoro.hook.TelephonyHook;
17 | import com.fx.totoro.hook.DisplayHook;
18 | import com.fx.totoro.hook.NetworkHook;
19 | import com.fx.totoro.hook.WifiHook;
20 | import com.fx.totoro.hook.LocationHook;
21 |
22 | public class MainHook implements IXposedHookLoadPackage {
23 |
24 | @Override
25 | public void handleLoadPackage(LoadPackageParam loadPackageParam) throws Throwable {
26 | Log.i("hook:", "start!");
27 | XSharedPreferences xsp = new XSharedPreferences(Constant.PKG_NAME, Constant.XSP_FILE);
28 | new BuildHook(xsp).hook();
29 | new TelephonyHook(xsp).hook();
30 | new DisplayHook(xsp).hook();
31 | new NetworkHook(xsp).hook();
32 | new WifiHook(xsp).hook();
33 | new LocationHook(xsp).hook();
34 | Log.i("hook:", "end!");
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/hook/BuildHook.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.hook;
2 |
3 | import android.content.ContentResolver;
4 | import android.os.Build;
5 | import android.util.Log;
6 | import android.provider.Settings;
7 | import de.robv.android.xposed.XSharedPreferences;
8 | import de.robv.android.xposed.XposedHelpers;
9 | import de.robv.android.xposed.XC_MethodHook;
10 | import com.fx.totoro.utils.Constant;
11 | import android.content.res.Resources;
12 |
13 | /**
14 | * Created by chenshaodong on 2018/6/3.
15 | */
16 |
17 | public class BuildHook extends HookBase {
18 |
19 | public BuildHook(XSharedPreferences xsp) {
20 | super(xsp);
21 | }
22 |
23 | public void hook() {
24 |
25 | try {
26 | /*hook系统以及硬件信息*/
27 | for (String b : Constant.BUILD_ARR) {
28 | if (null == this.xsp.getString(b, null)) {
29 | continue;
30 | }
31 | if ("TIME".equals(b)) {
32 | XposedHelpers.setStaticObjectField(Build.class, b, Long.parseLong(this.xsp.getString(b, "0")));
33 | } else {
34 | XposedHelpers.setStaticObjectField(Build.class, b, this.xsp.getString(b, ""));
35 | }
36 | }
37 |
38 | /*hook版本信息*/
39 | for (String v : Constant.VERSION_ARR) {
40 | if (null == this.xsp.getString(v, null)) {
41 | continue;
42 | }
43 | if ("SDK_INT".equals(v)) {
44 | XposedHelpers.setStaticObjectField(Build.VERSION.class, v, Integer.parseInt(this.xsp.getString(v, "0")));
45 | } else {
46 | XposedHelpers.setStaticObjectField(Build.VERSION.class, v, this.xsp.getString(v, ""));
47 | }
48 | }
49 |
50 | /*hook method*/
51 | for (String m : Constant.BUILD_METHOD) {
52 | if (null == this.xsp.getString(m, null)) {
53 | continue;
54 | }
55 | this.hookMethod(Build.class, m, this.xsp.getString(m, ""));
56 | }
57 |
58 | this.hookAndroidId(this.xsp);
59 | } catch(Throwable e) {
60 | Log.e("Build Hook", e.getMessage());
61 | }
62 | }
63 |
64 | public void hookAndroidId(final XSharedPreferences xsp) throws Throwable {
65 | XposedHelpers.findAndHookMethod(Settings.Secure.class, "getString", new Object[] { ContentResolver.class, String.class, new XC_MethodHook() {
66 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
67 | throws Throwable {
68 | if(methodHookParam.args[1] == "android_id"
69 | && xsp.getString("androidId", null) != null) {
70 | methodHookParam.setResult(xsp.getString("androidId", null));
71 | }
72 | }
73 | }});
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/hook/DisplayHook.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.hook;
2 |
3 | import android.content.res.Resources;
4 | import android.util.DisplayMetrics;
5 | import android.view.Display;
6 | import android.util.Log;
7 | import de.robv.android.xposed.XSharedPreferences;
8 | import de.robv.android.xposed.XposedHelpers;
9 | import de.robv.android.xposed.XC_MethodHook;
10 | import com.fx.totoro.utils.Constant;
11 |
12 | /**
13 | * Created by chenshaodong on 2018/6/4.
14 | */
15 |
16 | public class DisplayHook extends HookBase {
17 |
18 | public DisplayHook(XSharedPreferences xsp) {
19 | super(xsp);
20 | }
21 |
22 | public void hook() {
23 | try {
24 | for (String d : Constant.DISPLAY_ARR) {
25 | if (null == this.xsp.getString(d, null)) {
26 | continue;
27 | }
28 | this.hookMethod(Display.class, d, Integer.parseInt(this.xsp.getString(d, "0")));
29 | }
30 |
31 | if (this.xsp.getString("widthPixels", null) != null &&
32 | this.xsp.getString("heightPixels", null) != null) {
33 | this.hookDisplayMetrics(this.xsp);
34 | }
35 | } catch(Throwable e) {
36 | Log.e("Display Hook", e.getMessage());
37 | }
38 | }
39 |
40 | public void hookGetMetrics(final XSharedPreferences xsp) throws Throwable {
41 | XposedHelpers.findAndHookMethod(Display.class, "getMetrics", DisplayMetrics.class, new XC_MethodHook() {
42 |
43 | @Override
44 | protected void afterHookedMethod(MethodHookParam param)
45 | throws Throwable {
46 | // TODO Auto-generated method stub
47 | super.afterHookedMethod(param);
48 | DisplayMetrics metrics = (DisplayMetrics)param.args[0];
49 | metrics.widthPixels = Integer.parseInt(xsp.getString("widthPixels", "0"));
50 | metrics.heightPixels = Integer.parseInt(xsp.getString("heightPixels", "0"));
51 | metrics.density = Float.parseFloat(xsp.getString("density", "1.5"));
52 | metrics.densityDpi = Integer.parseInt(xsp.getString("densityDpi", "240"));
53 | metrics.scaledDensity = Float.parseFloat(xsp.getString("scaledDensity", "1.5"));
54 | param.setResult(metrics);
55 | }
56 |
57 | });
58 | }
59 |
60 | public void hookRealMetrics(final XSharedPreferences xsp) throws Throwable {
61 | XposedHelpers.findAndHookMethod(Display.class, "getRealMetrics", DisplayMetrics.class, new XC_MethodHook() {
62 |
63 | @Override
64 | protected void afterHookedMethod(MethodHookParam param)
65 | throws Throwable {
66 | // TODO Auto-generated method stub
67 | super.afterHookedMethod(param);
68 | DisplayMetrics metrics = (DisplayMetrics)param.args[0];
69 | metrics.widthPixels = Integer.parseInt(xsp.getString("widthPixels", "0"));
70 | metrics.heightPixels = Integer.parseInt(xsp.getString("heightPixels", "0"));
71 | metrics.density = Float.parseFloat(xsp.getString("density", "1.5"));
72 | metrics.densityDpi = Integer.parseInt(xsp.getString("densityDpi", "240"));
73 | metrics.scaledDensity = Float.parseFloat(xsp.getString("scaledDensity", "1.5"));
74 | param.setResult(metrics);
75 | }
76 |
77 | });
78 | }
79 |
80 | public void hookDisplayMetrics(final XSharedPreferences xsp) throws Throwable {
81 | XposedHelpers.findAndHookMethod(Resources.class, "getDisplayMetrics", new XC_MethodHook() {
82 |
83 | @Override
84 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
85 | throws Throwable {
86 | super.afterHookedMethod(methodHookParam);
87 | DisplayMetrics metrics = new DisplayMetrics();
88 | metrics.widthPixels = Integer.parseInt(xsp.getString("widthPixels", "0"));
89 | metrics.heightPixels = Integer.parseInt(xsp.getString("heightPixels", "0"));
90 | metrics.density = Float.parseFloat(xsp.getString("density", "1.5"));
91 | metrics.densityDpi = Integer.parseInt(xsp.getString("densityDpi", "240"));
92 | metrics.scaledDensity = Float.parseFloat(xsp.getString("scaledDensity", "1.5"));
93 | methodHookParam.setResult(metrics);
94 | }
95 | });
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/hook/HookBase.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.hook;
2 |
3 | import android.util.Log;
4 |
5 | import de.robv.android.xposed.XSharedPreferences;
6 | import de.robv.android.xposed.XposedHelpers;
7 | import de.robv.android.xposed.XC_MethodHook;
8 |
9 | /**
10 | * Created by chenshaodong on 2018/6/4.
11 | */
12 |
13 | public class HookBase {
14 |
15 | XSharedPreferences xsp = null;
16 |
17 | public HookBase(XSharedPreferences xsp) {
18 | this.xsp = xsp;
19 | }
20 |
21 | void hookMethod(Class cls, String methodName, final String result) {
22 | try {
23 | XposedHelpers.findAndHookMethod(cls, methodName, new XC_MethodHook() {
24 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
25 | throws Throwable {
26 | methodHookParam.setResult(result);
27 | }
28 | });
29 | } catch (Throwable t) {
30 | Log.e("hook method", t.getMessage());
31 | }
32 | }
33 |
34 | void hookMethod(Class cls, String methodName, final int result) {
35 | try {
36 | XposedHelpers.findAndHookMethod(cls, methodName, new XC_MethodHook() {
37 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
38 | throws Throwable {
39 | methodHookParam.setResult(result);
40 | }
41 | });
42 | } catch (Throwable t) {
43 | Log.e("hook method", t.getMessage());
44 | }
45 | }
46 |
47 | void hookMethod(Class cls, String methodName, final long result) {
48 | try {
49 | XposedHelpers.findAndHookMethod(cls, methodName, new XC_MethodHook() {
50 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
51 | throws Throwable {
52 | methodHookParam.setResult(result);
53 | }
54 | });
55 | } catch (Throwable t) {
56 | Log.e("hook method", t.getMessage());
57 | }
58 | }
59 |
60 | void hookMethod(Class cls, String methodName, final byte[] result) {
61 | try {
62 | XposedHelpers.findAndHookMethod(cls, methodName, new XC_MethodHook() {
63 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
64 | throws Throwable {
65 | methodHookParam.setResult(result);
66 | }
67 | });
68 | } catch (Throwable t) {
69 | Log.e("hook method", t.getMessage());
70 | }
71 | }
72 |
73 | void hookMethod(Class cls, String methodName, final double result) {
74 | try {
75 | XposedHelpers.findAndHookMethod(cls, methodName, new XC_MethodHook() {
76 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
77 | throws Throwable {
78 | methodHookParam.setResult(result);
79 | }
80 | });
81 | } catch (Throwable t) {
82 | Log.e("hook method", t.getMessage());
83 | }
84 | }
85 |
86 | void hookMethod(Class cls, String methodName, final boolean result) {
87 | try {
88 | XposedHelpers.findAndHookMethod(cls, methodName, new XC_MethodHook() {
89 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
90 | throws Throwable {
91 | methodHookParam.setResult(result);
92 | }
93 | });
94 | } catch (Throwable t) {
95 | Log.e("hook method", t.getMessage());
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/hook/LocationHook.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.hook;
2 |
3 | import de.robv.android.xposed.XSharedPreferences;
4 | import de.robv.android.xposed.XC_MethodHook;
5 | import de.robv.android.xposed.XposedHelpers;
6 |
7 | import android.os.Bundle;
8 | import android.telephony.cdma.CdmaCellLocation;
9 | import android.telephony.gsm.GsmCellLocation;
10 | import android.util.Log;
11 | import android.telephony.TelephonyManager;
12 | import android.location.Location;
13 | import com.fx.totoro.utils.Constant;
14 |
15 | /**
16 | * Created by chenshaodong on 2018/6/4.
17 | */
18 |
19 | public class LocationHook extends HookBase {
20 |
21 | public LocationHook(XSharedPreferences xsp) {
22 | super(xsp);
23 | }
24 |
25 | public void hook() {
26 | try {
27 | for(String l: Constant.LOCATION) {
28 | if(this.xsp.getString(l, null) == null) {
29 | continue;
30 | }
31 | this.hookMethod(Location.class, l, Double.parseDouble(this.xsp.getString(l, "-1")));
32 | }
33 | this.hookCellLocation(this.xsp);
34 | } catch(Throwable e) {
35 | Log.e("Location Hook", e.getMessage());
36 | }
37 | }
38 |
39 | public void hookCellLocation(final XSharedPreferences xsp) throws Throwable {
40 | XposedHelpers.findAndHookMethod(TelephonyManager.class, "getCellLocation", new XC_MethodHook() {
41 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
42 | throws Throwable {
43 |
44 | super.afterHookedMethod(methodHookParam);
45 | String cellLocation = xsp.getString("getCellLocation", null);
46 | if(cellLocation == null) {
47 | methodHookParam.setResult(null);
48 | return;
49 | }
50 | String[] clArr = cellLocation.split(",");
51 | if(clArr.length != 5 && clArr.length != 3) {
52 | methodHookParam.setResult(null);
53 | return;
54 | }
55 | int[] intClArr = new int[clArr.length];
56 | for(int i = 0; i < clArr.length; i++) {
57 | try {
58 | intClArr[i] = Integer.parseInt(clArr[i]);
59 | } catch(Throwable e) {
60 | methodHookParam.setResult(null);
61 | return;
62 | }
63 | }
64 | if(intClArr.length == 5) {
65 | CdmaCellLocation cdmb = new CdmaCellLocation();
66 | cdmb.setCellLocationData(intClArr[0], intClArr[1], intClArr[2], intClArr[3], intClArr[4]);
67 | methodHookParam.setResult(cdmb);
68 | } else if(intClArr.length == 3) {
69 | Bundle bundle = new Bundle();
70 | bundle.putInt("lac", intClArr[0]);
71 | bundle.putInt("cid", intClArr[1]);
72 | bundle.putInt("psc", intClArr[2]);
73 | methodHookParam.setResult(new GsmCellLocation(bundle));
74 | }
75 | }
76 | });
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/hook/NetworkHook.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.hook;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.net.NetworkInfo;
5 | import android.util.Log;
6 | import de.robv.android.xposed.XSharedPreferences;
7 | import de.robv.android.xposed.XC_MethodHook;
8 | import de.robv.android.xposed.XposedHelpers;
9 | import com.fx.totoro.utils.Constant;
10 | import com.fx.totoro.utils.Common;
11 | import java.net.InetAddress;
12 |
13 | /**
14 | * Created by chenshaodong on 2018/6/4.
15 | */
16 |
17 | public class NetworkHook extends HookBase {
18 |
19 | public NetworkHook(XSharedPreferences xsp) {
20 | super(xsp);
21 | }
22 |
23 | public void hook() {
24 | try {
25 | for (String n : Constant.NETWORK_ARR) {
26 | if (null == this.xsp.getString(n, null)) {
27 | continue;
28 | }
29 | String intKey[] = {"getSubtype", "getType"};
30 | if (Common.isStrInArray(n, intKey)) {
31 | this.hookMethod(NetworkInfo.class, n, Integer.parseInt(this.xsp.getString(n, "0")));
32 | } else {
33 | this.hookMethod(NetworkInfo.class, n, this.xsp.getString(n, ""));
34 | }
35 | }
36 |
37 | for (String i : Constant.INET_ARR) {
38 | if (null == this.xsp.getString(i, null)) {
39 | continue;
40 | }
41 | if ("getAddress".equals(i)) {
42 | this.hookMethod(InetAddress.class, i, Common.ipToByte(this.xsp.getString(i, null)));
43 | } else {
44 | this.hookMethod(InetAddress.class, i, this.xsp.getString(i, ""));
45 | }
46 | }
47 | // this.hookLocalHost(this.xsp);
48 | } catch(Throwable e) {
49 | Log.e("Network Hook", e.getMessage());
50 | }
51 | }
52 |
53 | public void hookLocalHost(final XSharedPreferences xsp) throws Throwable {
54 | XposedHelpers.findAndHookMethod(InetAddress.class, "getLocalHost", new XC_MethodHook() {
55 | @SuppressLint({"NewApi"})
56 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
57 | throws Throwable {
58 | super.afterHookedMethod(methodHookParam);
59 | if(null != xsp.getString("getHostAddress", null)) {
60 | methodHookParam.setResult(InetAddress.getByName(xsp.getString("getHostAddress", "")));
61 | }
62 | }
63 | });
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/hook/TelephonyHook.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.hook;
2 |
3 | import de.robv.android.xposed.XSharedPreferences;
4 | import android.telephony.TelephonyManager;
5 | import android.util.Log;
6 | import com.fx.totoro.utils.Constant;
7 | import com.fx.totoro.utils.Common;
8 |
9 | /**
10 | * Created by chenshaodong on 2018/6/4.
11 | */
12 |
13 | public class TelephonyHook extends HookBase {
14 |
15 | public TelephonyHook(XSharedPreferences xsp) {
16 | super(xsp);
17 | }
18 |
19 | public void hook() {
20 | try {
21 | /*hook telephone相关信息*/
22 | for (String t : Constant.TEL_ARR) {
23 | if (null == this.xsp.getString(t, null)) {
24 | continue;
25 | }
26 | String intKey[] = {"getNetworkType", "getDataActivity", "getPhoneType", "getSimState"};
27 | if (Common.isStrInArray(t, intKey)) {
28 | this.hookMethod(TelephonyManager.class, t, Integer.parseInt(this.xsp.getString(t, "0")));
29 | } else if("hasIccCard".equals(t)) {
30 | this.hookMethod(TelephonyManager.class, t, Boolean.parseBoolean(this.xsp.getString(t, "true")));
31 | } else {
32 | this.hookMethod(TelephonyManager.class, t, this.xsp.getString(t, ""));
33 | }
34 | }
35 | } catch(Throwable e) {
36 | Log.e("Telephony Hook", e.getMessage());
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/hook/WifiHook.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.hook;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.net.wifi.ScanResult;
5 | import android.net.wifi.WifiInfo;
6 | import android.net.wifi.WifiManager;
7 | import android.util.Log;
8 |
9 | import com.fx.totoro.utils.Constant;
10 | import com.fx.totoro.utils.Common;
11 |
12 | import java.util.ArrayList;
13 |
14 | import de.robv.android.xposed.XC_MethodHook;
15 | import de.robv.android.xposed.XSharedPreferences;
16 | import de.robv.android.xposed.XposedHelpers;
17 |
18 | /**
19 | * Created by chenshaodong on 2018/6/4.
20 | */
21 |
22 | public class WifiHook extends HookBase {
23 |
24 | public WifiHook(XSharedPreferences xsp) {
25 | super(xsp);
26 | }
27 |
28 | public void hook() {
29 | try {
30 | for (String n : Constant.WIFI_ARR) {
31 | if (null == this.xsp.getString(n, null)) {
32 | continue;
33 | }
34 | String intKey[] = {"getIpAddress", "getNetworkId", "getRssi"};
35 | if (Common.isStrInArray(n, intKey)) {
36 | this.hookMethod(WifiInfo.class, n, Integer.parseInt(this.xsp.getString(n, "0")));
37 | } else {
38 | this.hookMethod(WifiInfo.class, n, this.xsp.getString(n, ""));
39 | }
40 | }
41 |
42 | /*hook wifi扫描信息*/
43 | if(xsp.getString("ScanResults.BSSID", null) != null) {
44 | this.hookWifiScanResults(this.xsp);
45 | }
46 | } catch(Throwable e) {
47 | Log.e("Wifi Hook", e.getMessage());
48 | }
49 | }
50 |
51 | /**
52 | *
53 | * hook wifi扫描信息,如果要数据比较真实需要设置多个不同的wifi信息
54 | *
55 | * */
56 | public void hookWifiScanResults(final XSharedPreferences xsp) {
57 | try {
58 | XposedHelpers.findAndHookMethod(WifiManager.class, "getScanResults", new XC_MethodHook() {
59 |
60 | @SuppressLint({"NewApi"})
61 | protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
62 | throws Throwable {
63 | super.afterHookedMethod(methodHookParam);
64 | ArrayList localArrayList = (ArrayList)methodHookParam.getResult();
65 | ((ScanResult)localArrayList.get(0)).BSSID = xsp.getString("ScanResults.BSSID", "");
66 | ((ScanResult)localArrayList.get(0)).capabilities = xsp.getString("ScanResults.capabilities", "");
67 | ((ScanResult)localArrayList.get(0)).frequency = Integer.parseInt(xsp.getString("ScanResults.frequency", "0"));
68 | ((ScanResult)localArrayList.get(0)).level = Integer.parseInt(xsp.getString("ScanResults.level", "0"));
69 | ((ScanResult)localArrayList.get(0)).SSID = xsp.getString("ScanResults.SSID", "");
70 | methodHookParam.setResult(localArrayList);
71 | }
72 | });
73 | } catch (Throwable t) {
74 | Log.e("hookWifiManager", t.getMessage());
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/utils/Common.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.utils;
2 |
3 | import java.io.DataOutputStream;
4 | import java.io.IOException;
5 |
6 | /**
7 | * Created by chenshaodong on 2018/6/4.
8 | */
9 |
10 | public class Common {
11 |
12 | /*执行linux命令获取root权限*/
13 | public static int execRootCmdSilent(String cmd) {
14 | int result = -1;
15 | DataOutputStream dos = null;
16 |
17 | try {
18 | Process p = Runtime.getRuntime().exec("su");
19 | dos = new DataOutputStream(p.getOutputStream());
20 |
21 | dos.writeBytes(cmd + "\n");
22 | dos.flush();
23 | dos.writeBytes("exit\n");
24 | dos.flush();
25 | p.waitFor();
26 | result = p.exitValue();
27 | } catch (Exception e) {
28 | e.printStackTrace();
29 | } finally {
30 | if (dos != null) {
31 | try {
32 | dos.close();
33 | } catch (IOException e) {
34 | e.printStackTrace();
35 | }
36 | }
37 | }
38 | return result;
39 | }
40 |
41 | public static boolean isStrInArray(String str, String arr[]) {
42 | if(str == null) return false;
43 | for(String a: arr) {
44 | if(str.equals(a)) return true;
45 | }
46 | return false;
47 | }
48 |
49 | public static byte[] ipToByte(String ip) {
50 | if(ip == null) return null;
51 | byte[] ipByte = new byte[4];
52 | String[] ipArr = ip.split(".");
53 | if(ipArr.length != 4) {
54 | return null;
55 | }
56 | for(int i = 0; i < ipArr.length; i++) {
57 | try {
58 | byte sub = Byte.parseByte(ipArr[i]);
59 | if(sub <= 0 || sub > 255) {
60 | return null;
61 | }
62 | ipByte[i] = sub;
63 | } catch(Exception e) {
64 | return null;
65 | }
66 | }
67 | return ipByte;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/fx/totoro/utils/Constant.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro.utils;
2 |
3 | /**
4 | * Created by chenshaodong on 2018/6/3.
5 | */
6 |
7 | public class Constant {
8 |
9 | /*文件名*/
10 | public static final String XSP_FILE = "totoro";
11 |
12 | /*包名*/
13 | public static final String PKG_NAME = "com.fx.totoro";
14 |
15 | /*系统硬件静态信息*/
16 | public static final String[] BUILD_ARR = {"TAGS", "HOST", "USER", "TIME", "DISPLAY", "BOOTLOADER", "SERIAL", "BOARD",
17 | "BRAND", "DEVICE", "FINGERPRINT", "HARDWARE", "MANUFACTURER", "TYPE", "MODEL", "PRODUCT", "ID"};
18 |
19 | /*Build类method*/
20 | public static final String[] BUILD_METHOD = {"getRadioVersion", "getSerial"};
21 |
22 | /*版本相关信息*/
23 | public static final String[] VERSION_ARR = {"RELEASE", "INCREMENTAL", "CODENAME", "SDK_INT", "SDK"};
24 |
25 | /*电话相关信息*/
26 | public static final String[] TEL_ARR = {"getDeviceId", "getNetworkOperator", "getNetworkOperatorName", "getNetworkType", "getSimOperator", "getSimSerialNumber",
27 | "getSimOperatorName", "getSubscriberId", "getDataActivity", "getDeviceSoftwareVersion", "getLine1Number", "getSimState", "getPhoneType", "hasIccCard"};
28 |
29 | /*网络相关信息*/
30 | public static final String[] NETWORK_ARR = {"getExtraInfo", "getReason", "getSubtype", "getSubtypeName", "getType", "getTypeName"};
31 |
32 | /*本机ip和主机名信息*/
33 | public static final String[] INET_ARR = {"getHostName", "getCanonicalHostName", "getAddress", "getHostAddress"};
34 |
35 | /*wifi相关信息*/
36 | public static final String[] WIFI_ARR = {"getMacAddress", "getBSSID", "getIpAddress", "getNetworkId", "getSSID", "getRssi"};
37 |
38 | /*wifi扫描信息*/
39 | public static final String[] WIFI_SCAN = {"ScanResults.BSSID", "ScanResults.capabilities", "ScanResults.frequency", "ScanResults.level", "ScanResults.SSID"};
40 |
41 | /*分辨率*/
42 | public static final String[] DISPLAY_ARR = {"getWidth", "getHeight", "getRotation"};
43 |
44 | /*屏幕度量信息*/
45 | public static final String[] DISPLAY_METRICS = {"widthPixels", "heightPixels", "density", "densityDpi", "scaledDensity"};
46 |
47 | /*定位信息*/
48 | public static final String[] LOCATION = {"getLatitude", "getLongitude"};
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/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/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 龙猫改机
3 | 龙猫自动改机
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/fx/totoro/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.fx.totoro;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chshaodong/totoro/b2928e203b68d1eeee301fc07adf7b5c936e86cd/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Jun 03 14:23:23 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------