yashsingh1/xdaforums huggingface dataset:
[Xposed Framework Modules] M66B:
This hook definition doesn't use a custom value, but a fixed value 'unknown'.

See the documentation about how to use the custom values:

https://github.com/M66B/XPrivacyLua/blob/master/DEFINE.md
[Xposed Framework Modules] amakuramio:
local fake = 'bigboss'

param:getSetting('manufacture')

return true, result, fake

end

No work :(
[Xposed Framework Modules] M66B:
Try this:

fake = param:getSetting('manufacture')
[Xposed Framework Modules] amakuramio:
local fake = param:getSetting('manufacture')

return true, result, fake

end

Still says unknown... haha, thanks for your patience anyway
[Xposed Framework Modules] M66B:
Did you spell the custom value name correctly? It needs to match the same name in the definition.

Did you restart (force stop) the app?
[Xposed Framework Modules] mhdasif899:
Change the unknown with your desired value in script instead of adding setting name, it works for me
[Xposed Framework Modules] amakuramio:
Now it works haha

Great! But editing all the lua one by one... (´・ω・｀)

And in old xpriv we could see if one app used ipc, is it possible on xpl too?
[Xposed Framework Modules] M66B:
If you write a hook definition for it, but I think that is beyond your capabilities (no offence meant).
[Xposed Framework Modules] amakuramio:
IPC.bindservice

Or Iservicemanager?

ipcMessenger.service.MessengerService

function after(hook, param)

local list = param:getResult()

if list == nil then

return false

end

local filtered = false

local name = hook:getName()

local cuid = param:getUid()

end

return filtered

end

function before(hook, param)

param:setResult(nil)

return true

end

Never mind, if you cannot do, I doubt I will be able to

Your xprivacy project couldn't be fixed for newer versions even though it was open sourced xD
[Xposed Framework Modules] Tomek0000:
My experience of keeping device with android vital is analysing rights of all installed apps. There are 3 parameters decided of it : AUTO START, DO NOT SLEEP and WAKE UP.

If user will install new apps and do not check all three parameters, he will lost memory for keeping not needed code in it. Of course the parameters have sense for XPL, but have absolutely no sense for fe. games. The game should only be alive when the user run it. If it is not used, game should not be active. My device has Privacy(CM/Lineage) section in the android's option where I can set all 3 parameters, but it is possible only manual and I can not select anly applicatin new installed. Setting it is not easy and quick. It is possible, the other android distributtions do not let to change wrote about parameters.

This thread read people, who are able to write new restrictions for XPL. Please use my message as possible idea to write new restriction(s), if it is possible. The best result to see with using new restrictions be to have AUTO START set to false, DO NOT SLEEP set to false, WAKE UP set to false for each new installed application.

This is not connected to privacy.
[Xposed Framework Modules] jawz101:
edited
[Xposed Framework Modules] Fif_:
Probably, but you'd have to code it yourself and it may be against XDA rules to even talk about this.[emoji850]
[Xposed Framework Modules] jawz101:
Ugh. Rules
[Xposed Framework Modules] M66B:
Yes, rules, and there are rules for a reason.

See also the start post of this thread and besides that you explicitly agreed to use XPrivacyLua to protect your privacy only on first run. So, you are not only violating XDA rules.

Some parties are not particular happy with things like XPrivacyLua and could put effort into taking down XPrivacyLua. If you don't want that, please refrain from discussing about non privacy related stuff here and anywhere else.
[Xposed Framework Modules] gothicVI:
That is why we can't have nice things.

Rethink your ethics!

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Xposed Framework Modules] jawz101:
Get off your high horse. I don't need a speech.

Even going through the process of looking at anything besides just privacy junk may yield other creative uses. Activate undocumented beta features in apps, developer modes, who knows?
[Xposed Framework Modules] gothicVI:
Don't behave like a child who needs one then...
[Xposed Framework Modules] M66B:
Didn't I ask to stop with discussing about anything else than privacy? So, why are you continuing and ignoring this?
[Xposed Framework Modules] jawz101:
I didn't really continue to talk about it and you do say in the op

I'll delete my original suggestion but the whole point of this thread was to discuss anything else besides privacy.
[Xposed Framework Modules] M66B:
You are right that this XDA thread has a broader scope, but the scope doesn't include illegal things in any case.
[Xposed Framework Modules] jawz101:
You're right. I just wanted to bring up something different without someone questioning my ethics. Besides, playing with pretend points bought at the price of PII doesn't really feel illegal. I mean, giving a 3rd party fake data with XPL in the first place is just as unethical.

