yashsingh1/xdaforums huggingface dataset:
[Xposed Framework Modules] dorkserv81:
Hello sir,

it's me again, in the end i have managed to sort out and learn how to sort most of the problems, a quick question if anyone can help me out. In settings of the phone with the build option in tracking i have managed to change my phone name and model etc. There is any hook outhere to change the default mac of the phone after and not restrict it or faking it with getwifimac ?. I dont know if i explain myself. for example on build model if i change the name of the phone model directly in pro app companion replacing unknown it gives that value to the phone directly. I would like to know if there is any build for the mac address same as for the model of the phone.

thank you all for your help.
[Xposed Framework Modules] M66B:
There is a hook definition in the repository to change the WiFi MAC address. The MAC address is not a build properties because there are several of them. For example the Bluetooth adapter has a MAC address too.
[Xposed Framework Modules] M66B:
I am planning to close this thread because almost nobody except for [MENTION=5297163]Fif_[/MENTION] contributed new hook definitions to the repository. Also, most people coming to ask here don't seem to succeed with what they wanted anyway.

Are there any objections to this?
[Xposed Framework Modules] mark_at:
But it seems there are always new questions about hook definitions. There would be no place to ask then ...
[Xposed Framework Modules] M66B:
The answers seems to lead nowhere, so what is the point?
[Xposed Framework Modules] mark_at:
Well. For me hooks were never a topic, I am too much amateur for it.

But it seems for some it is ... so I guess they need some place to ask. And also Fif can help or give information.

Maybe ask him ... he contributes a lot.
[Xposed Framework Modules] M66B:
If you check here, you'll see that [MENTION=5297163]Fif_[/MENTION] is about the only one who contributed custom hook definitions. I trust that [MENTION=5297163]Fif_[/MENTION] doesn't need this thread because he knows what he is doing.

To be clear: I want to stop supporting custom hook definitions because in a most cases it has appeared to be a waste of time.
[Xposed Framework Modules] TiTiB:
There is still the 'main' XPL thread. So...idk how much this thread would be missed.
[Xposed Framework Modules] M66B:
This thread is closed.

If you have questions about XPrivacyLua, please go here:

https://xdaforums.com/xposed/modules/xprivacylua6-0-android-privacy-manager-t3730663

Custom hook definitions will always be part of XPrivacyLua, but there will be community support only. This means that I won't respond to questions about defining custom hooks anymore. See some comments back for the reasons.
[Xposed Framework Modules] mnjm9b:
thank you...that helped A LOT.

any Ideas on how to hook abstract class??
[Xposed Framework Modules] M66B:
Abstract classes and methods cannot be hooked. See them as a kind of templates without text. So, you will have to find the derived class, with the text filled in.

Which class are you looking at?
[Xposed Framework Modules] mnjm9b:
android.webkit.WebSettings.UserAgentString
[Xposed Framework Modules] M66B:
This method returns an instance of WebSettings:

https://developer.android.com/reference/android/webkit/WebView.html#getSettings()

In a hook after you can try to manipulate the user agent string, but there is no public method to set it. The other problem is that the web view can be handled by a browser, so even if you find a way to set the user agent string, it will be browser dependent. Also, the user may switch from the web view to the browser. So, you'll need to hook the browser user agent too.

tl;dr; find a browser where you can select/set a user agent string.
[Xposed Framework Modules] Rom:
I am currently learning Lua docs, but about XPrivacyLua usage for that, i don't understand where i can make tests by applying any Lua command, it is an in-app feature or i must create a specific file contained the Lua command(s) in a specifiq folder ?
[Xposed Framework Modules] M66B:
In the XPrivacyLua companion app you can edit definitions. You can add a new one or modify an existing one.

https://play.google.com/apps/testing/eu.faircode.xlua.pro
[Xposed Framework Modules] Rom:
I already started to participate in your BETA test program, but i had not fully explored it, it's found now.

And indeed it is, how could i say...quite impressive!

So in this section "Definitions", i see rules already established with your GPL licenses, so let's assume if we take a very simple example: if i want to create a new rule with a command in Lua language that will prohibit all access to SMS, it will only apply to one default application or to all user and system applications?
[Xposed Framework Modules] M66B:
You'll need to apply it to the apps you want to prevent access to SMSes, since any app can read SMSes with the right permissions.

