diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..30aa626
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index f7b16a2..afaee01 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,10 +3,9 @@
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/app/build.gradle b/app/build.gradle
index 4859d97..c6ff81f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,15 +1,14 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 23
- buildToolsVersion '25.0.0'
-
+ compileSdkVersion 26
+ buildToolsVersion '28.0.2'
defaultConfig {
applicationId "mobi.acpm.inspeckage"
- minSdkVersion 18
- targetSdkVersion 23
- versionCode 9
- versionName "2.3"
+ minSdkVersion 21
+ targetSdkVersion 26
+ versionCode 10
+ versionName "2.4"
}
buildTypes {
@@ -24,13 +23,13 @@ android {
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- provided 'de.robv.android.xposed:api:5+'
- compile 'com.google.code.gson:gson:2+'
- compile group: 'org.nanohttpd', name: 'nanohttpd', version: '2.3.1'
- compile 'com.android.support:appcompat-v7:22.2.1'
- compile 'com.android.support:design:22.2.1'
- compile 'com.android.support:support-v4:22.2.1'
- compile 'org.java-websocket:Java-WebSocket:1.3.0'
- compile 'com.google.android.gms:play-services:6.5.87'
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ compileOnly 'de.robv.android.xposed:api:5+'
+ implementation 'com.google.code.gson:gson:2+'
+ implementation group: 'org.nanohttpd', name: 'nanohttpd', version: '2.3.1'
+ implementation 'com.android.support:appcompat-v7:26.1.0'
+ implementation 'com.android.support:design:26.1.0'
+ implementation 'com.android.support:support-v4:26.1.0'
+ implementation 'org.java-websocket:Java-WebSocket:1.3.0'
+ implementation 'com.google.android.gms:play-services:12.0.1'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4b73a89..95c495c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -52,6 +52,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/mobi/acpm/inspeckage/Module.java b/app/src/main/java/mobi/acpm/inspeckage/Module.java
index 10fd3ea..cd87771 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/Module.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/Module.java
@@ -1,5 +1,12 @@
package mobi.acpm.inspeckage;
+import android.app.AndroidAppHelper;
+import android.content.Context;
+import android.os.Handler;
+import android.os.Looper;
+
+import java.io.File;
+
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodHook;
@@ -7,10 +14,10 @@
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
-import mobi.acpm.inspeckage.hooks.FingerprintHook;
import mobi.acpm.inspeckage.hooks.ClipboardHook;
import mobi.acpm.inspeckage.hooks.CryptoHook;
import mobi.acpm.inspeckage.hooks.FileSystemHook;
+import mobi.acpm.inspeckage.hooks.FingerprintHook;
import mobi.acpm.inspeckage.hooks.FlagSecureHook;
import mobi.acpm.inspeckage.hooks.HashHook;
import mobi.acpm.inspeckage.hooks.HttpHook;
@@ -26,7 +33,6 @@
import mobi.acpm.inspeckage.hooks.WebViewHook;
import mobi.acpm.inspeckage.hooks.entities.LocationHook;
import mobi.acpm.inspeckage.util.Config;
-import mobi.acpm.inspeckage.util.DexUtil;
import mobi.acpm.inspeckage.util.FileType;
import mobi.acpm.inspeckage.util.FileUtil;
@@ -54,12 +60,25 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
sPrefs.reload();
- //estes hooks tem que ocorrer na inicializaĆ§Ć£o
- //ProcessHook.initAllHooks(loadPackageParam);
-
//check if this module is enable
if (loadPackageParam.packageName.equals("mobi.acpm.inspeckage")) {
findAndHookMethod("mobi.acpm.inspeckage.webserver.WebServer", loadPackageParam.classLoader, "isModuleEnabled", XC_MethodReplacement.returnConstant(true));
+
+ //workaround to bypass MODE_PRIVATE of shared_prefs
+ findAndHookMethod("android.app.SharedPreferencesImpl.EditorImpl", loadPackageParam.classLoader, "notifyListeners",
+ "android.app.SharedPreferencesImpl.MemoryCommitResult", new XC_MethodHook() {
+
+ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
+ //workaround to bypass the concurrency (io)
+ Handler handler = new Handler(Looper.getMainLooper());
+ handler.postDelayed(new Runnable() {
+ public void run() {
+ Context context = (Context) AndroidAppHelper.currentApplication();
+ FileUtil.fixSharedPreference(context);
+ }
+ }, 1000);
+ }
+ });
}
if (loadPackageParam.packageName.equals("mobi.acpm.inspeckage"))
@@ -68,6 +87,10 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
if (!loadPackageParam.packageName.equals(sPrefs.getString("package", "")))
return;
+ //inspeckage needs access to the files
+ File folder = new File(sPrefs.getString(Config.SP_DATA_DIR, null));
+ folder.setExecutable(true, false);
+
findAndHookMethod("android.util.Log", loadPackageParam.classLoader, "i",
String.class, String.class, new XC_MethodHook() {
@@ -153,7 +176,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
FingerprintHook.initAllHooks(loadPackageParam);
- DexUtil.saveClassesWithMethodsJson(loadPackageParam, sPrefs);
+ //DexUtil.saveClassesWithMethodsJson(loadPackageParam, sPrefs);
}
public static void logError(Error e){
diff --git a/app/src/main/java/mobi/acpm/inspeckage/hooks/FileSystemHook.java b/app/src/main/java/mobi/acpm/inspeckage/hooks/FileSystemHook.java
index 1e77f5f..323cea3 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/hooks/FileSystemHook.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/hooks/FileSystemHook.java
@@ -35,15 +35,13 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
String m;
switch (mode) {
+
case android.content.Context.MODE_PRIVATE:
m = "MODE_PRIVATE";
break;
- case android.content.Context.MODE_WORLD_READABLE:
- m = "MODE_WORLD_READABLE";
- break;
- case android.content.Context.MODE_WORLD_WRITEABLE:
- m = "MODE_WORLD_WRITEABLE";
- break;
+ //case android.content.Context.MODE_WORLD_WRITEABLE:
+ // m = "MODE_WORLD_WRITEABLE";
+ //break;
case android.content.Context.MODE_APPEND:
m = "MODE_APPEND";
break;
@@ -76,10 +74,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
String dir = (String) param.args[0];
String fileName = (String) param.args[1];
- if (dir.contains("Inspeckage") || fileName.contains("Inspeckage")) {
- XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
- } else {
- XposedBridge.log(TAG + "R/W Dir: " + dir + " File: " + fileName);
+ if(dir != null) {
+ if (dir.contains("Inspeckage") || fileName.contains("Inspeckage")) {
+ XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
+ } else {
+ XposedBridge.log(TAG + "R/W Dir: " + dir + " File: " + fileName);
+ }
}
}
});
@@ -91,10 +91,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
File fileDir = (File) param.args[0];
String fileName = (String) param.args[1];
- if (fileDir.getAbsolutePath().contains("Inspeckage") || fileName.contains("Inspeckage")) {
- XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
- } else {
- XposedBridge.log(TAG + "R/W Dir: " + fileDir.getAbsolutePath() + " File: " + fileName);
+ if(fileDir != null) {
+ if (fileDir.getAbsolutePath().contains("Inspeckage") || fileName.contains("Inspeckage")) {
+ XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
+ } else {
+ XposedBridge.log(TAG + "R/W Dir: " + fileDir.getAbsolutePath() + " File: " + fileName);
+ }
}
}
});
@@ -104,10 +106,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
URI uri = (URI) param.args[0];
- if (uri.toString().contains("Inspeckage")) {
- XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
- } else {
- XposedBridge.log(TAG + "R/W [new File(URI)]: " + uri.toString());
+ if(uri!=null) {
+ if (uri.toString().contains("Inspeckage")) {
+ XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
+ } else {
+ XposedBridge.log(TAG + "R/W [new File(URI)]: " + uri.toString());
+ }
}
}
});
diff --git a/app/src/main/java/mobi/acpm/inspeckage/hooks/FingerprintHook.java b/app/src/main/java/mobi/acpm/inspeckage/hooks/FingerprintHook.java
index fa2dd70..273194b 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/hooks/FingerprintHook.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/hooks/FingerprintHook.java
@@ -48,80 +48,83 @@ public static void initAllHooks(final XC_LoadPackage.LoadPackageParam loadPackag
try {
FingerprintList fingerprintList = gson.fromJson(json, FingerprintList.class);
-
- for (FingerprintItem fingerprintItem : fingerprintList.fingerprintItems) {
- if (fingerprintItem.enable) {
-
- if (fingerprintItem.type.equals("BUILD")) {
- XposedHelpers.setStaticObjectField(classBuild, fingerprintItem.name, fingerprintItem.newValue);
- } else if (fingerprintItem.type.equals("VERSION")) {
- XposedHelpers.setStaticObjectField(classBuildVersion, fingerprintItem.name, fingerprintItem.newValue);
- } else if (fingerprintItem.type.equals("TelephonyManager")) {
-
- try {
- switch (fingerprintItem.name) {
- case "IMEI":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
- HookFingerprintItem("com.android.internal.telephony.PhoneSubInfo", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
- HookFingerprintItem("com.android.internal.telephony.PhoneProxy", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
- if (Build.VERSION.SDK_INT < 22) {
- HookFingerprintItem("com.android.internal.telephony.gsm.GSMPhone", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
- }
- case "IMSI":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSubscriberId", fingerprintItem.newValue);
- case "PhoneNumber":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getLine1Number", fingerprintItem.newValue);
- case "SimSerial":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSimSerialNumber", fingerprintItem.newValue);
- case "CarrierCode":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getNetworkOperator", fingerprintItem.newValue);
- case "Carrier":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getNetworkOperatorName", fingerprintItem.newValue);
- case "SimCountry":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSimCountryIso", fingerprintItem.newValue);
- case "NetworkCountry":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getNetworkCountryIso", fingerprintItem.newValue);
- case "SimSerialNumber":
- HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSimSerialNumber", fingerprintItem.newValue);
+ if (fingerprintList != null && fingerprintList.fingerprintItems != null && fingerprintList.fingerprintItems.size() > 0) {
+ for (FingerprintItem fingerprintItem : fingerprintList.fingerprintItems) {
+ if (fingerprintItem.enable) {
+
+ if (fingerprintItem.type.equals("BUILD")) {
+ XposedHelpers.setStaticObjectField(classBuild, fingerprintItem.name, fingerprintItem.newValue);
+ } else if (fingerprintItem.type.equals("VERSION")) {
+ XposedHelpers.setStaticObjectField(classBuildVersion, fingerprintItem.name, fingerprintItem.newValue);
+ } else if (fingerprintItem.type.equals("TelephonyManager")) {
+
+ try {
+ switch (fingerprintItem.name) {
+ case "IMEI":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
+ HookFingerprintItem("com.android.internal.telephony.PhoneSubInfo", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
+ HookFingerprintItem("com.android.internal.telephony.PhoneProxy", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
+ if (Build.VERSION.SDK_INT < 22) {
+ HookFingerprintItem("com.android.internal.telephony.gsm.GSMPhone", loadPackageParam, "getDeviceId", fingerprintItem.newValue);
+ }
+ case "IMSI":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSubscriberId", fingerprintItem.newValue);
+ case "PhoneNumber":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getLine1Number", fingerprintItem.newValue);
+ case "SimSerial":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSimSerialNumber", fingerprintItem.newValue);
+ case "CarrierCode":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getNetworkOperator", fingerprintItem.newValue);
+ case "Carrier":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getNetworkOperatorName", fingerprintItem.newValue);
+ case "SimCountry":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSimCountryIso", fingerprintItem.newValue);
+ case "NetworkCountry":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getNetworkCountryIso", fingerprintItem.newValue);
+ case "SimSerialNumber":
+ HookFingerprintItem("android.telephony.TelephonyManager", loadPackageParam, "getSimSerialNumber", fingerprintItem.newValue);
+ }
+ } catch (Exception ex) {
+ log(TAG + fingerprintItem.name + ex.getMessage());
}
- } catch (Exception ex) {
- log(TAG + fingerprintItem.name + ex.getMessage());
- }
- } else if (fingerprintItem.type.equals("Advertising")) {
- try {
- HookFingerprintItem("com.google.android.gms.ads.identifier.AdvertisingIdClient$Info", loadPackageParam, "getId", fingerprintItem.newValue);
- }catch (XposedHelpers.ClassNotFoundError ex) {}
- } else if (fingerprintItem.type.equals("Wi-Fi")) {
- try {
-
- switch (fingerprintItem.name) {
- case "BSSID":
- HookFingerprintItem("android.net.wifi.WifiInfo", loadPackageParam, "getBSSID", fingerprintItem.newValue);
- break;
- case "SSID":
- HookFingerprintItem("android.net.wifi.WifiInfo", loadPackageParam, "getSSID", fingerprintItem.newValue);
- break;
- case "IP":{
- int value = 0;
- try {
- value = Util.inetAddressToInt(InetAddress.getByName(fingerprintItem.newValue));
- } catch (UnknownHostException e) {
- e.printStackTrace();
+ } else if (fingerprintItem.type.equals("Advertising")) {
+ try {
+ HookFingerprintItem("com.google.android.gms.ads.identifier.AdvertisingIdClient$Info", loadPackageParam, "getId", fingerprintItem.newValue);
+ } catch (XposedHelpers.ClassNotFoundError ex) {
+ }
+ } else if (fingerprintItem.type.equals("Wi-Fi")) {
+ try {
+
+ switch (fingerprintItem.name) {
+ case "BSSID":
+ HookFingerprintItem("android.net.wifi.WifiInfo", loadPackageParam, "getBSSID", fingerprintItem.newValue);
+ break;
+ case "SSID":
+ HookFingerprintItem("android.net.wifi.WifiInfo", loadPackageParam, "getSSID", fingerprintItem.newValue);
+ break;
+ case "IP": {
+ int value = 0;
+ try {
+ value = Util.inetAddressToInt(InetAddress.getByName(fingerprintItem.newValue));
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ HookFingerprintItem("android.net.wifi.WifiInfo", loadPackageParam, "getIpAddress", value);
+ break;
+ }
+ case "Android": {
+ byte[] mac = Util.macAddressToByteArr(fingerprintItem.newValue);
+ HookFingerprintItem("java.net.NetworkInterface", loadPackageParam, "getHardwareAddress", mac);
+ break;
}
- HookFingerprintItem("android.net.wifi.WifiInfo", loadPackageParam, "getIpAddress", value);
- break;
- }
- case "Android": {
- byte[] mac = Util.macAddressToByteArr(fingerprintItem.newValue);
- HookFingerprintItem("java.net.NetworkInterface", loadPackageParam, "getHardwareAddress", mac);
- break;
- }
+ }
+ } catch (XposedHelpers.ClassNotFoundError ex) {
}
- }catch (XposedHelpers.ClassNotFoundError ex) {}
- } else if (fingerprintItem.type.equals("Wi-Fi")) {
+ } else if (fingerprintItem.type.equals("Wi-Fi")) {
+ }
}
}
}
diff --git a/app/src/main/java/mobi/acpm/inspeckage/hooks/MiscHook.java b/app/src/main/java/mobi/acpm/inspeckage/hooks/MiscHook.java
index 812ade5..fcd6b4b 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/hooks/MiscHook.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/hooks/MiscHook.java
@@ -32,13 +32,13 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
findAndHookMethod(classBuildVersion, "getId", new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
- if(param!=null) {
+ if(param.args!=null && param.args.length>0) {
XposedBridge.log(TAG + "AdvertisingID: " + param.args[0] + "");
}
}
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
- if(param!=null) {
+ if(param.args!=null && param.args.length>0) {
XposedBridge.log(TAG + "AdvertisingID before: " + param.args[0] + "");
}
}
diff --git a/app/src/main/java/mobi/acpm/inspeckage/hooks/ProxyHook.java b/app/src/main/java/mobi/acpm/inspeckage/hooks/ProxyHook.java
index 76cc198..561c32c 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/hooks/ProxyHook.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/hooks/ProxyHook.java
@@ -1,5 +1,7 @@
package mobi.acpm.inspeckage.hooks;
+import android.os.Build;
+
import org.apache.http.HttpHost;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.impl.client.DefaultHttpClient;
@@ -32,8 +34,7 @@ public static void loadPrefs() {
public static void initAllHooks(final XC_LoadPackage.LoadPackageParam loadPackageParam) {
- findAndHookMethod("java.net.ProxySelectorImpl", loadPackageParam.classLoader, "select", URI.class, new XC_MethodHook() {
-
+ XC_MethodHook ProxySelectorHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
@@ -59,20 +60,17 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log(TAG + " [P:" + sPrefs.getString("host", null) + ":" + sPrefs.getString("port", null) + "] - URI = " + uri);
}
}
- });
-
- findAndHookMethod("java.net.ProxySelectorImpl", loadPackageParam.classLoader, "isNonProxyHost", String.class, String.class, new XC_MethodHook() {
-
- @Override
- protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-
- loadPrefs();
+ };
- if (sPrefs.getBoolean("switch_proxy", false)) {
- param.args[1] = "--inpeckage--";
- }
+ try {
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
+ findAndHookMethod("java.net.ProxySelectorImpl", loadPackageParam.classLoader, "select", URI.class, ProxySelectorHook);
+ } else {
+ findAndHookMethod("sun.net.spi.DefaultProxySelector", loadPackageParam.classLoader, "select", URI.class, ProxySelectorHook);
}
- });
+ } catch (Error e) {
+ Module.logError(e);
+ }
hookAllConstructors(XposedHelpers.findClass("org.apache.http.impl.client.DefaultHttpClient", loadPackageParam.classLoader), new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
diff --git a/app/src/main/java/mobi/acpm/inspeckage/hooks/SQLiteHook.java b/app/src/main/java/mobi/acpm/inspeckage/hooks/SQLiteHook.java
index 7a21a64..7383a4a 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/hooks/SQLiteHook.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/hooks/SQLiteHook.java
@@ -314,8 +314,8 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});
- } catch (XposedHelpers.ClassNotFoundError _) {
- } catch (NoSuchMethodError _) {
+ } catch (XposedHelpers.ClassNotFoundError e) {
+ } catch (NoSuchMethodError e) {
}
}
}
diff --git a/app/src/main/java/mobi/acpm/inspeckage/hooks/SharedPrefsHook.java b/app/src/main/java/mobi/acpm/inspeckage/hooks/SharedPrefsHook.java
index bae6d07..5acbd3f 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/hooks/SharedPrefsHook.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/hooks/SharedPrefsHook.java
@@ -48,7 +48,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
int modeId = (Integer) param.args[1];
String mode = "MODE_PRIVATE";
if(modeId == 1){
- mode = "MODE_WORLD_READABLE";
+ mode = "MODE_PRIVATE";
}else if(modeId == 2){
mode = "MODE_WORLD_WRITEABLE";
}else if(modeId > 2){
diff --git a/app/src/main/java/mobi/acpm/inspeckage/log/LogService.java b/app/src/main/java/mobi/acpm/inspeckage/log/LogService.java
index e772023..a642e64 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/log/LogService.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/log/LogService.java
@@ -54,7 +54,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
filter = intent.getStringExtra("filter");
}
- mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_WORLD_READABLE);
+ mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_PRIVATE);
wss = new WSocketServer(port);
wss.start();
@@ -130,7 +130,8 @@ public void run() {
while (isStarted) {
String name = mPrefs.getString(Config.SP_PACKAGE, "null");
- Process p = Runtime.getRuntime().exec("ps");
+ String ps = "su -c ps |grep "+name;
+ Process p = Runtime.getRuntime().exec(ps);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String var = "";
String psline;
diff --git a/app/src/main/java/mobi/acpm/inspeckage/receivers/InspeckageWebReceiver.java b/app/src/main/java/mobi/acpm/inspeckage/receivers/InspeckageWebReceiver.java
index 99c5041..2d93b34 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/receivers/InspeckageWebReceiver.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/receivers/InspeckageWebReceiver.java
@@ -14,13 +14,16 @@
public class InspeckageWebReceiver extends BroadcastReceiver {
private Context mContext;
+ public InspeckageWebReceiver(){
+
+ }
public InspeckageWebReceiver(Context ctx){
mContext = ctx;
}
@Override
public void onReceive(Context context, Intent intent) {
- SharedPreferences mPrefs = mContext.getSharedPreferences(Module.PREFS, mContext.MODE_WORLD_READABLE);
+ SharedPreferences mPrefs = context.getSharedPreferences(Module.PREFS, mContext.MODE_PRIVATE);
SharedPreferences.Editor edit = mPrefs.edit();
String action = intent.getExtras().getString("action");
diff --git a/app/src/main/java/mobi/acpm/inspeckage/ui/AuthFragment.java b/app/src/main/java/mobi/acpm/inspeckage/ui/AuthFragment.java
index 85f1017..3a43493 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/ui/AuthFragment.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/ui/AuthFragment.java
@@ -78,7 +78,7 @@ public static AuthFragment newInstance(String param1, String param2) {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_WORLD_READABLE);
+ mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_PRIVATE);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
diff --git a/app/src/main/java/mobi/acpm/inspeckage/ui/ConfigFragment.java b/app/src/main/java/mobi/acpm/inspeckage/ui/ConfigFragment.java
index b148058..ef51503 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/ui/ConfigFragment.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/ui/ConfigFragment.java
@@ -79,7 +79,7 @@ public static ConfigFragment newInstance(String param1, String param2) {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_WORLD_READABLE);
+ mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_PRIVATE);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
diff --git a/app/src/main/java/mobi/acpm/inspeckage/ui/MainActivity.java b/app/src/main/java/mobi/acpm/inspeckage/ui/MainActivity.java
index a91d0e9..b60969a 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/ui/MainActivity.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/ui/MainActivity.java
@@ -52,7 +52,7 @@ protected void onCreate(Bundle savedInstanceState) {
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
- mPrefs = getSharedPreferences(Module.PREFS, MODE_WORLD_READABLE);
+ mPrefs = getSharedPreferences(Module.PREFS, MODE_PRIVATE);
//main fragment
FragmentManager fragmentManager = getFragmentManager();
diff --git a/app/src/main/java/mobi/acpm/inspeckage/ui/MainFragment.java b/app/src/main/java/mobi/acpm/inspeckage/ui/MainFragment.java
index 853cc1f..2148449 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/ui/MainFragment.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/ui/MainFragment.java
@@ -63,7 +63,8 @@ public MainFragment() {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
- mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_WORLD_READABLE);
+ mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_PRIVATE);
+
String host = null;
if(!mPrefs.getString(Config.SP_SERVER_HOST, "All interfaces").equals("All interfaces")){
host = mPrefs.getString(Config.SP_SERVER_HOST, "All interfaces");
diff --git a/app/src/main/java/mobi/acpm/inspeckage/ui/SplashActivity.java b/app/src/main/java/mobi/acpm/inspeckage/ui/SplashActivity.java
index a233787..20ad689 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/ui/SplashActivity.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/ui/SplashActivity.java
@@ -8,6 +8,7 @@
import mobi.acpm.inspeckage.Module;
import mobi.acpm.inspeckage.R;
+import mobi.acpm.inspeckage.util.FileUtil;
public class SplashActivity extends AppCompatActivity {
@@ -19,7 +20,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
- mPrefs = getSharedPreferences(Module.PREFS, MODE_WORLD_READABLE);
+ mPrefs = getSharedPreferences(Module.PREFS, MODE_PRIVATE);
+ FileUtil.fixSharedPreference(this);
new Handler().postDelayed(new Runnable() {
diff --git a/app/src/main/java/mobi/acpm/inspeckage/util/Config.java b/app/src/main/java/mobi/acpm/inspeckage/util/Config.java
index e98fed3..c697139 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/util/Config.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/util/Config.java
@@ -6,6 +6,8 @@
public class Config {
//Paths
+ public static final String P_INSPECKAGE_PATH = "/data/data/mobi.acpm.inspeckage";
+ public static final String P_SHARED_PATH = "/shared_prefs/";
public static final String P_ROOT = "/Inspeckage";
public static final String P_LOG = "/log";
diff --git a/app/src/main/java/mobi/acpm/inspeckage/util/FileUtil.java b/app/src/main/java/mobi/acpm/inspeckage/util/FileUtil.java
index fe31eed..74a2769 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/util/FileUtil.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/util/FileUtil.java
@@ -24,11 +24,22 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import mobi.acpm.inspeckage.Module;
+
/**
* Created by acpm on 29/11/15.
*/
public class FileUtil {
+ public static void fixSharedPreference(Context context) {
+
+ File folder = new File(Config.P_INSPECKAGE_PATH);
+ folder.setExecutable(true, false);
+
+ String mPrefFile = Config.P_INSPECKAGE_PATH + Config.P_SHARED_PATH + Module.PREFS + ".xml";
+ (new File(mPrefFile)).setReadable(true, false);
+ }
+
public static void writeToFile(SharedPreferences prefs, String data, FileType ft, String name) {
try {
@@ -327,21 +338,23 @@ public static void zipFolder(String inputFolderPath, String outZipPath) {
static void addDir(File srcFile, ZipOutputStream zos) throws IOException {
File[] files = srcFile.listFiles();
- byte[] buffer = new byte[1024];
- for (File file : files) {
+ if(files != null) {
+ byte[] buffer = new byte[1024];
+ for (File file : files) {
- if (file.isDirectory()) {
- addDir(file, zos);
- continue;
- }
- FileInputStream fis = new FileInputStream(file);
- zos.putNextEntry(new ZipEntry(file.getName()));
- int length;
- while ((length = fis.read(buffer)) > 0) {
- zos.write(buffer, 0, length);
+ if (file.isDirectory()) {
+ addDir(file, zos);
+ continue;
+ }
+ FileInputStream fis = new FileInputStream(file);
+ zos.putNextEntry(new ZipEntry(file.getName()));
+ int length;
+ while ((length = fis.read(buffer)) > 0) {
+ zos.write(buffer, 0, length);
+ }
+ zos.closeEntry();
+ fis.close();
}
- zos.closeEntry();
- fis.close();
}
}
diff --git a/app/src/main/java/mobi/acpm/inspeckage/util/Fingerprint.java b/app/src/main/java/mobi/acpm/inspeckage/util/Fingerprint.java
index 6ac4d3a..2783c76 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/util/Fingerprint.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/util/Fingerprint.java
@@ -33,7 +33,7 @@ public class Fingerprint {
public Fingerprint(Context context){
mContext = context;
- mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_WORLD_READABLE);
+ mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_PRIVATE);
}
public static Fingerprint getInstance(Context context){
if (instance == null)
diff --git a/app/src/main/java/mobi/acpm/inspeckage/util/PackageDetail.java b/app/src/main/java/mobi/acpm/inspeckage/util/PackageDetail.java
index a6b891b..edd721b 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/util/PackageDetail.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/util/PackageDetail.java
@@ -29,7 +29,8 @@ public class PackageDetail {
public PackageDetail(Context context, String app) {
- mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_WORLD_READABLE);
+ mPrefs = context.getSharedPreferences(Module.PREFS, context.MODE_PRIVATE);
+
mContext = context;
pm = context.getPackageManager();
List plist = context.getPackageManager().getInstalledPackages(0);
diff --git a/app/src/main/java/mobi/acpm/inspeckage/util/Replacement.java b/app/src/main/java/mobi/acpm/inspeckage/util/Replacement.java
index bef3b02..4d42d92 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/util/Replacement.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/util/Replacement.java
@@ -39,8 +39,9 @@ public static boolean parameterReplace(XC_MethodHook.MethodHookParam param, XSha
if (item.paramMatch != null && item.paramMatch.toString().trim() != "") {
if (item.paramMatch.equals(param.args[p])) {
param.args[p] = item.paramNewValue;
+ }else if(((String)param.args[p]).contains((String)item.paramMatch)){
+ ((String)param.args[p]).replace((String)item.paramMatch,(String)item.paramNewValue);
}
-
} else {
param.args[p] = item.paramNewValue;
}
@@ -56,9 +57,22 @@ public static boolean parameterReplace(XC_MethodHook.MethodHookParam param, XSha
} else if (item.paramType.equals("ByteArray") && param.args[p].getClass().equals(byte[].class)) {
String v = Util.byteArrayToString((byte[]) param.args[p]);
+ /**
+ String originalValue = v;
+
+ if(v.contains("{\"body")) {
+ XposedBridge.log(UserHooks.TAG+" PROJETOX REQUEST" + originalValue);
+ }else if(v.contains("{")){
+ XposedBridge.log(UserHooks.TAG+" PROJETOX RESPONSE" + originalValue);
+ }
+ **/
if (item.paramMatch != null && !item.paramMatch.toString().trim().equals("")) {
- if (v.equals(item.paramMatch.toString())) {
- param.args[p] = v.getBytes();
+
+ if(v.contains(item.paramMatch.toString())){
+ //XposedBridge.log(UserHooks.TAG+" PROJETOX - OLD - "+originalValue);
+ String newValue = v.replace(item.paramMatch.toString(),item.paramNewValue.toString());
+ param.args[p] = newValue.getBytes();
+ //XposedBridge.log(UserHooks.TAG+" PROJETOX - NEW - "+newValue);
}
} else {
param.args[p] = item.paramNewValue.toString().getBytes();
diff --git a/app/src/main/java/mobi/acpm/inspeckage/webserver/WebServer.java b/app/src/main/java/mobi/acpm/inspeckage/webserver/WebServer.java
index 98a0abf..6de78fc 100644
--- a/app/src/main/java/mobi/acpm/inspeckage/webserver/WebServer.java
+++ b/app/src/main/java/mobi/acpm/inspeckage/webserver/WebServer.java
@@ -88,8 +88,7 @@ public class WebServer extends fi.iki.elonen.NanoHTTPD {
public WebServer(String host, int port, Context context) throws IOException {
super(host,port);
mContext = context;
- mPrefs = mContext.getSharedPreferences(Module.PREFS, mContext.MODE_WORLD_READABLE);
-
+ mPrefs = mContext.getSharedPreferences(Module.PREFS, mContext.MODE_PRIVATE);
try {
keyStore = KeyStore.getInstance("AndroidKeyStore");
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 326afcf..21b4f2c 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -17,7 +17,7 @@
+ android:layout_height="60dp" />