"Download this other game for 5 hours made by another company with its own 15 trackers- provide your email, age, gender, and location and we'll give you 30 credits in our game." How does that feel like fair compensation?
[Xposed Framework Modules] M66B:
XPrivacyLua is needed because your data is used in unethical ways, often without your permission or knowledge. IMHO that doesn't make XPrivacyLua unethical.

Edit: not to forget: without giving you a choice.
[Xposed Framework Modules] jawz101:
I agree. Personally I'll gladly pay for an app with money but not with time and personal information. If that's they're currency, however, meh... The main thing is that product's currency is your time and PII.
[Xposed Framework Modules] dhnasa:
how can I hook a method with a non primitv array as a parameter
[Xposed Framework Modules] M66B:
By specifying java.lang.reflect.Array as parameter type. Some built-in hook definitions can be used as example for this.
[Xposed Framework Modules] dhnasa:
how can I hook this method

protected T doInBackground(RequestParams... params)

the class is

public class WebServiceClient<T extends WebServiceResult> extends AsyncTask<RequestParams, Void, T>
[Xposed Framework Modules] M66B:
You can leave the return type out to accept any return type.

You can define RequestParams as Array.

You'll have to figure out the name space of WebServiceClient.
[Xposed Framework Modules] halcyon1234:
I'm going to attempt to write my first hook, but I could use some guidance. Not sure which class / method I should be hooking into.

Scenario: I want to create a hook so that when an app asks for the system date, it will always get a value defined by my hook.

The use case is: I have the Swype keyboard. But Nuance discontinued it. I would gladly GLADLY pay full price to get this app, but there is literally no way to buy it anymore. So I want to lie when the trial version asks what date it is. I don't know if this will for sure trick it into thinking the trial isn't over, but it's worth a shot. (Otherwise I have to keep wiping the data for the keyboard every 30 days).

PS: If anyone from Nuance happens to be reading this, I know you aren't developing or supporting the app anymore, but please please please just put a "final" version back up for sale.
[Xposed Framework Modules] M66B:
From the opening post: "This XDA thread is meant to discuss defining hooks, with the restriction that hook definitions must serve a legally allowed purpose. This XDA thread is not meant to make you a developer, so at least some development experience is expected, which means that you'll need to be able to figure out where to hook yourself and that you'll need to be able to write Lua scripts yourself."
[Xposed Framework Modules] M66B:
Some people have been trying to upload custom hook definitions with the author name set to someone else. This is not allowed and will not be accepted by the repository server. You'll need to use your own, unique author name. This is to prevent impersonation. This also means you cannot update custom hook definitions of someone else. If you think a custom hook definition of someone else can be improved, please get in touch with the author.
[Xposed Framework Modules] PeterMayers08:
In Case it won't work maybe you could try restoring app with Titanium Backup when trial expires. Other options that would work would include Tools banned in this Board ?. Either way, none is in accordance with the eula
[Xposed Framework Modules] daniel_m:
Would it be possible to make a hook for XPL that prevents root apps from remounting \system rw?

I am not talking about malicious apps, but regular ones that require root to work, but that don't tell the user that they will have to remount \system to do their work ... and in the process break the possibility to update Android via an OTA.
[Xposed Framework Modules] M66B:
Root apps can do whatever they like and Xposed hooks cannot really prevent that.
[Xposed Framework Modules] daniel_m:
Damn it!

Hm, I think I remember from XPrivacy that it did restrict some root apps ... but not others ... which would render a corresponding hook useless :crying:

Edit (off-topic): Can I find out if \system has been remounted? Like a flag that is set in the partition header?
[Xposed Framework Modules] Namnodorel:
I just encountered a problem with a custom hook: For debugging purposes, I wanted a quick custom hook that would notify me whenever an app called System.loadLibrary(). The hook did nothing, just returned true in before of the Lua script.

However when using this hook, when an app tries to load a native lib, it will crash with the Exception "Shared lib '/system/lib/libxy.so' already opened by ClassLoader 0x0, can't open in [some other memory allocation thingy].

