• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[APP][XPOSED][6.0+] Use Xposed without developing a module

Status
Not open for further replies.
Search This thread

M66B

Recognized Developer
Aug 1, 2010
24,704
51,007
New error:
( this is the line where I changed : to . )
Could the binding be failing? Are my class definitions proper? Thanks.
LuaJ bindings are simple and therefore at times problematic. I guess the previous line was better, but I am not sure why no new instance is being made.
 

ViRb3

Senior Member
Aug 25, 2014
386
810
LuaJ bindings are simple and therefore at times problematic. I guess the previous line was better, but I am not sure why no new instance is being made.

I fixed it by using the primitive "byte" instead of the boxed "java.lang.Byte" :)

Could I suggest making this a built-in hook instead of optional? The method reliably leaks the MAC address of all Android versions up to 9 and it's a huge privacy issue IMO. I will gladly send a PR that makes it return "02:00:00:00:00:00" instead of empty byte array for stability purposes.
 

M66B

Recognized Developer
Aug 1, 2010
24,704
51,007
I fixed it by using the primitive "byte" instead of the boxed "java.lang.Byte" :)

Could I suggest making this a built-in hook instead of optional? The method reliably leaks the MAC address of all Android versions up to 9 and it's a huge privacy issue IMO. I will gladly send a PR that makes it return "02:00:00:00:00:00" instead of empty byte array for stability purposes.
The MAC address isn't exposed on recent Android versions anymore, which is why this hook definition isn't a part of the core restrictions.
 

ViRb3

Senior Member
Aug 25, 2014
386
810

M66B

Recognized Developer
Aug 1, 2010
24,704
51,007

ViRb3

Senior Member
Aug 25, 2014
386
810
You'll have to 'thank' the manufacturer of your device for changing Android in this way because this should not be the case, see here:

https://developer.android.com/train...tml#version_specific_details_identifiers_in_m

Related FAQ:

https://github.com/M66B/XPrivacyLua/blob/master/FAQ.md#user-content-faq4

I am running stock AOSP, no modifications. The policy change you linked me affects
Code:
WifiInfo.getMacAddress()
, but not
Code:
NetworkInterface.getHardwareAddress()
. As I said, the latter reliably leaks the MAC on all Android versions.
 

M66B

Recognized Developer
Aug 1, 2010
24,704
51,007
I am running stock AOSP, no modifications. The policy change you linked me affects , but not . As I said, the latter reliably leaks the MAC on all Android versions.
There is already a hook definition for this in the repository.

Note that adding new hook definitions to existing restriction categories can and will lead to trouble for existing users, so I am hesitant in doing this.
 

ViRb3

Senior Member
Aug 25, 2014
386
810
There is already a hook definition for this in the repository.

Note that adding new hook definitions to existing restriction categories can and will lead to trouble for existing users, so I am hesitant in doing this.

I understand. It would be a good idea to at least update the FAQ, though. I can submit a PR later tonight if you do not have the time.
 

fpoke

Member
Apr 17, 2019
6
0
Hi all,
Getting started on editing some scripts to define my own hooks for the Build.FINGERPRINT value.

How would I go about creating an array of strings and have the returned value choose a string from the array randomly?

Currently, I go to Manage Hook Definitions>Build.FINGERPRINT>Edit>Lua Script. I understand that the default fake value is set to 'unknown' and I can edit that string in the script.
In this case, I'm planning to create an array with possible values and have the "local fake = 'unknown' " line read a random value from the array instead of 'unknown'. I would also like to change the value every time that the app is opened. Is this possible?
 

M66B

Recognized Developer
Aug 1, 2010
24,704
51,007
Hi all,
Getting started on editing some scripts to define my own hooks for the Build.FINGERPRINT value.

How would I go about creating an array of strings and have the returned value choose a string from the array randomly?

Currently, I go to Manage Hook Definitions>Build.FINGERPRINT>Edit>Lua Script. I understand that the default fake value is set to 'unknown' and I can edit that string in the script.
In this case, I'm planning to create an array with possible values and have the "local fake = 'unknown' " line read a random value from the array instead of 'unknown'. I would also like to change the value every time that the app is opened. Is this possible?
I guess this will be a good start:

https://stackoverflow.com/questions/2988246/choose-a-random-item-from-a-table
 

fpoke

Member
Apr 17, 2019
6
0

Wow, thanks! That was super useful!!

