[Q] Not loading class from Classes2.dex? - Xposed General

I'm trying to hook the following: com.google.android.ulr.ApiRate
It's in com.google.android.gms (Google Play Services). I verified it's in there by dex dumping the Classes2.dex from Play Services.
At runtime, I get this:
Code:
de.robv.android.xposed.XposedHelpers$ClassNotFoundError: java.lang.ClassNotFoundException: com.google.android.ulr.ApiRate
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.ulr.ApiRate" on path: DexPathList[[zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/system/framework/com.android.location.provider.jar", zip file "/data/app/com.google.android.gms-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.android.gms-2, /vendor/lib, /system/lib, /vendor/lib]]
The only thing I can think of is that it's because it's in Classes2.dex instead of Classes.dex?
Any thoughts?

Looks like you got this fixed. What was the problem?

GermainZ said:
Looks like you got this fixed. What was the problem?
Click to expand...
Click to collapse
I wasn't able to fix it. I tried using multidex but never got it working. In the end, i had to dig through a lot of projects dalvik bytecode and follow the call stack back to a place defined in classes.dex, then hook it there. Not ideal, and more chances for side effects, but things seem to be working
I'd love to see a fix at some point!

cryptyk said:
I wasn't able to fix it. I tried using multidex but never got it working. In the end, i had to dig through a lot of projects dalvik bytecode and follow the call stack back to a place defined in classes.dex, then hook it there. Not ideal, and more chances for side effects, but things seem to be working
I'd love to see a fix at some point!
Click to expand...
Click to collapse
Could you point me in the right direction here? com.google.android.a.r seems to be pretty close. Lots of references to DexClassLoader.

cryptyk said:
I'm trying to hook the following: com.google.android.ulr.ApiRate
It's in com.google.android.gms (Google Play Services). I verified it's in there by dex dumping the Classes2.dex from Play Services.
At runtime, I get this:
Code:
de.robv.android.xposed.XposedHelpers$ClassNotFoundError: java.lang.ClassNotFoundException: com.google.android.ulr.ApiRate
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.ulr.ApiRate" on path: DexPathList[[zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/system/framework/com.android.location.provider.jar", zip file "/data/app/com.google.android.gms-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.android.gms-2, /vendor/lib, /system/lib, /vendor/lib]]
The only thing I can think of is that it's because it's in Classes2.dex instead of Classes.dex?
Any thoughts?
Click to expand...
Click to collapse
I guess this is caused by using the wrong class loader.
Try finding the class with classForName by specifying another class loader:
http://developer.android.com/refere....lang.String, boolean, java.lang.ClassLoader)
You will need to find a way to get to another class loader though.

Found a surprisingly easy way to hook any class needed from Play Services. Just hook the Application onCreate. It looks like the initial package class loader will only have the initial dex file loaded. After loading the initial application instance GMS will at some point, I'm guessing, load the additional dexes. The GMS Application Context appears to have a fully loaded class loader associated with it. Tapping into that will give you access to whatever you need. Much simpler than I expected and resistant to per-release obfuscation.

Related

[Emulator][Unnoficial] Leapcast the Chromecast Emulator All-In-One File