This only happens when the hook is applied. But because the hook is supposed to literally do nothing apart from notifying me, I believe this is unintended behavior.
[Xposed Framework Modules] M66B:
XPrivacyLua doesn't load native libraries, so something else is going on.
[Xposed Framework Modules] Namnodorel:
Soo some kind of Xposed bug I guess? I don't know anything else that could interfere and getd triggered by a hook.
[Xposed Framework Modules] M66B:
I can only think of some concurrency issue.
[Xposed Framework Modules] Namnodorel:
And as we all know, those are very fun to resolve >.<

On a related note, can I use "exclude packages" to have XPL not hook system APIs called by an app? What I actually care about are the libraries the app tries to load itself, in the stacktrace of the exception I'm getting it's shown that the app calls android.media, which then tries to load a native lib. Maybe the problem wouldn't happen if I could jist target specific packages from where loadLibrary is called.
[Xposed Framework Modules] M66B:
Excluded packages is a regex, which can be "negative", so this is possible. There are examples of this in the hook repository.
[Xposed Framework Modules] Namnodorel:
I tried the regex android\.media\..+ to exclude the android.media package, but it still gets hooked with this stacktrace:

at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:361)
at java.lang.System.loadLibrary(<Xposed>)
at android.media.CamcorderProfile.<clinit>(CamcorderProfile.java:465)
at android.media.CamcorderProfile.hasProfile(Unknown Source:0)
at the.app.i.actually.want.to.debug

Are you sure it also works for packages the app calls and not just the app base package?
[Xposed Framework Modules] M66B:
Excluded packages are checked before hooking an app only. I am not sure what you mean by "calls" because calling has nothing to do with hooking. All apps are evaluated individually.
[Xposed Framework Modules] Namnodorel:
Well, then excluded packages does not do what I need :/ I don't need it to not work on some apps, I need it to work only when a class in a specified package calls the method. Right now, the app I want to test calls an Android API, and that API (android.media) then calls loadLibrary(). I don't care about that. I care only about when a class within the app package uses loadLibrary().
[Xposed Framework Modules] M66B:
You'll need to check the parameters of loadLibrary for this.
[Xposed Framework Modules] jallenhayslett:
[MENTION=5297163]Fif_[/MENTION]