One more thing I'd like to try is getting a variable from another script. For example, setting a variable in the Settings.Secure.getString/android_id hook and reading it in the Build.Fingerprint.
I tried using the _G. prefix on a variable to define a global variable, but that didn't work. I also tried removing the 'local' definition of a variable, but that didn't work either.
Online I also read that I could try the require('Settings.Secure.getString/android_id') to load the first script, but that didn't work either.

Would you have any guidance on how to create a global variable? Or even to read a variable from one script in another?
 

Fif_

Senior Member
Jun 5, 2013
1,122
1,164
Google Nexus 10
Google Nexus 4
Wow, thanks! That was super useful!!

One more thing I'd like to try is getting a variable from another script. For example, setting a variable in the Settings.Secure.getString/android_id hook and reading it in the Build.Fingerprint.
I tried using the _G. prefix on a variable to define a global variable, but that didn't work. I also tried removing the 'local' definition of a variable, but that didn't work either.
Online I also read that I could try the require('Settings.Secure.getString/android_id') to load the first script, but that didn't work either.

Would you have any guidance on how to create a global variable? Or even to read a variable from one script in another?
You can't create global variables but you can store and retrieve key value pairs in thread-local storage with param:setValue () and param:getValue().
See the InetAddress.getAllByName hook in the repo for a complex example.
 
  • Like
Reactions: fpoke

J4jks

Senior Member
May 20, 2015
637
247
Hyderabad
Code:
Fif.BlockGuardOs.open

Exception:
java.lang.NoClassDefFoundError: android.app.NotificationChannel
at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
at java.lang.Class.getDexCacheType(Class.java:2551)
at java.lang.reflect.Method.getReturnType(Method.java:150)
at java.lang.Class.getDeclaredMethods(Class.java:1811)
at org.luaj.vm2.lib.jse.JavaClass.getField(SourceFile:82)
at org.luaj.vm2.lib.jse.JavaInstance.get(SourceFile:52)
at org.luaj.vm2.LuaClosure.execute(SourceFile:264)
at org.luaj.vm2.LuaClosure.onInvoke(SourceFile:183)
at org.luaj.vm2.LuaClosure.invoke(SourceFile:176)
at org.luaj.vm2.LuaValue.invoke(SourceFile:1789)
at eu.faircode.xlua.XLua$5.execute(SourceFile:490)
at eu.faircode.xlua.XLua$5.beforeHookedMethod(SourceFile:451)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:340)
at libcore.io.BlockGuardOs.open(<Xposed>)
at libcore.io.IoBridge.open(IoBridge.java:441)
at libcore.io.IoUtils$FileReader.<init>(IoUtils.java:207)
at libcore.io.IoUtils.readFileAsString(IoUtils.java:114)
at com.android.org.conscrypt.CertPinManager.readPinFile(CertPinManager.java:120)
at com.android.org.conscrypt.CertPinManager.ensureInitialized(CertPinManager.java:92)
at com.android.org.conscrypt.CertPinManager.lookup(CertPinManager.java:136)
at com.android.org.conscrypt.CertPinManager.isChainValid(CertPinManager.java:72)
at com.android.org.conscrypt.TrustManagerImpl.verifyChain(TrustManagerImpl.java:576)
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:444)
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:464)
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:508)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:401)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:375)
at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:304)
at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88)
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:178)
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:596)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:357)
at com.android.okhttp.Connection.connectTls(Connection.java:235)
at com.android.okhttp.Connection.connectSocket(Connection.java:199)
at com.android.okhttp.Connection.connect(Connection.java:172)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:367)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:130)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:247)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:457)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:405)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:521)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
at android.media.MediaHTTPConnection.seekTo(MediaHTTPConnection.java:211)
at android.media.MediaHTTPConnection.getSize(MediaHTTPConnection.java:371)
at android.media.IMediaHTTPConnection$Stub.onTransact(IMediaHTTPConnection.java:80)
at android.os.Binder.execTransact(Binder.java:565)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.NotificationChannel" on path: DexPathList[[zip file "/data/app/akashvani.radio-1/base.apk"],nativeLibraryDirectories=[/data/app/akashvani.radio-1/lib/arm,
This is the error @Fif_
with latest hook
 

Fif_

Senior Member
Jun 5, 2013
1,122
1,164
Google Nexus 10
Google Nexus 4
This is the error @Fif_
with latest hook
Well that's odd.
Because while the error occurs during the hook lua code execution, it's throwing an exception trying to access the NotificationChannel class, which is not used by the hook.
So I'm stumped.

