yashsingh1/xdaforums huggingface dataset:
[Xposed Framework Modules] badabing2003:
Thank you,

All right, one step closer.

I see timestamp on chd, so it's being accessed, and I expect that the Lua code is just Bypassing the method and returning.

I guess doing that alone is not enough to make the app not remove the package.

Next was the lz() method mentioned in here

Here's my current definition file

{
"script": [
{
"name": "BB.AA.Bypass",
"code": "function before(hook, param)\n param:setResult(\"Developer\")\n return true\nend\n"
}
],
"definition": [
{
"builtin": false,
"collection": "BB",
"group": "AndroidAuto",
"name": "AA.xM",
"author": "BB",
"description": "",
"className": "chd",
"methodName": "xM",
"parameterTypes": [],
"returnType": "java.lang.String",
"minSdk": 1,
"maxSdk": 999,
"minApk": 0,
"maxApk": 2147483647,
"enabled": true,
"optional": false,
"usage": true,
"notify": false,
"luaScript": "@BB.AA.Bypass"
},
{
"builtin": false,
"collection": "BB",
"group": "AndroidAuto",
"name": "AA.lz",
"author": "BB",
"description": "",
"className": "axb",
"methodName": "lz",
"parameterTypes": [],
"returnType": "com.google.Android.gms.common.api.GoogleApiClient",
"minSdk": 1,
"maxSdk": 999,
"minApk": 0,
"maxApk": 2147483647,
"enabled": true,
"optional": false,
"usage": true,
"notify": false,
"luaScript": "@BB.AA.Bypass"
}
]
}

I'm getting the following exception on lz()

BB.AA.lz
java.lang.IllegalArgumentException: Cannot hook interfaces: public abstract com.google.android.gms.common.api.GoogleApiClient axb.lz()
at de.robv.android.xposed.XposedBridge.hookMethod(XposedBridge.java:208)
at eu.faircode.xlua.XLua$4.hookPackage(SourceFile:422)
at eu.faircode.xlua.XLua$4.afterHookedMethod(SourceFile:296)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:375)
at android.app.LoadedApk.makeApplication(<Xposed>)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5715)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:361)
at android.app.ActivityThread.handleBindApplication(<Xposed>)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108)

If I set the return type to string it complains that it is getting com.google.Android.gms.common.api.GoogleApiClient

Thanks

BB
[Xposed Framework Modules] M66B:
As the message says, you cannot hook interface declarations, only interface implementations.

Try hooking class bdv.aGs.aGU method lz.

Some background info:

https://docs.oracle.com/javase/tutorial/java/concepts/interface.html
[Xposed Framework Modules] badabing2003:
I get class not found exception when using class

bdv.aGs.aGU

or

axb.bdv.aGs.aGU

and method lz