After several hours of tinkering and editing, I think I've finally managed to make an easy way to emulate a Chromecast on your PC. Iv'e only worked on x64 based systems so far, but I'll do x32 if anyone needs it. All you have to do is download the file, place it on your desktop (or it won't work), extract the .tar (don't make a new folder) and follow the directions in INSTALL.txt. It shouldn't require any extra files except Google Chrome, but if it does or you have any other errors or advice, feedback is very appreciated.​
I take no responsibility for any damages done by this. USE AT YOUR OWN RISK. Leapcast is the property of dz0ny at GitHub, not me. All I did was make an all-in-one install script.​
I already have Python installed....Can I just run the Bat file?
Error running LeapCast.bat
I completed the installation but when I run LeapCast.bat got this error (see the image)
Edit: I found the problem, I need to Edit "PATH" environment variable to include this "C:\Python27" and this "C:\Python27\Scripts".
Good job!!!!
Only youtube detected the leapcast, I check Plex, Avia, Crackle and Allcast and they don't.
lordkain2 said:
I completed the installation but when I run LeapCast.bat got this error (see the image)
Edit: I found the problem, I need to Edit "PATH" environment variable to include this "C:\Python27" and this "C:\Python27\Scripts".
Good job!!!!
Only youtube detected the leapcast, I check Plex, Avia, Crackle and Allcast and they don't.
Click to expand...
Click to collapse
It's probably an error in my install script. It should have edited your PATH automatically, so I'll look into it. The compatibility problem is probably just an issue with the emulator itself. I'll keep an eye on the github page and update this as soon as its available. Thanks for the feedback!
Did you use the Chromecast app on your phone/tablet to detect it before you tried the other apps?
Asphyx said:
I already have Python installed....Can I just run the Bat file?
Click to expand...
Click to collapse
That's part of what the script does. If you want, you can ignore the basic Python install if you specifically have Python 2.7.5 installed, but you definitely need to let setuptools and pip install. Won't work without them I'm afraid. Thanks for the feedback!
thatscottguy93 said:
That's part of what the script does. If you want, you can ignore the basic Python install if you specifically have Python 2.7.5 installed, but you definitely need to let setuptools and pip install. Won't work without them I'm afraid. Thanks for the feedback!
Click to expand...
Click to collapse
Thanks Kind of what I expected....Will try this later tonite
Thanks for the effort!
Unfortunately, this doesn't seem to work. The .bat file it leaves on the desktop has a strange trailing ascii-character, but it still doesn't run correctly even after you remove it. I don't know why you would run it from desktop anyway rather than c:\python27\scripts anyway... It should run from anywhere if the PATH is set correctly, but this script didn't seem to do that. Finally, it would be smarter to use the .vbs provided by the leapcast dev instead of your errant .bat on the desktop. Again though, thanks for the attempt.
It would be great if someone could put together a full install using install-shield and all, or at least a working batch script that has been tested on a fresh install of WinXP/Win7/Win8.1 Maybe I will try to.
NOTE: If this works for others, please let us know, but I am fairly certain it has at least a few minor errors preventing it from working by following the instructions alone.
thatscottguy93 said:
It's probably an error in my install script. It should have edited your PATH automatically, so I'll look into it. The compatibility problem is probably just an issue with the emulator itself. I'll keep an eye on the github page and update this as soon as its available. Thanks for the feedback!
Did you use the Chromecast app on your phone/tablet to detect it before you tried the other apps?
Click to expand...
Click to collapse
i have tried editing my system variables, but after running Leapcast.bat it say:
'leapcast' is not recognized as an internal or external command,operable program or batch file.
Please guide me through. AND github is down in my country right now
---------- Post added at 01:17 PM ---------- Previous post was at 12:49 PM ----------
Okay I got this post on google+
https://plus.google.com/+NicandrosNicolaou/posts/8RjWfMXxje8
it help me do a complete install of LEAPCAST...
-------------------------------------------------------------------
I just wanted to ask if there will be any update for V2 chromecast ? @thatscottguy93
link is not working
can you post a mirror link please?
thatscottguy93 said:
After several hours of tinkering and editing, I think I've finally managed to make an easy way to emulate a Chromecast on your PC. Iv'e only worked on x64 based systems so far, but I'll do x32 if anyone needs it. All you have to do is download the file, place it on your desktop (or it won't work), extract the .tar (don't make a new folder) and follow the directions in INSTALL.txt. It shouldn't require any extra files except Google Chrome, but if it does or you have any other errors or advice, feedback is very appreciated.​
I take no responsibility for any damages done by this. USE AT YOUR OWN RISK. Leapcast is the property of dz0ny at GitHub, not me. All I did was make an all-in-one install script.​
Click to expand...
Click to collapse
punkmexic said:
can you post a mirror link please?
Click to expand...
Click to collapse
Just tried, and works for me....
punkmexic said:
can you post a mirror link please?
Click to expand...
Click to collapse
Its attached to the first post... no need for a mirror...
Installation files for 32 bit system
can you make a setup for 32 bit computer?
Can i run xbmc/kodi on my windows pc and use leapcast to send the video feed to my android phone - this way I can use the laptop as a remote and the phone as existing hardware - lowering my android tv experience to a cost of zero - or should I stick with remote desktop... lag could be an issue as leapcast is light weight via python - minus the $5 mhl
Nope
mikeymackinon said:
Can i run xbmc/kodi on my windows pc and use leapcast to send the video feed to my android phone - this way I can use the laptop as a remote and the phone as existing hardware - lowering my android tv experience to a cost of zero - or should I stick with remote desktop... lag could be an issue as leapcast is light weight via python - minus the $5 mhl
Click to expand...
Click to collapse
Leapcast does not work that way, its mainly for youtube etc... web based viewings. Why not run the laptop/ desktop to the TV set and remote in from the Android phone/ tablet via a remote control app or team view etc... You would defiantly have lagging issues if reversed. Plus you do not have the buy the micro usb to hdmi adapter? Kewl story bro!
Seriously smart, as you will not have to get up to change from one episode to the next and at no cost.
thatscottguy93 said:
After several hours of tinkering and editing, I think I've finally managed to make an easy way to emulate a Chromecast on your PC. Iv'e only worked on x64 based systems so far, but I'll do x32 if anyone needs it. All you have to do is download the file, place it on your desktop (or it won't work), extract the .tar (don't make a new folder) and follow the directions in INSTALL.txt. It shouldn't require any extra files except Google Chrome, but if it does or you have any other errors or advice, feedback is very appreciated.​
I take no responsibility for any damages done by this. USE AT YOUR OWN RISK. Leapcast is the property of dz0ny at GitHub, not me. All I did was make an all-in-one install script.​
Click to expand...
Click to collapse
Thank you very much!!! Nice Work! I love you <3 #nohomo
Hi,
i wanted to try this but iam stucking at this error
C:\Users\Administrator\Desktop\LeapcastForWindows\leapcast>leapcast --name Leapcast --chrome "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" --fullscreen
Traceback (most recent call last):
File "C:\Python27\scripts\leapcast-script.py", line 9, in <module>
load_entry_point('Leapcast==0.1.3', 'console_scripts', 'leapcast')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2431, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2147, in load
['__name__'])
ImportError: No module named leapcast.__main__
Anyone know how to fix this?
Managed to got it almost working IT's an old thread but I will give it a go.
Had to update Python to 2.7.9 for the SSL thing.
This is my issue :
Code:
C:\Users\d3x\Desktop\LeapcastForWindows\leapcast>leapcast --name Leapcast --chrome "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" --fullscreen
INFO:root:Starting SSDP server
INFO:root:Starting LEAP server
INFO:root:Loading Config-JSON from Google-Server
Traceback (most recent call last):
File "C:\Python27\Scripts\leapcast-script.py", line 9, in <module>
load_entry_point('Leapcast==0.1.3', 'console_scripts', 'leapcast')()
File "c:\leapcast\leapcast\__main__.py", line 38, in main
leap_server.start()
File "c:\leapcast\leapcast\services\leap.py", line 35, in start
resp = requests.get(url=app_dict_url)
File "C:\Python27\lib\site-packages\requests-2.18.4-py2.7.egg\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\Python27\lib\site-packages\requests-2.18.4-py2.7.egg\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python27\lib\site-packages\requests-2.18.4-py2.7.egg\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests-2.18.4-py2.7.egg\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests-2.18.4-py2.7.egg\requests\adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='clients3.google.com', port=443): Max retries exceeded with url: /cast/chromecast/device/config (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)'),))
Would that mean that google changed something and this no longer works?
-chrizz- said:
Hi,
i wanted to try this but iam stucking at this error
C:\Users\Administrator\Desktop\LeapcastForWindows\leapcast>leapcast --name Leapcast --chrome "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" --fullscreen
Traceback (most recent call last):
File "C:\Python27\scripts\leapcast-script.py", line 9, in <module>
load_entry_point('Leapcast==0.1.3', 'console_scripts', 'leapcast')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2431, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2147, in load
['__name__'])
ImportError: No module named leapcast.__main__
Anyone know how to fix this?
Click to expand...
Click to collapse
Did u solved this?? same problem here.. let me know if u solved this
Don't know about your specific error, but Google definitely changed something. Leapcast doesn't work anymore. According to dz0ny on github:
This project no longer works because Google locked down entire API. There are alternatives like cloning device, casting apk from nexus player etc. Thanks for all contibutors and I hope we all learned something from this project. Meanwhile I'am keeping https://github.com/dz0ny/leapcast/issues/130 open if anyone wants to discuss something related to lepacast or 2nd screen paradigm.
I would love to re-implement this as an open source alternative to chromecast someday, but I won't make any promises.
Does anyone know a proper way to uninstall this?