A few questions for you:
Does the error go away when you disable the hook?
Does the error still occur if you disable all hooks except BlockGuardOS.open?
Does the error still occur if you disable all Xposed modules but XPL?
Which device, ROM and Android version is this happening on?
Which exact version of Magisk, Xposed, XPL and the hook are you using?
Are you doing anything "odd" or non-standard? (Restricting system, running MicroG, multi-ROM, or anything else out of the ordinary).
Can you provide a logcat starting before you start the app? (Force stop the app, run logcat, start the app, wait for the crash, PM me the logcat).

I've tried installing com.streema.simpleradio from play store, but it didn't crash here (I've just launched the app with all restrictions on, but didn't do anything with it).
 

J4jks

Senior Member
May 20, 2015
637
247
Hyderabad
Well that's odd.
Because while the error occurs during the hook lua code execution, it's throwing an exception trying to access the NotificationChannel class, which is not used by the hook.
So I'm stumped.

A few questions for you:

Which device, ROM and Android version is this happening on?
Moto G2 , AOKP N with magisk canary 19.2+ systemless xposed 89.3
With fake gapps,minminguard,Rootcloak and XPl

Does the error go away when you disable the hook?
Yes, returns after enabling it.

Does the error still occur if you disable all hooks except BlockGuardOS.open?
Yes , it is happening with only this hook enabled.

Are you doing anything "odd" or non-standard? (Restricting system, running MicroG, multi-ROM, or anything else out of the ordinary).
I have microG running with most of the provided hooks applied to it, except Get. applications, firewall Offline and public storage.
And I have Bromite system webview v.68 is installed.
Enabled multi process webview( Run webview renderers separately) in developers settings
 

Attachments

  • Logs.7z
    12.6 KB · Views: 2
Last edited:

Fif_

Senior Member
Jun 5, 2013
1,122
1,164
Google Nexus 10
Google Nexus 4
Which device, ROM and Android version is this happening on?
Moto G2 , AOKP N with magisk canary 19.2+ systemless xposed 89.3
With fake gapps,minminguard,Rootcloak and XPl

Does the error go away when you disable the hook?
Yes, returns after enabling it.

Does the error still occur if you disable all hooks except BlockGuardOS.open?
Yes , it is happening with only this hook enabled.

Are you doing anything "odd" or non-standard? (Restricting system, running MicroG, multi-ROM, or anything else out of the ordinary).
I have microG running with most of the provided hooks applied to it, except Get. applications, firewall Offline and public storage.
And I have Bromite system webview v.68 is installed.
Enabled multi process webview( Run webview renderers separately) in developers settings
Thanks.
Unfortunately, the logcats you sent are incomplete or partial, so I cannot help you.
I need the full logcat from before the app start until the crash. I understand this may contain sensitive information, which is why I suggested a PM.

Edit: it's probably Bromite that's causing issues since there are already special whitelist entries for WebView and Chrome running as System WebView. But I can't tell without a logcat.
 
Last edited:

J4jks

Senior Member
May 20, 2015
637
247
Hyderabad
Thanks.
Unfortunately, the logcats you sent are incomplete or partial, so I cannot help you.
I need the full logcat from before the app start until the crash. I understand this may contain sensitive information, which is why I suggested a PM.

Edit: it's probably Bromite that's causing issues since there are already special whitelist entries for WebView and Chrome running as System WebView. But I can't tell without a logcat.
There is no crash

The app is running just fine with this error.
I shared this error thinking you may find something to fix this


Thanks
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 31
    ic_launcher.png

    XPrivacyLua custom hook definitions

    By using XPrivacyLua you can define Xposed hooks and apply them to any app at run time (so, rebooting your device is not necessary). You can write hook code on your device in Lua, which is quite easy to learn.

    See the documentation about how to define hooks.

    Although XPrivacyLua has 'privacy' in its name, new hooks don't need to be privacy related at all. Disabling the built in privacy related hooks is a matter of selecting another collection of hooks.

    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.


    XDA:DevDB Information
    XPrivacyLua hook definitions, Xposed for all devices (see above for details)

    Contributors
    M66B
    Xposed Package Name:

    Version Information
    Status: Beta

    Created 2018-01-28
    Last Updated 2018-04-01
    14
    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.
    9
    @jawz101 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.
    8
    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
    8
    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