:(

Thanks

BB

PS: I still get frequent "selection not sticking" issue.
[Xposed Framework Modules] Namnodorel:
This may be useful for combating obfuscation: https://github.com/Nordskog/ClassHunter/blob/master/README.md

I've not yet thought about how it could even be used in XPL, but I wanted to throw it in in case it has some use.
[Xposed Framework Modules] M66B:
Where?
[Xposed Framework Modules] badabing2003:
Mostly in XPrivacyLua, but I've also seen it in the Pro when managing granular restrictions.

Thanks

BB
[Xposed Framework Modules] tiaox:
[MENTION=5297163]Fif_[/MENTION], I tried your and M66B's BlockGuardOs hooks to see if I could get rid of some automatically generated files in my internal storage (did the same thing in XPrivacy back in the days).

For example, Instagram places a file named .profig.os into /mnt/sdcard/ and is still able to do so with the hook in place, even though it shows as blocked in logcat.

I haven't (yet) looked further into this, just wanted to see if anyone can point me in a specific direction. Seems like either file creation isn't blocked by that hook, or BlockGuard isn't the right (or only) entrypoint when hooking file operations. Thoughts?
[Xposed Framework Modules] Fif_:
The BlockGuardOs hook is pretty deep in the Android runtime and should catch all regular file opens. While debugging it, I've seen it invoked on everything, from loading shared libraries to opening regular files.

Does Instagram use native code? That hook, or anything Xposed really won't work with native code. You can always revoke external storage permission and hope for the best, but it may crash the app.
[Xposed Framework Modules] M66B:
The latest version of the companion app supports uploading to and downloading from a hook definitions repository, so if you created a hook definition which might be useful to others, consider to upload it.
[Xposed Framework Modules] mnjm9b:
yes, I had about a dozen that I made but then you went and included most of them. The others are not stable yet but I will upload those once I figure them out...unless you (or someone else) beat me to it again.
[Xposed Framework Modules] M66B:
You can upload the others, but make sure you upload them disabled and say in the description that they are not stable or better, what exactly is not stable.
[Xposed Framework Modules] mnjm9b:
that's not bad...then people can maybe collaborate on getting stubborn hooks working.

also, can there be access to downloads with web browser? or just strictly with pro app?
[Xposed Framework Modules] M66B:
The hook definitions are available through the companion app only for now.
[Xposed Framework Modules] badabing2003:
I downloaded what you had put there Marcel, but they were all enabled, does that mean you have ironed out the kinks for those?

Thanks

BB
[Xposed Framework Modules] M66B:
No, I didn't, but I didn't get complaints either.
[Xposed Framework Modules] badabing2003:
Thanks,

I'll disable them locally for now, I know I had issues with at least Build.Fingerprint, not the fault of the definition but more apps hanging if they couldn't read the value.

Thanks again for making this a possibility.

BB
[Xposed Framework Modules] M66B:
The Build.FINGERPRINT hook was not uploaded to the hook definitions repository.
[Xposed Framework Modules] badabing2003:
My bad.

I just checked it's still disabled.

Sorry for the mistake.
[Xposed Framework Modules] M66B:
Here it is: https://lua.xprivacy.eu/repo/
[Xposed Framework Modules] dhnasa:
How can i hook a methode which is in a different package than the apps package?
[Xposed Framework Modules] M66B:
The package name is part of the class name, so by specifying the right class name.
[Xposed Framework Modules] Fif_:
I've attached to this post my set of hooks, updated for the latest XPrivacyLua and companion apps (XPrivacyLua 1.21.4 / Pro 0.46):

BlockGuardOs.open - version 3

Added version (=1), description and copyright notices.

This version includes a new whitelisted path for devices that use Chrome as the webview renderer: /data/app/com.android.chrome-.

Now uses a cached list of the whitelisted paths, computed the first time the hook is called.

File.mkdir - version 2

Added version (=1), description and copyright notices.

InetAddress.getXByName - version 3

Added version (=1), description and copyright notices.

Now uses putValue/getValue for storing the cached blacklisted domain list.

InetAddress.getByAddress - version 2

New hook, hooking all known signatures of getByAddress.

This hook does not block any requests, but just logs them for analysis.

Presage - version 2

New hooks for the Presage analytics/ad serving platforms.

As there's no published documentation for the SDK, the list of hooked function may be incomplete.

Radar - version 2

Added version (=1), description and copyright notices.

Thank you [MENTION=2799345]M66B[/MENTION]. I'll be uploading my hooks as soon as the following questions are clarified:

Namespace issues: All the hooks I've published in this thread so far have been in the "Fif" collection. All of them are privacy-related. Should hook publishers use the "Privacy" collection, or would you prefer have them in a separate collection?

Duplicate hooks: As you've seen, I've taken your BlockGuardOs.open hook definition and built upon it. How would you like to see this hook show up on the hook repo? Same name (BlockGuardOs.open) as the original, or something else? This also ties into the previous question, w.r.t. collections.

Not strictly privacy related hooks: How do you feel about having hooks in the repo that are not privacy-related?

Shared code in the hook repo / hook sets: Although you had made provisions for sharing hook code while importing json hook definitions, it looks like the hook repo is making a step backwards. For example, I've seen that the 13 FlurryAgent hooks need to downloaded separately to cover all the Flurry API methods. Similarly, if I were to upload the Radar hook to the repo site, I'd have to upload and manage separately 17 hook definitions. Although it's doable, it seems sub-optimal.

Builtin hooks duplicate with repo hooks: I assume that the currently disabled builtin hooks currently present in the repo (NetworkInfo.createFromParcel, Runtime.exec/*, ProcessBuilder.command/*, your version of BlockGuardOs.open, and FlurryAgent.*) will eventually be dropped as builtin hooks.

The new version attached uses the correct mechanisms for persisting data across hook invocations. Thanks.

I was not aware of that project, but this is genius against ProGuard and friends.
[Xposed Framework Modules] M66B:
The author is part of the key to store hook definitions, so there will be no name space issues.

You are free to name your hooks and collections as you like.

Non privacy related hook definitions are welcome.

Hook definitions should be self contained and not directly related to each other, which is why there are 17 Flurry hook definitions. In the pro companion app you can search on all visible values and downloading is just one tap, so this is not really inconvenient.

All hook definitions I have uploaded will be removed from the next version of XPrivacyLua.
[Xposed Framework Modules] Fif_:
Thanks [MENTION=2799345]M66B[/MENTION].

I managed to register and upload all the hook definitions I posted in the OP. However it was not as smooth as you'd have expected.

After entering an email address in XPrivacyLua Pro, I received the email from FairCode.

In it, there was a link that was displayed as xlua://lua.xprivacy.eu/register?token=XXXX, but which actually linked to http://r.af.d.sendibt2.com/tr/cl/MUCHLONGERTOKEN.

When clicked in my Android email client (K-9), I was sent to sendibt2.com, and not the the XPrivacyLua app.

With a little bit of wrangling on my end, I was able to open the intended xlua:// link and complete the registration process.

It looks like the registration email you are sending uses tracking for the URL links, ironically :eek:

Another question: if I have multiple devices, should I register them all separately with the same email address, or can I open the same link in multiple devices?
[Xposed Framework Modules] M66B:
First of all thanks for sharing and uploading your work. In fact your work made me develop the repository. I have seen that already some people downloaded your hook definitions, so I guess you have and will at least make some people happy.

If you upload improvements, you should increase the version number, so people can see in the companion app that there is an update.

I will see if I can improve the registration process.

Unfortunately, most email providers insert tracking codes and when contacted about this they have a good reason for it: combating misuse and spam. Some allow to send email without tracking codes, but in my experience those providers have the most deliverability problems, so there seems to be at least some truth in it. I am quite happy with my current email provider, SendinBlue, since I haven't had a single problem in months. They personally contact you with questions before they allow you to send email. They are being criticized for this, but IMHO they are doing this the right way.

You can use the same email address on multiple devices and they will share the same registration.
[Xposed Framework Modules] M66B:
[MENTION=5297163]Fif_[/MENTION] the registration procedure has been improved. Please let me know how it goes with your other devices.
[Xposed Framework Modules] dhnasa:
[MENTION=2799345]M66B[/MENTION]

i cant access a non public field :(

As far as i know you have to use getDeclaredField

java.lang.NoSuchFieldException: mGoogleApiClient

at java.lang.Class.getField(Class.java:1549)

at eu.faircode.xlua.XLua$4.hookPackage(SourceFile:328)

at eu.faircode.xlua.XLua$4.afterHookedMethod(SourceFile:296)

at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:374)

at android.app.LoadedApk.makeApplication(<Xposed>)

at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5422)

at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)

at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:360)

at android.app.ActivityThread.handleBindApplication(<Xposed>)

at android.app.ActivityThread.-wrap2(ActivityThread.java)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1564)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:154)

at android.app.ActivityThread.main(ActivityThread.java:6186)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
[Xposed Framework Modules] M66B:
LuaJ has been adapted by me to allow access to private fields, so it is more likely that you are trying to access a field that doesn't exists in the class instance. This also means you don't need to use getDeclaredField, which doesn't search in super classes, which could also be the problem. You can simply access a private field this way:

object:field_name
[Xposed Framework Modules] M66B:
This post reveals that there are more system properties that need restricting:

https://xdaforums.com/showpost.php?p=75646690&postcount=1900

"gsm.operator.numeric"

Can somebody please look into this and write the necessary hook definitions?
[Xposed Framework Modules] Fif_:
What about the errors and stacktraces in the post?

The crash would be happening on the second line of this chunk of code:

local h = hook:getName()
local match = string.gmatch(h, '[^/]+')

How can h be userdata?

[MENTION=2799345]M66B[/MENTION], out of curiosity, why are SystemProperties.get*/serial and /vendor enabled while SystemProperties.getBoolean, getInt and getLong disabled by default? They all seem to be sharing the same code.

Adding more properties is easy. A quick review of getprop on one device shows that the following properties may have to be restricted:

bluetooth.version

gsm.operator.*

gsm.sim.operator.*

gsm.version.*

net.dns*

net.*.dns*

net.*.gw

net.hostname

oem.device.imeicache*

persist.radio.*.iccid

persist.service.bdroid.bdaddr

persist.sys.oem.region

persist.sys.timezone

persist.sys.version.*

ro.board.platform

ro.boot.pcba_number

ro.boot.secboot

ro.boot.verifiedbootstate

ro.boot.veritymode

ro.build.*

ro.carrier

ro.runtime.firstboot

ro.serialno

wc_transport.stack_bdaddr
[Xposed Framework Modules] M66B:
The error was caused by enabling SystemProperties.getBoolean/Int/Long, which were more place holders than real implementations. The type returned by the referenced script is string, which is incorrect for these method.

I guess not all those properties will exists on all devices.

My choice would be, also to avoid too many possibly difficult to pinpoint problems:

gsm.operator.*

gsm.sim.operator.*

net.hostname

ro.build.* (fingerprint is know to cause problems)

Some are already done:

https://github.com/M66B/XPrivacyLua/blob/master/app/src/main/assets/systemproperties_get.lua

BTW, the same script will not be compiled again anymore in the latest release. See these commits for details:

https://github.com/M66B/XPrivacyLua/commit/4ef92734350fc96b4d88bfa980116160da9b41f9

https://github.com/M66B/XPrivacyLua/commit/57fa03fdc6953a3340cb23b311ce0c4d90855640

This will likely solve the app start delay you reported before.
[Xposed Framework Modules] Fif_:
[MENTION=2799345]M66B[/MENTION],

These two patches seem to make app loading a little bit faster. I haven't measured anything scientifically, that's just an impression.

Looking at the code, it seems like delaying compilation until the hook is actually hit might bring even more startup savings, as most apps typically hit only a very small fraction of the hooks that are applied. The downside may more choppy/stuttery apps.

One very annoying downside is that the line numbers are off now that empty and comment-only lines are removed during the lua minification process. Maybe you should just insert empty lines instead of removing the line entirely. I don't think lua has anything like the C #line preprocessor directive to tweak source file line numbers.

I've reverted to 1.21.6 as 1.21.7 is quite useless for debugging lua hook scripts.

Finally, what's your policy for the SystemProperties hooks? Do you want to eventually drop them from xlua and rely on the yet-to-appear crowdsourced repository definitions for them? Or do you want a PR or patch for them?
[Xposed Framework Modules] M66B:
Stuttering could be quite annoying and fatal when for example playing a game, so pre compilation on app start seems the best solution to me.

I think the idea of empty line numbers is good. [MENTION=5297163]Fif_[/MENTION] implemented in version 1.21.8

I will add a few system property restrictions to XPrivacyLua (basically the short list I wrote down before). The rest could go into the hook definition repository. [MENTION=5297163]Fif_[/MENTION] implemented in version 1.21.8
[Xposed Framework Modules] dhnasa:
Is it possible to call a static java function from lua?
[Xposed Framework Modules] M66B:
Yes, this is possible. You will need to use luajava.bindClass to get a reference to the class and call a method like this:

class_reference:method_name(parameters)

Edit: I am curious what you're busy with.
[Xposed Framework Modules] shadowbone:
Can someone tell me how I could check if the BlockguardOs.open hook (restriction to public storage) v3, is functioning or not?

Perhaps using a file manager ?
[Xposed Framework Modules] Fif_:
Maybe, maybe not. If your file manager uses native libraries (like FX, my file manager of choice, does), then you won't see BlockGuardOs.open in action.

I'm seeing it working, for example games are not able to create files in the sdcard root anymore.

You may also want to apply the File.mkdir/mkdirs hooks if you also want to prevent apps from creating directories in shared locations too.
[Xposed Framework Modules] shadowbone:
Thanks..

And regarding mkdir hook, I wish I could. But unfortunately, that seems to crash the apps when a particular activity is initiated.
[Xposed Framework Modules] Fif_:
Please send me a logcat by PM.
[Xposed Framework Modules] shadowbone:
Apologies. But strangely enough I can't seem to reproduce the crashes, maybe because I had deleted the hook when it failed before. And only a few hours back I reinstalled it again. And up until now, no crashes have occurred.

So, sorry for the misinformation.
[Xposed Framework Modules] badabing2003:
[MENTION=5297163]Fif_[/MENTION] and [MENTION=2799345]M66B[/MENTION]

Do you guys have a better way of editing / coding the hook definitions on a computer?

My Process is:

1- Export from Pro app

2- Transfer to PC

3- Open the file in an editor (I use Notepad++)

4- Copy the code section under the Script to another editor windoe

5- Convert Regex \\n to \n

6- Make the necessary edits

7- Convert back Regex \n to \\n

8- Paste the new code back to code section in the definition file.

9- Save

10- Transfer to Phone

11- Import in Pro

Needless to say that small changes are all done on the phone, this one is for bigger changes that's challenging to do with fat fingers on a phone :)

Thanks

BB
[Xposed Framework Modules] Fif_:
I have some scripts that automate that process, I'll try post them later today.
[Xposed Framework Modules] M66B:
If you have a suggestion about how to improve this, please let me know.

I would suggest copy and paste the script from the companion app.
[Xposed Framework Modules] jawz101:
Could the app read them from flat files in a folder?
[Xposed Framework Modules] M66B:
Version 0.50 of the companion app can export/import Lua scripts.
[Xposed Framework Modules] Fif_:
Thanks, that works great.

I have been using the two attached scripts for extracting and reinjecting lua code and the description string.

They only require a decent version of busybox, with awk.

Download the scripts, rename them without the .txt extension and use them like this:

Export a json hook definition, eg. blah.json

Run: sh xlua-json-disassemble blah.json

This will create a .lua file per lua fragment in the file, and one .txt file per description in the file.

Edit the .lua and the .txt files as needed.

Run: sh xlua-json-reassemble blah.json

This will read the .lua and .txt file and rebuild the json file with the updated code and text.

They will work on json definitions containing multiple hooks and multiple code fragments. Both the old (luascript inline) and new (luascript @ reference) hook formats are supported.
[Xposed Framework Modules] badabing2003:
Thanks for sharing

Nicely done

BB
[Xposed Framework Modules] Rom:
Hello,

I am trying to write my first JSON file to works with the pro module of XPrivacyLua.

Globaly i want to change the default value of notification transparency.

I have decompiled my framework-res APK file, and i have point the right class with Android Device Manager:

class: android.widget.FrameLayout

I don't find this classname in the dedicated Android Developers website page:

https://developer.android.com/reference/android/service/notification/StatusBarNotification.html

I think that the dev of Resurection Remix had created a special classname in nougat source.

Also, i have dl the ZIP archive of nougat git branch and search for classnames in it, i get arround 190 matches for "android.service.notification.StatusBarNotification" and arround 500 hits for "android.widget.FrameLayout".

Of course i have read infos page from @M66B

https://github.com/M66B/XPrivacyLua/blob/master/DEFINE.md

My actual file:

{
"collection": "Interface";
"group": "android.service.notification",
"author": "Rom",
"description": "Changing the transparency of notifications background",
"className": "android.widget.FrameLayout",
"methodName": "",
"parameterTypes": [],
"returnType": "java.lang.String",
"minSdk": 1,
"maxSdk": 999,
"enabled": true,
"optional": false,
"usage": true,
"notify": false,
"settings": [
"",
""
],
"luaScript": ""
}

I don't have finish it i know, but i understand what i don't find the right classname, don't understand what i must write in "settings" too.

I think that when i will have setup 2-3 Lua script in JSON files i will be ready :cowboy:

https://xdaforums.com/member.php?u=2799345Thanks in advance for help:good:
[Xposed Framework Modules] M66B:
This is not going to work because it requires hooking into Android which isn't supported by XPrivacyLua.
[Xposed Framework Modules] Rom:
Ok so how can i find them ?
[Xposed Framework Modules] M66B:
I am not sure what you are looking for, maybe this?

https://developer.android.com/reference/android/widget/FrameLayout.html

https://developer.android.com/reference/android/service/notification/StatusBarNotification.html
[Xposed Framework Modules] Rom:
No for the first, and i have read the second yeah, so i must have two Lua scripts ? One for the first classname and a second for the second classname :confused:

I'm a bit confused...
[Xposed Framework Modules] M66B:
Yes, I think you are because I already said it will not going to work ;)