Starting a service with same permissions as hooked package

Simple question. I want to start my own service from my package with the same permissions as the package i am hooking. Does anybody know how i could do this? I know if i use android:sharedUserId="android.uid.systemui" in the manifest, but it prevents it based off of signature mismatch. Could i use xposed to grant my app the sharedUserId?
Simple question. I want to start my own service from my package with the same permissions as the package i am hooking.
Click to expand...
Click to collapse
I don't think that is possible. I haven't worked with services yet, but as far as I understood, you have to declare them in your manifest (in contrast to BroadcastReceivers, which can also be registered at runtime). Theoretically again, you could try to modify the manifest parsing and try to inject additional entries there.
elesbb said:
Could i use xposed to grant my app the sharedUserId?
Click to expand...
Click to collapse
Theoretically, I think yes, you could hook the package manager to ignore the signature mismatch etc. But I think it will be quite fragile.
What do you want to achieve with this?
rovo89 said:
I don't think that is possible. I haven't worked with services yet, but as far as I understood, you have to declare them in your manifest (in contrast to BroadcastReceivers, which can also be registered at runtime). Theoretically again, you could try to modify the manifest parsing and try to inject additional entries there.
Theoretically, I think yes, you could hook the package manager to ignore the signature mismatch etc. But I think it will be quite fragile.
What do you want to achieve with this?
Click to expand...
Click to collapse
I hate how Samsung removed widgets from the lockscreen. So i figured i'll create my own lockscreen and have it loaded by the system. I might just skip the whole service thing (which would make my lockscreen easier to write by having classes that extend things like FrameLayout as the stock lockscreen does) but i found where the lockscreen is actually shown. i may just inflate my own xml of the lockscreen using xposed resources and then adding it with windowmanager. Then the inflated view will follow the same permissions as the stock lockscreen and allow me to handle key presses and still preserve the security behind it.
Thanks rovo for the reply!
@rovo89
If i am inflating my own view inside a hooked method, how can i get the ids of my layout? I tried XModuleResources myRes; myRes.getIdentifier() but it returned null.
Be careful, Resources.getIdentifier() expects the arguments in a different order than Xposed, like getIdentifier("mystring", "string", "my.package.name").
Apart from that, simply use R.layout.my_layout.