I'm trying to get your BlockGuardOS.open, File.mkdir, and File.mkdirs setup for use with WeChat so that it only has access to it's /sdcard/tencent/ folder (as well as it's own standard protected folders).

Reason's being, if you're not already aware, WeChat, as well as many other Chinese developed apps, are notorious for littering the sdcard with garbage logs and cached ad images. If I can get this working for WeChat, then I'll eventually apply the same restrictions for any of the other Chinese apps I'm forced to use.

I managed to add the directory to the BlockGuardOs.open whitelist, but I can't find a similar section for the mkdir and mkdirs hooks.

Can you help point me in the right direction?
[Xposed Framework Modules] Fif_:
Hi, thank you for your interest in my hooks.

You were able to whitelist some paths in BlockGuardOS.open but not File.mkdir(s)? It's the same, just find the array called prefixes and add your paths there.

This is the stock declaration:

local prefixes = {
'/data/data/' .. packageName,
ai.dataDir,
luajava.new(clsFile, ai.sourceDir):getParent(),
}

If you want to whitelist /sdcard/tencent, change it to:

local prefixes = {
'/data/data/' .. packageName,
ai.dataDir,
luajava.new(clsFile, ai.sourceDir):getParent(),
'/sdcard/tencent'
}

The problem is that the /sdcard path is aliased and symlinked to at many locations in the filesystem (/storage/emulated/0, /data/media/0 and other places), and you don't know which path the app will use to access the file.

Some apps use different paths to access the same file in different sections of their code...

If there's many takers I may add a custom preference to the hooks.
[Xposed Framework Modules] jallenhayslett:
Could the solution to that problem be just a matter of using the absolute path name since that's what all symlinks ultimately point to?

Edit, problem solved.

I just added all three common paths (data, storage, sdcard). Seems to have fixed the problem. Shouldn't cause any issues since they all three point to the same location anyway.

Edit again, spoke too soon.

It seems that regardless of my whitelist entries, mkdir(s) are both too restrictive and won't allow WeChat to write files in it's own white listed directory, and BlockGuard isn't blocking folder creation, but is blocking outside file creation but leaving whitelisted directories alone.

See if you notice anything wrong with my whitelists. One is Block guard, the other is identical for mkdir(s)

Also, if I can get one working, is it necessary to use all three hooks? The descriptions seem nearly identical.
[Xposed Framework Modules] Fif_:
Did you check the casing? All these checks are case-sensitive... The XPL Pro log will tell you which files are being denied access.
[Xposed Framework Modules] jallenhayslett:
Well, I started off by deleting the offending external directories, that way I'd know what happened, if anything. After that, I applied the hooks individually to see how'd they'd handle, and checked the log each time.

When BlockGuard was enabled, all access to the specified whitelisted directory was proper, read and write. The offending external folder was still created, however it failed to write a file to it.

When either mkdir was enabled, no external folders we're created, but read access to the whitelisted folder was blocked. Only read access was available. I thought this was strange since I could still send and receive messages and voice notes, and I was trying to send photos/documents, so I whitelisted the corresponding photo/document folder, but that had no effect. It failed to send every time.

At this rate, it seems that it would be easier to troubleshoot the BlockGuard issue, as it's only problem is that it's still writing folders where it shouldn't but is properly blocking the file write operation.
[Xposed Framework Modules] Fif_:
Both BlockGuardOS.open and File.mkdir(s) send extra logging to the logcat. Can you capture the logcat?
[Xposed Framework Modules] Fif_:
[MENTION=2799345]M66B[/MENTION], is there any reason why bit operations do not seem to be included in the lua version shipped with XPL?

I'm trying to hook methods that use bit mask flags and manipulating these with arithmetic, while doable, is painful.
[Xposed Framework Modules] M66B:
The bit32 library is included in LuaJ:

http://www.luaj.org/luaj/3.0/README.html#Libraries

If I remember me correctly, there is a built-in hook using this.

Note that LuaJ is based on Lua 5.2.
[Xposed Framework Modules] Fif_:
Thanks. I've uploaded two new hooks to the repo to manage broken proximity sensors that used bit operations.
[Xposed Framework Modules] M66B:
Don't be shy, just link them ;)

https://lua.xprivacy.eu/repo/view?id=88

https://lua.xprivacy.eu/repo/view?id=89
[Xposed Framework Modules] mhdasif899:
Hi Fif_, How can i set custom setting for each of the following in (get tracking section) for each app? Like, board, bootloader, brand,display, manufacturer, product, model etc
[Xposed Framework Modules] Fif_:
You want to change the values returned by Build.BOARD, Build.BOOTLOADER, and other Build.* variables to be different for different apps, instead of returning "Private"? (Why?)

You're going to have to write them yourselves, none of the hooks I'm aware of does that. But it should be really straightforward to do so.
[Xposed Framework Modules] jallenhayslett:
Sorry to leave you hanging like that. Haven't had much time this past week. Hopefully I can mess with it later this week and pull a logcat for you.
[Xposed Framework Modules] Fif_:
Life happens, no worries.

I was thinking of updating the BlockGuardOS.open and File.mkdir(s) hooks with support for custom SD card paths, if there's any popular demand (besides you).
[Xposed Framework Modules] Fif_:
Overloaded methods in java and integral types

Hi [MENTION=2799345]M66B[/MENTION],

I was hacking on a hook to hide battery levels.

I do so by hooking Intent.createFromParcel (like other stock hooks) and that's all working fine.

But, in the hook, I have to modify int intent extras, and it's not working as expected.

Consider this code:

-- intent is a android.content.Intent
intent:putExtra('bob', 5)
log(intent:getIntExtra('bob', 1))

It will log the value 1 to logcat, as if there was no int labeled 'bob' in the extras, instead of the expected value 5.

I suspect the wrong overloaded method Intent.putExtra(String, char) is picked instead of Intent.putExtra(String, int).

My question is: how can I force lua to use a certain overloaded method?

I've tried:

intent:putExtra('bob', math.floor(5))

intent:putExtra('bob', luajava.newInstance('java.lang.Integer', 1))

But neither of these work.

In the end, I've worked around the issue by doing:

local bundle = intent:getExtras()
bundle:putInt('bob', 5)
intent:replaceExtras(bundle)

As Bundle does not use overloading but different method names for different types, I can do what I want, but it's still heavier (copies of the Bundle are made).
[Xposed Framework Modules] M66B:
LuaJ is guessing which method is being meant, but is apparently not very good at it. I have made some changes in LuaJ before, but I won't this time because there is a risk that changes will result in other hooks not working correct anymore.

LuaJ gets methods here:

https://github.com/M66B/XPrivacyLua...java/org/luaj/vm2/lib/jse/JavaClass.java#L108
[Xposed Framework Modules] Fif_:
That's just the code that prepares a mapping from method name to a callable method object for a given object. When a method is overloaded, then a special callable object is constructed (JavaConstructor.forConstructors and JavaMethod.forMethods) that captures all the possible methods and defers picking which until the arguments are available.

I assume you're the one who disabled the checks for public methods with "true or" in the code you referred to.

Besides many copies being made and the lack of caching (not blaming you, just pointing out), this is not the code we're looking for...

For our case, if you follow down the rabbit hole of JavaConstructor.forConstructors and JavaMethod.forMethods, it seems to boil down to CoerceLuaToJava.NumericCoercion.score().

In https://github.com/M66B/XPrivacyLua...ava/org/luaj/vm2/lib/jse/CoerceLuaToJava.java

I'd need to spend more time on a bigger screen than a phone to fully understand this, but is it worth it? If I understand you correctly, you consider the issue such an edge case that you're not interested in a fix.
[Xposed Framework Modules] M66B:
You correctly followed the source code path and you are correct about the change I did to allow private methods as well.

Changing anything in the LuaJ source code should go along with extensively testing all hooks again, which would be quite some work. Since there is a workaround, I don't want to do this, but if you like to do it, go ahead.
[Xposed Framework Modules] Fif_:
Edit: XDA Labs or XDA ate my 1200 word comment at the 8th word because I had a U+2020 DAGGER there, and I don't have the time to type it again. :crying:
[Xposed Framework Modules] M66B:
XDA is the place were everything happens, including eating of text and images and sometimes even developers, often quite slowly. LOL.
[Xposed Framework Modules] jallenhayslett:
Ok, so logcat has extra info. What specifically do you need? Just set it up same as before, open the app, attempt to access blocked files, then get the logcat and post it? Do you also want screens from the XPLPro log?
[Xposed Framework Modules] Fif_:
I was just pointing out the logcat had extra information if you were trying to debug your modified version of the hook BlockGuardOS.open hook. The hook prints the evaluated whitelist to the log the first time it's invoked and then every file open and its status (allow/deny) is logged there as well.
[Xposed Framework Modules] jallenhayslett:
Ok. I'll set everything up again, reenable the hooks, and see if the logcat offers any more detail than the XPLPro log. Lately I've just been using a couple lines I added to my nightly Tasker maintenance task to clean up the offending files and folders. Works well, for the time being, but if I can get XPL to block the write altogether, that would be ideal. Hopefully the logcat will offer a bit more insight.
[Xposed Framework Modules] inguna:
Fif_

Hi, I am interested in using InetAddress.getByAddress/addr and InetAddress.getByAddress/host/addr hooks but they seem to be not working on my Honor 7C Oreo 8.0

I can't see no addresses being logged in Xprivacylua.

Can you point me in the right direction please?

Thanks a lot in advance
[Xposed Framework Modules] Fif_:
Both hooks only do logging, for later analysis, and no blocking whatsoever. The log messages appear in the logcat and look like:

11-04 12:01:44.090 I/XLua.Xposed(11940): Log com.owncloud.android:10135 Fif.InetAddress.getByAddress/addr Allow 0.0.0.0 (string)

You should be able to find them by searching for "Fif.InetAddress.getByAddress" in Matlog, or any other logcat viewer.

No logging is done in the XPL Pro log, mostly because again, no blocking is done by the hooks and the XPL Pro log is about what values are changed or blocked from being accessed, and it only shows the last blocking action.
[Xposed Framework Modules] inguna:
Hi, can you tell me why this hook wouldn't work please.

definition

"builtin": false,

"collection": "Test",

"group": "Trick into offline",

"name": "NetworkInfo.isConnected",

"author": "Test",

"version": 1,

"description": "Test",

"className": "android.net.NetworkInfo",

"methodName": "isConnected",

"parameterTypes":

"returnType": "boolean",

"minSdk": 1,

"maxSdk": 999,

"minApk": 0,

"maxApk": 0,

"enabled": true,

"optional": false,

"usage": true,

"notify": false,

"luaScript": "@Test.NetworkInfo.isConnected"

code

function before(hook, param)

param:setResult(false)

return true

end

https://developer.android.com/reference/android/net/NetworkInfo#isConnected()

I used Fif_'s hook as an example

https://lua.xprivacy.eu/repo/view?id=39

Can you help me make it work?

Thanks