BTW, there is already a hook to prevent access to SMSes.
[Xposed Framework Modules] Rom:
Agree understood, so for what is:

"Collections", i guess it's a predefined category,

Concerning the category "Group", i don't quite see what this corresponds to and what it allows to define.

The category "Name" as its name should indicate it should define a name rather short and sufficiently speaking for the user having set it up.

The category "Autheur" designates the pseudo of the script author.

It follows the boxes to check / uncheck to enable/disable.

Put in "Optional" (what is this for?)

Usage (what is this for?)

"Notify" which I suppose is used to create a Toast notification to each execution of the rule in question?

It follows the "Class", which I suppose corresponds to the targeted class JAVA.

Then "Method" (what is this?)

Then "Return type" which I suppose is the value returned anyway, is this good?

For "min SDK" and "Max SDK" this is to refer to the supported Android version (s).

"Exclude packages" should refer to the names of the application packets for which the rule in question will be ignored and finally the Lua script to execute.

Apart from the cases where i don't see what it will serve, i understood everything?

If i take another example now, let's say i want to apply a Lua rule through your application for my system application that will redirect the default save path for Bluetooth files transfert.

So i should create a new rule among the existing ones in which i should find the JAVA class used by decompiling my apk in my phone, rewrite word by word the method used, indicate a recognizable name, indicate my username, indicate the state of the hook , the name of the class to which the rule should apply, the method (idk what it is), etc etc, thats it ?

Sorry for all these questions that may seem very simple, but i am not a great talent with the JAVA language and the possibilities of your applications seem extremely advanced!
[Xposed Framework Modules] Namnodorel:
That stuff is all covered in DEFINE.md in the XPL GitHub repo :D
[Xposed Framework Modules] M66B:
Most is right on spot.

For a better understanding, look at the hook with the name 'Privacy.WifiInfo.getSSID' in the companion app. Scroll down to get to the Lua script. Also look at the WifiInfo documentation here and I guess you will be able to put most things together: https://developer.android.com/reference/android/net/wifi/WifiInfo.html

This is one of the hooks which will be applied in XPrivacyLua as part of the 'Read network data' restriction (which corresponds to group in the definition).
[Xposed Framework Modules] mnjm9b:
I am more interested in blocking ANY app from accessing "fingerprinting" type info...

not just browsers.

I'll try and come up with something and then post what I have after it doesn't work.
[Xposed Framework Modules] Rom:
Thanks for your informations.

I'm going to immerse myself in it, but would it be possible to modify your Pro app by declaring the application in the XPosed installer?

I ask this question because, from what i've seen so far, i was able to view the list of already existing hooks only via the Pro app, so XPrivacyLua is only used to fine-tune the permissions allowed or put on hold or rejected through XPosed.

But for users like me for example who do not necessarily need the main XPrivacyLua app, would it be possible for you to separate it from the Pro version? :)
[Xposed Framework Modules] M66B:
That is not possible because XPrivacyLua does execute the definitions.
[Xposed Framework Modules] Rom:
Ok, so an option to enabling all access by default for all apps already exist ?

I ask because i didn't see that for now.
[Xposed Framework Modules] M66B:
You can select a group top left in XPrivacyLua and use the button top right to batch apply the group.
[Xposed Framework Modules] Rom:
I decided to grant(tune) all the accesses to all the applications installed(settled) on my phone, but before making that i had make i did exactly the opposite and restarted my phone, which had the effect of overwriting some of my permissions set in the application settings, as what the error is paid cash!
[Xposed Framework Modules] M66B:
I am sorry, but I do not understand what you are asking or what the problem is.
[Xposed Framework Modules] Rom:
I said that the fact of having at first every togglled in XPrivacyLua, then to restart my telephone had for impact of deleting most of permissions set in lot of my apps.

These permissions settings being accessible via the menu of the settings in my custom ROM, i had to setup all of them manually again.

I completely deactivated XPrivacyLua in XPosed Installer for the moment, the time to take a moment to learn the Lua language and to look in parallel for the source which i wish to modify (and especially the framework-res apk file who managing the functions for the Bluetooth on my ROM).
[Xposed Framework Modules] M66B:
That is likely being caused by applying the account restriction to all apps. You should not apply the built-in restrictions blindly, but only your own definition.
[Xposed Framework Modules] M66B:
The documentation about defining hooks has been improved:

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