[Suggestion] Version name and code in log file

Dear @rovo89,
What if add version name and code in log file when modules are loading?
Loading Xposed v54 (for Zygote)...
Running ROM 'KOT49H release-keys' with fingerprint 'htc/htc_europe/m7cdug:4.4.2/KOT49H/342802.6:user/release-keys'
Loading modules from /data/app/kz.virtex.htc.tweaker-1.apk
Loading class kz.virtex.htc.tweaker.XMain
Name: 8.5.13, Code: 256
Loading modules from /data/app/com.sensetoolbox.six-1.apk
Loading class com.sensetoolbox.six.mods.XMain
Name: 1.0.7, Code: 15
Very useful when receiving logs from users and during development when module crashes system.
A good idea, but the problem is that the package manager service isn't running at that time. So this information would have to be parsed out of the AndroidManifest.xml manually. There is a PackageParser class, but it's quite complex. It could be considered, but it would have to be carefully tested to avoid unwanted side-effects. Keep in mind that this code runs before Android begins to start, and from past experiences I know that some classes on some ROMs should better not be used that early. Not sure if this would also be the case for PackageParser or its dependencies.
Could it not be stored by the Xposed Installer? Basically, instead of saving the module's name on each line in modules.list (IIRC), it'd put the name, version name and code separated by e.g. commas.
That would be an option. Not 100% reliable, but unless something goes really wrong (e.g. someone replaces the APK directly), it should be fine.
This topic and your suggestion goes a bit into the direction of a suggestion @M66B made - storing the start class name in the manifest instead of assets/xposed_init.
This doesn't really solve the problem but I think I'll share
For one if my mods I provided a report error button
The button creates a log by getting the Xposed Log and appending version
Number etc and saving to SD card
So users can easily get logs AND I can easily sove problems

