Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Disable load/loadLibrary for now, refs #50
Browse files Browse the repository at this point in the history
Remove some logging
  • Loading branch information
Marcel Bokhorst committed Jun 22, 2013
1 parent 2dd76ec commit 9e72551
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/biz/bokhorst/xprivacy/XPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ public void initZygote(StartupParam startupParam) throws Throwable {
hook(new XRuntime("exec", XRestriction.cShell, new String[] {}, "sh"), "java.lang.Runtime");
hook(new XRuntime("exec", XRestriction.cShell, new String[] {}, "su"), "java.lang.Runtime");
hook(new XRuntime("exec", XRestriction.cShell, new String[] {}, null), "java.lang.Runtime");
hook(new XRuntime("load", XRestriction.cShell, new String[] {}, null), "java.lang.Runtime");
hook(new XRuntime("loadLibrary", XRestriction.cShell, new String[] {}, null), "java.lang.Runtime");
// @formatter:off
//hook(new XRuntime("load", XRestriction.cShell, new String[] {}, null), "java.lang.Runtime");
//hook(new XRuntime("loadLibrary", XRestriction.cShell, new String[] {}, null), "java.lang.Runtime");
// @formatter:on

// Process builder
hook(new XProcessBuilder("start", XRestriction.cShell, new String[] {}, "sh"), "java.lang.ProcessBuilder");
Expand Down
2 changes: 0 additions & 2 deletions src/biz/bokhorst/xprivacy/XProcessBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.List;

import android.text.TextUtils;
import android.util.Log;

import de.robv.android.xposed.XC_MethodHook.MethodHookParam;

Expand All @@ -28,7 +27,6 @@ protected void before(MethodHookParam param) throws Throwable {

// Check commands
String command = TextUtils.join(" ", listProg);
XUtil.log(this, Log.INFO, "start(" + command + ")");
if ((mCommand == null && !command.startsWith("sh") && !command.startsWith("su"))
|| (mCommand != null && command.startsWith(mCommand)))
if (isRestricted(param, mCommand == null ? getMethodName() : mCommand))
Expand Down
8 changes: 3 additions & 5 deletions src/biz/bokhorst/xprivacy/XRestriction.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public class XRestriction {
mMethods.get(cShell).add("sh");
mMethods.get(cShell).add("su");
mMethods.get(cShell).add("exec");
mMethods.get(cShell).add("load");
mMethods.get(cShell).add("loadLibrary");
// mMethods.get(cShell).add("load");
// mMethods.get(cShell).add("loadLibrary");
mMethods.get(cShell).add("start");

// Settings secure
Expand Down Expand Up @@ -403,10 +403,8 @@ public static boolean getRestricted(XHook hook, Context context, int uid, String
if (usage && uid != 1000 && !"getPackageGids".equals(methodName)) {
UsageData usageData = new UsageData(uid, restrictionName, methodName);
synchronized (mUsageQueue) {
if (mUsageQueue.containsKey(usageData)) {
if (mUsageQueue.containsKey(usageData))
mUsageQueue.remove(usageData);
XUtil.log(hook, Log.INFO, "Replacing usage data=" + usageData);
}
mUsageQueue.put(usageData, usageData);
XUtil.log(hook, Log.INFO, "Queue usage data=" + usageData + " size=" + mUsageQueue.size());
}
Expand Down
6 changes: 2 additions & 4 deletions src/biz/bokhorst/xprivacy/XRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.IOException;

import android.text.TextUtils;
import android.util.Log;
import de.robv.android.xposed.XC_MethodHook.MethodHookParam;

public class XRuntime extends XHook {
Expand All @@ -21,8 +20,8 @@ public XRuntime(String methodName, String restrictionName, String[] permissions,
// public Process exec(String prog)
// public Process exec(String prog, String[] envp)
// public Process exec(String prog, String[] envp, File directory)
// public void load(String pathName)
// public void loadLibrary(String libName)
// # public void load(String pathName)
// # public void loadLibrary(String libName)
// libcore/luni/src/main/java/java/lang/Runtime.java

@Override
Expand All @@ -38,7 +37,6 @@ protected void before(MethodHookParam param) throws Throwable {
// Check programs
if (progs != null) {
String command = TextUtils.join(" ", progs);
XUtil.log(this, Log.INFO, "exec(" + command + ")");
if ((mCommand == null && !command.startsWith("sh") && !command.startsWith("su"))
|| (mCommand != null && command.startsWith(mCommand)))
if (isRestricted(param, mCommand == null ? getMethodName() : mCommand))
Expand Down

0 comments on commit 9e72551

Please sign in to comment.