Thanks [MENTION=4775688]GermainZ[/MENTION] for the suggestions and reviewing.
[Xposed Framework Modules] jawz101:
Thanks [MENTION=4775688]GermainZ[/MENTION]!

Do you guys think it would ever be possible to observe method calls on-device as they occur? I guess I'm having trouble thinking about what new things could be done that haven't been done before. The apps that get me the most excited are ones that tell me what is happening on my phone at that moment.

The logging in the companion app is nice but I'm wondering if it's possible to know what is passed through to see what I can change. Can method calls and values be observed without rules to know what to look for? I didn't know if rules are just necessary to change something.
[Xposed Framework Modules] Namnodorel:
[MENTION=1813256]jawz101[/MENTION] Yes, that's possible (at least technically) but atm you'd have to make these changes to all restricitons yourself and make a new collection of that.
[Xposed Framework Modules] M66B:
You can just call the notification manager in a Lua script to show a notification in the status bar.

See here for the Android documentation about notifications:

https://developer.android.com/guide/topics/ui/notifiers/notifications.html
[Xposed Framework Modules] jawz101:
Thanks [MENTION=4775688]GermainZ[/MENTION]! It's great to see some interest from other devs!

Do you guys think it would ever be possible to observe method calls on-device as they occur? I guess I'm having trouble thinking about what new things could be done that haven't been done before. The apps that get me the most excited are ones that tell me what is happening on my phone at that moment.

The logging in the companion app is nice but I'm wondering if it's possible to know what is passed through to see what I can change. Can method calls and values be observed without rules to know what to look for? I didn't know if rules are just necessary to change something.

Like of I could hit a record button, click around in an app, hit pause, see what's collected, pick something interesting to change, and then have a rule generate to meet that requirement.
[Xposed Framework Modules] M66B:
You can only monitor things that have been hooked.
[Xposed Framework Modules] jawz101:
Ah thanks.
[Xposed Framework Modules] Namnodorel:
Do you know how much of a performance impact hooks usually have? If it's not much, XPL could hook everything by default, but only restrict when the restriction is enabled.
[Xposed Framework Modules] M66B:
The performance impact is not big, a few milliseconds per call, assuming an high end device. Nevertheless I don't want to hook everything by default because there will be really a lot of calls. There are already more than 100 hooks and some hooks will be executed quite often. Also, quite some apps can be active at the same time in the background. Another reason is that an error in one hook can bring the whole system down.

Edit: there is another reason that is even more important: when always hooking, each hook execution should check if the restriction is applied to the app or not. XPrivacy did that by using a system service and heavy caching. Using a service is not possible on Android Oreo anymore, so I had to hook into the system settings provider to make settings available in an app (for which I had to rewrite a big part of the core code). However, getting data from a content provider is much slower than getting data from a system service. So, the performance impact would be huge and likely unacceptable.
[Xposed Framework Modules] mnjm9b:
so I know i'm beating a dead horse here but I just had an issue that disturbs me.

while I don't have gapps installed on my phone, I do have a gmail account. I recently wiped my device and for the first time installed nougat without xprivacy and only used xprivacylua.

I use only browsers that allow to change User Agent. However, yesterday I had to sign into my gmail account and moments later I received an email from google welcoming me to my new Device and proceeding to tell me about my device.

I have had this device for over two years and have signed into gmail several thousand times while using xprivacy with NO indication that it knew my device.

I understand that you don't care to address User Agent hooks but this really sucks.

can you point me to the code that spoofed User Agent in xprivacy so I can better attempt to create a custom restriction in xprivacylua.

I assume there are many differences on how to port the xprivacy code to lua but I just can't figure it out myself.
[Xposed Framework Modules] M66B:
See here:

https://github.com/M66B/XPrivacy/blob/master/src/biz/bokhorst/xprivacy/XWebSettings.java

https://github.com/M66B/XPrivacy/blob/master/src/biz/bokhorst/xprivacy/XWebView.java
[Xposed Framework Modules] M66B:
Version 1.13 of XPrivacyLua and version 0.29 of the companion app support defining hooks for constructors and dynamic hooking in Lua scripts.