[NEED HELP][NOT BOOTIN'] Sont Xperia Z3 Lollipop stock rom port to Nexus 5

I did a new port, see OP
I have bootanimation
Hopefully this helps
When I first saw this the first thing that came to mind was finding all the needed hardware files and putting them in the port. Now I looked over the logcat and sure enough it has hardware errors. You re having gralloc issues and hwcomposor issues. I stopped looking after I saw surfaceflinger as right after that is when the crash starts. In my opinion these are the main two issues stopping boot.
Gralloc issue
Code:
E/HAL ( 176): load: module=/system/lib/hw/gralloc.msm8974.so
E/HAL ( 176): dlopen failed: cannot locate symbol "_ZN13AdrenoMemInfo9getStrideEii" referenced by "gralloc.msm8974.so"...
Hwcomposor issue
Code:
E/HAL ( 176): load: module=/system/lib/hw/hwcomposer.msm8974.so
E/HAL ( 176): dlopen failed: cannot locate symbol "_ZN7overlay6RotMem3Mem12setReleaseFdERKi" referenced by "hwcomposer.msm8974.so"...
Now you have way more issues than those but those should be your focus right now. You will have to get the correct hardware files for hamerhead and use them to replace the hardware files for that are for the Xpeira Z3. But even if you get it booting you will have camera issues along with a lot more stuff. You may even have to decompile the framworks.apk and edit smali files to look for the correct hardware files and to use different strings.
Now I have to say I am not even sure if what you are attempting can even be done. I do wish you luck and hopefully what I posted here will help you move forward some.
T-Macgnolia said:
When I first saw this the first thing that came to mind was finding all the needed hardware files and putting them in the port. Now I looked over the logcat and sure enough it has hardware errors. You re having gralloc issues and hwcomposor issues. I stopped looking after I saw surfaceflinger as right after that is when the crash starts. In my opinion these are the main two issues stopping boot.
Gralloc issue
Code:
E/HAL ( 176): load: module=/system/lib/hw/gralloc.msm8974.so
E/HAL ( 176): dlopen failed: cannot locate symbol "_ZN13AdrenoMemInfo9getStrideEii" referenced by "gralloc.msm8974.so"...
Hwcomposor issue
Code:
E/HAL ( 176): load: module=/system/lib/hw/hwcomposer.msm8974.so
E/HAL ( 176): dlopen failed: cannot locate symbol "_ZN7overlay6RotMem3Mem12setReleaseFdERKi" referenced by "hwcomposer.msm8974.so"...
Now you have way more issues than those but those should be your focus right now. You will have to get the correct hardware files for hamerhead and use them to replace the hardware files for that are for the Xpeira Z3. But even if you get it booting you will have camera issues along with a lot more stuff. You may even have to decompile the framworks.apk and edit smali files to look for the correct hardware files and to use different strings.
Now I have to say I am not even sure if what you are attempting can even be done. I do wish you luck and hopefully what I posted here will help you move forward some.
Click to expand...
Click to collapse
I replaced these files already, from a hammerhead Cm12 nightly :/
dekefake said:
I replaced these files already, from a hammerhead Cm12 nightly :/
Click to expand...
Click to collapse
You may need other files or maybe even need to edit framworkes.apk to allow the files to be used by the system. What I am saying is just because they are present doesn't mean the system will use them. Look closely at the errors I pointed out as it will give you some idea of what to do.it says cannot find symbol blah blah blah. You need to find where that symbol is in the CM ROM and make sure it is in your port.
T-Macgnolia said:
You may need other files or maybe even need to edit framworkes.apk to allow the files to be used by the system. What I am saying is just because they are present doesn't mean the system will use them. Look closely at the errors I pointed out as it will give you some idea of what to do.it says cannot find symbol blah blah blah. You need to find where that symbol is in the CM ROM and make sure it is in your port.
Click to expand...
Click to collapse
Framework-res.apk file from Sony doesnt want to decompile properly. Using latest Apktool for Lollioop
T-Macgnolia said:
You may need other files or maybe even need to edit framworkes.apk to allow the files to be used by the system. What I am saying is just because they are present doesn't mean the system will use them. Look closely at the errors I pointed out as it will give you some idea of what to do.it says cannot find symbol blah blah blah. You need to find where that symbol is in the CM ROM and make sure it is in your port.
Click to expand...
Click to collapse
Sucedded to decompile framework-res.apk..
Replaced storage list by Nexus 5 one, and power profiles, but can't find anything about _ZN* :/
Still sticks to the same on logcat
dekefake said:
Sucedded to decompile framework-res.apk..
Replaced storage list by Nexus 5 one, and power profiles, but can't find anything about _ZN* :/
Still sticks to the same on logcat
Click to expand...
Click to collapse
these are native methods(you wont find in smali files), you can use armobjectdump/hexedit to look which files have, my bet would be you either needing to replace some of our files with the z3(hw files) or replacing some system libs(the one where the code needs to exist).
another bet would be trying to use our caf libs,however AFAIk would need changes to the kernel
Just to say i restarted a new project (look OP)
New logcat to debug.
Thanks in advance for help

Hook in classes from com.android.internal.telephony.*

Hi guys, i'm having a problem and maybe someone can help me.
Everytime i try to hook in classes from the package com.android.internal.telephony.* i get NoClassDefFoundError . I am trying to hook on the method addOrUpdate from com.android.internal.telephony.util.BlacklistUtils class.
The class is inside framework/opt/telephony/src/java/com/android/internal/telephony/util/BlacklistUtils.java in cyanogen sources.
I'm still learning how to make xposed modules, and every thing work great , except on classes from the package com.android.internal.telephony.*
+1 my log checks are not getting called, but no error is being thrown.
salatiel said:
Hi guys, i'm having a problem and maybe someone can help me.
Everytime i try to hook in classes from the package com.android.internal.telephony.* i get NoClassDefFoundError . I am trying to hook on the method addOrUpdate from com.android.internal.telephony.util.BlacklistUtils class.
The class is inside framework/opt/telephony/src/java/com/android/internal/telephony/util/BlacklistUtils.java in cyanogen sources.
I'm still learning how to make xposed modules, and every thing work great , except on classes from the package com.android.internal.telephony.*
Click to expand...
Click to collapse
You may try hooking the class inside initZygote instead of handleLoadPackage.

Categories

Resources