Skip to content

Commit

Permalink
v2.4 - fix Android >=7 problems and some others bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ac-pm committed Aug 24, 2018
1 parent a8744cd commit d8806c9
Show file tree
Hide file tree
Showing 28 changed files with 261 additions and 175 deletions.
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 1 addition & 14 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 15 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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'
}
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<receiver android:name=".receivers.InspeckageWebReceiver" android:exported="false">
<intent-filter>
<action android:name="mobi.acpm.inspeckage.INSPECKAGE_FILTER"/>
</intent-filter>
</receiver>

</application>

</manifest>
35 changes: 29 additions & 6 deletions app/src/main/java/mobi/acpm/inspeckage/Module.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
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;
import de.robv.android.xposed.XC_MethodReplacement;
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;
Expand All @@ -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;

Expand Down Expand Up @@ -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"))
Expand All @@ -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() {

Expand Down Expand Up @@ -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){
Expand Down
40 changes: 22 additions & 18 deletions app/src/main/java/mobi/acpm/inspeckage/hooks/FileSystemHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
});
Expand All @@ -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);
}
}
}
});
Expand All @@ -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());
}
}
}
});
Expand Down
Loading

0 comments on commit d8806c9

Please sign in to comment.