See here for an example of dynamic hooking:

https://github.com/M66B/XPrivacyLua/blob/master/app/src/main/assets/webview_constructor.lua
[Xposed Framework Modules] mnjm9b:
Wow...that's not at all how I was doing it...lol

Thank you, I would have NEVER figured that out.
[Xposed Framework Modules] jawz101:
Has anyone actually made a new definition? Care to share your learning process?

I think it's telling when no one really knows what to do with this.
[Xposed Framework Modules] M66B:
Yes, some people did.

All the documentation is here:

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

There are some examples and you can take a look at the built-in definitions as well.

If you have questions or need help, that is what this thread is for ...
[Xposed Framework Modules] jawz101:
Ok well let's say I want to figure out how to block mixpanel.

https://mixpanel.com/help/reference/android

First, I'll create a new definition

Collection: Privacy (because I want to still use your collection)

Group: Analytics (or anything really)

Name: Mixpanel (again, can be called anything)

Author: jawz101

Description: this is an Analytics company

The documentation says an app needs to import their class into an activity.

So

Class: com.mixpanel.android.mpmetrics.MixpanelAPI

... At this point I don't know what else to do.

Like, is there a way to simply cripple whatever it is they want?
[Xposed Framework Modules] M66B:
You'll need to find a method to block or to return fake data for. For this you'll need to read the documentation of the Mixpanel API.

As an example you can look at the built in analytics definitions.

Edit: you'll likely want to hook all variants of the 'track' method.
[Xposed Framework Modules] Still_living714:
I agree, this is too complicated for "normal" users. Just a thought but maybe a YouTube video will help many users and then more people will try their own hooks..
[Xposed Framework Modules] M66B:
I don't understand your "+1".

Defining hooks is properly documented here and I have said I will answer any question you're having. Did you even try?

-1
[Xposed Framework Modules] Still_living714:
I don't want to bombard this thread will question after question. I was merely giving my opinion since it seems no one really gets it or has tried..
[Xposed Framework Modules] M66B:
I can tell you that at least one experienced Xposed developer has tried to define a few hooks with success, but I don't think that does matter much, because each and every XPrivacyLua restriction is defined, proving that defining hooks works properly. It saved me really a lot of development time, maybe as much as 80%.

This thread is for questions and only asking questions can make you wiser.

If you have no development experience at all, this might just not be for you though.
[Xposed Framework Modules] M66B:
[MENTION=1813256]jawz101[/MENTION] because of this shocking article I looked into the Mixpanel API. Since apps using Mixpanel can send data without using a library, it is better to block Mixpanel using a firewall app. The default block list of NetGuard contains the Mixpanel domain name.
[Xposed Framework Modules] badabing2003:
Thanks Marcel,

Would you be kind enough to share the block rules / addresses so that AFWall+ users can achieve the same?

Thanks

BB
[Xposed Framework Modules] jawz101:
Yeah, StevenBlack's host file kinda sucks for mobile domains. I've been running Adaway, NetGuard, pfBockerNG on a pfSense firewall, and have been collecting domains from my phone for a couple of years at least. I've tried submitting extra domains to the Adaway host file - one of StevenBlack's sources- Schurman put it in and then pulled it because I'd accidentally included goo.gl. After that I made fixes to the list and that's what's in that pull request but it's sat there for a year or so not committed. In the end I just use my own list for NetGuard because it's actual unwanted mobile traffic. Most "typical" host files are targeted towards desktop traffic.

I've been trying to find a data set of domain names and IP's that have been found in apk files, remove the legit domains, then run them through this subdomain gathering tool. Then I'd make a killer mobile adblock list.
[Xposed Framework Modules] M66B:
api.mixpanel.com
[Xposed Framework Modules] M66B:
It is really simple to define new hooks. As another example I have added hooks to prevent tracking by the Mixpanel library:

https://github.com/M66B/XPrivacyLua/commit/3aadf9a3521f44dd84e43c45711fba5c368960de

This will be in the next release of XPrivacyLua, but you can import the definitions right now if you want, see attachment.

