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

Commit

Permalink
Added restriction for LinkAddress (Android "L")
Browse files Browse the repository at this point in the history
Refs #1757
  • Loading branch information
M66B committed Jun 29, 2014
1 parent 0f4f811 commit 774e88c
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Changelog
* Fixed all problems reported through the support info
* Thanks for sending all the support info!
* Removed restrictions for NEW_PICTURE and ACTION_NEW_VIDEO broadcasts (not needed)
* Added restriction for *LinkAddress.toString* (Android "L") ([issue](/../../issues/1757))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
3 changes: 3 additions & 0 deletions src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public static List<Hook> get() {
mListHook.add(new Hook("internet", "inet_bw", "READ_NETWORK_USAGE_HISTORY,MODIFY_NETWORK_ACCOUNTING", 1, "2.1.1", null).dangerous().restart().noUsageData());
mListHook.add(new Hook("internet", "inet_vpn", "NET_TUNNELING", 1, "2.1.1", null).dangerous().restart().noUsageData());
mListHook.add(new Hook("internet", "inet_mesh", "LOOP_RADIO", 1, "2.1.1", null).dangerous().restart().noUsageData());

mListHook.add(new Hook("internet", "getActiveNetworkInfo", null, 1, null, null).dangerous());
mListHook.add(new Hook("internet", "getAllNetworkInfo", null, 1, null, null));
mListHook.add(new Hook("internet", "getNetworkInfo", null, 1, null, null).dangerous());
Expand All @@ -132,6 +133,8 @@ public static List<Hook> get() {

mListHook.add(new Hook("internet", "connect", null, 1, "1.99.45", null).dangerous().whitelist(cTypeIPAddress));

mListHook.add(new Hook("internet", "LinkAddress.toString", null, 20, "2.1.17", null));

mListHook.add(new Hook("ipc", "IAccountManager", "", 1, "2.1.7", null).dangerous());
mListHook.add(new Hook("ipc", "IActivityManager", "", 1, "2.1.7", null).dangerous());
mListHook.add(new Hook("ipc", "IClipboard", "", 1, "2.1.7", null).dangerous());
Expand Down
47 changes: 47 additions & 0 deletions src/biz/bokhorst/xprivacy/XLinkAddress.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package biz.bokhorst.xprivacy;

import java.util.ArrayList;
import java.util.List;

import android.util.Log;

public class XLinkAddress extends XHook {
private Methods mMethod;

private XLinkAddress(Methods method, String restrictionName) {
super(restrictionName, method.name(), "LinkAddress." + method.name());
mMethod = method;
}

public String getClassName() {
return "android.net.LinkAddress";
}

// public String toString ()
// http://developer.android.com/reference/android/net/LinkAddress.html

private enum Methods {
toString
};

public static List<XHook> getInstances() {
List<XHook> listHook = new ArrayList<XHook>();
listHook.add(new XLinkAddress(Methods.toString, PrivacyManager.cInternet));
return listHook;
}

@Override
protected void before(XParam param) throws Throwable {
// Do nothing
}

@Override
protected void after(XParam param) throws Throwable {
if (mMethod == Methods.toString) {
if (param.getResult() != null && isRestricted(param))
param.setResult("127.0.1.1/24");

} else
Util.log(this, Log.WARN, "Unknown method=" + param.method.getName());
}
}
3 changes: 3 additions & 0 deletions src/biz/bokhorst/xprivacy/XPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
// IO bridge
hookAll(XIoBridge.getInstances(), null, mSecret);

// Link address
hookAll(XLinkAddress.getInstances(), null, mSecret);

// Location manager
hookAll(XLocationManager.getInstances(null), null, mSecret);

Expand Down

0 comments on commit 774e88c

Please sign in to comment.