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

Commit

Permalink
Added restriction IpPrefix.getRawAddress
Browse files Browse the repository at this point in the history
Refs #1757
  • Loading branch information
M66B committed Dec 15, 2014
1 parent 8757d12 commit bc8498d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Changelog
* Allow white listing / show parameter of *getExternalStorageState* ([issue](/../../issues/1757))
* Added quirk *nousage* to disable usage data for specific applications ([issue](/../../issues/2085))
* Added restrictions for [UsageStatsManager](https://developer.android.com/reference/android/app/usage/UsageStatsManager.html) ([issue](/../../issues/1757))
* Added restriction *IpPrefix.getRawAddress* ([issue](/../../issues/1757))

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

Expand Down
1 change: 1 addition & 0 deletions res/values/functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
<string name="network_Srv_Default_DNS" translatable="false"><![CDATA[Will restrict access to the hidden system global property default DNS server]]></string>
<string name="network_Srv_WiFi_Country" translatable="false"><![CDATA[Will restrict access to the hidden system global property Wi-Fi country code]]></string>
<string name="network_NetworkInfo_getExtraInfo" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/net/NetworkInfo.html#getExtraInfo()">Google documentation</a>]]></string>
<string name="network_IpPrefix_getRawAddress" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/net/IpPrefix.html#getRawAddress()">Google documentation</a>]]></string>

<!-- nfc -->
<string name="nfc_getNfcAdapter" translatable="false"><![CDATA[Will restrict access to hidden function to get <a href="https://developer.android.com/reference/android/nfc/NfcAdapter.html">NfcAdapter</a>]]></string>
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 @@ -310,6 +310,9 @@ public static List<Hook> get() {
// android.net.NetworkInfo
mListHook.add(new Hook("network", "NetworkInfo.getExtraInfo", null, 1, "2.2.2", "internet/getExtraInfo").unsafe());

// android.net.IpPrefix
mListHook.add(new Hook("network", "IpPrefix.getRawAddress", null, 21, "3.5.6", null).unsafe());

mListHook.add(new Hook("nfc", "getNfcAdapter", "NFC", 14, null, null).unsafe());
mListHook.add(new Hook("nfc", "getDefaultAdapter", "NFC", 10, null, null).unsafe());

Expand Down
50 changes: 50 additions & 0 deletions src/biz/bokhorst/xprivacy/XIpPrefix.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package biz.bokhorst.xprivacy;

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

import android.os.Binder;
import biz.bokhorst.xprivacy.XHook;

public class XIpPrefix extends XHook {
private Methods mMethod;

private XIpPrefix(Methods method, String restrictionName) {
super(restrictionName, "IpPrefix." + method.name(), null);
mMethod = method;
}

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

// public byte[] getRawAddress()
// https://developer.android.com/reference/android/net/IpPrefix.html
// http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/android/net/IpPrefix.java

private enum Methods {
getRawAddress
};

public static List<XHook> getInstances() {
List<XHook> listHook = new ArrayList<XHook>();
listHook.add(new XIpPrefix(Methods.getRawAddress, PrivacyManager.cStorage));
return listHook;
}

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

@Override
protected void after(XParam param) throws Throwable {
switch (mMethod) {
case getRawAddress:
if (param.getResult() != null)
if (isRestricted(param))
param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "IPInt"));
break;
}
}
}
3 changes: 3 additions & 0 deletions src/biz/bokhorst/xprivacy/XPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
// IO bridge
hookAll(XIoBridge.getInstances(), null, mSecret);

// IP prefix
hookAll(XIpPrefix.getInstances(), null, mSecret);

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

Expand Down

0 comments on commit bc8498d

Please sign in to comment.