View attachment Mixpanel.json.txt
[Xposed Framework Modules] badabing2003:
Thank you,

Easy for you to say ;)

I will read up the docs and see if I can do another analytics one by myself, using this and other definitions as an example.

Be prepared for noob questions.

Thanks

BB
[Xposed Framework Modules] M66B:
What you can do to learn is try to understand all the fields in the first Mixpanel hook by looking into the Mixpanel Android API description. Once you understand all fields, you'll be able to define similar hooks. I am happy to explain things if you cannot figure it out. Just ask here.

Edit: Mixpanel Android API:

https://mixpanel.com/help/reference/android

http://mixpanel.github.io/mixpanel-android/index.html
[Xposed Framework Modules] badabing2003:
Thanks Marcel.

I imported the above attachment of mixpanel into the companion app, it is enabled, but in the XPrivacyLua I'm not seeing it, I'm expecting my red use analytics to turn grey, I even refreshed.

Did I need reboot or kill XPrivacyLua?

Thanks for links and the tip.

BB
[Xposed Framework Modules] M66B:
Refreshing (pull down) or restarting XPrivacyLua should be enough.

Edit: [MENTION=4851555]badabing2003[/MENTION] the next version of XPrivacyLua will have a better check for hook changes. For now you need to stop the XPrivacyLua user interface (for example using the recents screen) and start it again to have the hooks updated.
[Xposed Framework Modules] badabing2003:
It wasn't, and I might have encountered another issue as well.

After reboot, It was visible in XprivacyLua

So I filtered by Use Analytics and as expected all entries were gray (including system, as I apply this restriction to everything)

I needed to turn the gray into red, but the way it is Restrict button being a toggle, it's a two step process,

First Toggle resets everything to clear and kills the apps (the ones that have the kill flag enabled)

Second Toggle applies restriction and kills the apps (again)

Is there a problem in doing this in quick succession?

I did that because I didn't want the killed apps when they restarted (some do automatically) to briefly have a chance to gather analytics.

Perhaps if you turn the Restrict Toggle into two action or two buttons, Clear and Restrict (separately) then adding restrictions can be done in one step.

In any case, the main problem I'm encountering after doing the above is that I'm not seeing any logs indicating that Use Analytics is being restricted.

I even set notify option on all MixPanel entries, launched couple of apps that I knew they used MixPanel, and I don't see any notification nor do I see any logs.

In XprivacyLue, all Use analytics restrictions are checked red.

Is it possible that the import of MixPanel restriction broke something and all of Use analytics is not working?

Thanks

BB
[Xposed Framework Modules] M66B:
Force stopping a second time will do nothing if the app is still stopped (which will be the case, unless you started it yourself).

I don't think something broke and I do think the Mixpanel hooks work.

Which apps are you restricting Mixpanel for? (I will check the hooks)
[Xposed Framework Modules] badabing2003:
Some do start automatically no?

Slack is the only one that displays a notification (I've enabled notification)

It uses MixpanelAPI.track/json

All of these do nothing.

Coinbase

Dolphin

LastPass

MagicJack

StoCard

Trucker Path

Truckloads

Figuring out which ones to block out of the entire set is the tough part.

For example I would have thought that flush() and flushNoDecideCheck() methods should be blocked.

Also looking here

http://mixpanel.github.io/mixpanel-...l#track-java.lang.String-org.json.JSONObject-

I only see track with two signatures and was wondering where you got the third one "parameterTypes": ["java.lang.String", "org.json.JSONObject", "boolean"]

I searched for keyword track and eventually found it somewhere, makes me appreciate even more all the digging you have done and still do to get all these hooks.

Thank you

BB

Edit.

I tried adding flush() and flushNoDecideCheck() but it didn't make a difference :(
[Xposed Framework Modules] M66B:
You'll never know if there is an auto flush, so I prefer to prevent tracking at the root by hooking the track methods.

I have checked Coinbase and Lastpass apps.

Coinbase contains the library, but doesn't seem to use it. Lastpass contains the library, but the code is obfuscated, so the track methods cannot be found to be hooked because they are renamed to something else. The latter is something which is difficult to counter.

Edit: how did I check and how can you check? By checking the XPrivacyLua logcat:

adb logcat | grep -i xlua