Comments (13)
I was told that Shizuku can be used to execute su commands even on a non-rooted device.
You were told wrong.
Shizuku runs as shell
, which has some privileges - specifically these permissions, as well as some special cases in some system services when you call them with the shell
UID (2000
). It does not allow you to run commands as root on an unrooted device.
What you are probably looking for is Rish, which is the closest thing to su
for running arbitrary commands as shell. But, again, it does not allow you to run everything because shell
!= root
.
Meanwhile, the closest thing to libsu's RootService, is well, Shizuku API. Their functionality is fairly close, although libsu doesn't have a built in close callback (that I know of anyway). You can see an example of an app that is able to use either with my own DarQ.
Side note: Shizuku also will run Shizuku API services as root
if it's started as root, from a rooted device. You can also use its sibling, Sui, which uses the same API and always runs as root.
from libsu.
Wait now I'm very confused. I was talking about Shizuku-API.
Can't it be used to perform all su operations? Look what I was told:
RikkaApps/Shizuku#229 (comment)
shizuku is lower level than the su or adb commands. If you like, you can implement the commands you need yourself.
Also:
Question: "Does Shizuku support replacement of "su" commands, so that you could run them on a non-rooted device?"
Answer: "Of course, you can implement something like "su" , but you need to some more codes."
I was also told to do it for the "Runtime.exec".
And the issue was closed even though I still believe it can't do it, and wanted them to show more explanation.
So is there any library that will allow to perform operations that were possible only on a rooted device, yet on a non-rooted device?
For example copying files from a protected folder, or even get the list of files of a protected folder?
from libsu.
Let's start with your example:
copying files from a protected folder, or even get the list of files of a protected folder?
Depends on the folder. There are a few that are write-accessible to Shell that aren't to normal users, for example /data/local/tmp
and /sdcard/Android/data
, but if you're looking to read from or write to say /data/data
, Shizuku is not sufficient.
My recommendation in general would be:
If you're looking to use something specific with Runtime.exec()
as Shell, use Shizuku API via a binder (UserService as Rikka suggested). This will allow you to run commands as shell, you could even pass an argument to the bound service with your command. But the whole point of Shizuku's API is that running commands and parsing the output is very slow and error-prone, so for your example of listing files, you can just use the regular Java File API from within the Shizuku-bound service. I see you're also asking about chmod and the like, and as Rikka said there's proper Java calls to do that rather than having to use commands.
Like I said though, there is Rish, which if it were in the PATH could be used by Runtime.exec()
in the same way that many apps before libsu and equivalents came along did su -c <command>
from within Runtime.exec()
One thing is for certain though: This isn't something that would be in scope for libsu, I guarantee it.
from libsu.
I mean all folders that I can reach via a rooted device. This included files of other apps (of /data/data/...).
I don't understand how to do it for Runtime.exec() because it's not a service. It's a singleton class that you need to reach via a static function (getRuntime).
I don't understand what Rish is. You mean it's for commands like "cp ..." , "chmod ..." ?
It's a yes/no question, which I asked them (and they said yes):
Can Shizuku-API (or anything else) be a complete replacement of having a rooted device and using su commands on it?
If I want to copy files from /data/data/some_other_app_package_name , will it let me do it even on a non-rooted device?
from libsu.
The people in Shizuku-API insist that it's possible when I asked about the limitations of it:
Can you reach (read/copy) files on protected files of another app (in "/data/data/package_name_of_another_app/") , for example?
Yep, It would be possible to do this with Shizuku
RikkaApps/Shizuku-API#15 (comment)
from libsu.
Look, there's a really easy way to show you which folders you can access.
Open adb shell
. Try to cd
into an app's data. For example cd /data/data/com.google.android.apps.nexuslauncher
.
You will get permission denied. You can only get into an app's data if it's debuggable and you use run-as
.
ADB shell is running as shell
, the same as Shizuku, unless - like I said - it's been started as root, in which case it's the same as running through libsu. But that is only the case on a rooted device.
Your intention appears to be accessing app data of other production apps. You cannot do this with Shizuku alone. There's limited app data access with adb backup
and adb restore
that could probably be used via Shizuku API, but that's limited to apps that allow it.
Again, this is most definitely not something that is in scope for libsu.
from libsu.
@KieronQuinn Yes, I know that. This is why I'm surprised to see them saying that Shizuku can reach such folders, still (without root). This is also why I've given this simple example.
The reason I requested something of libsu, is that if Shizuku could have overcome this and offer root-only operations for non-rooted devices, libsu could have a fork (or added functions/classes here) that instead of running commands as usual, it would send them via Shizuku.
This way, every person that uses libsu could also offer Shizuku support with very little effort.
So something here is weird. Maybe they don't understand what I'm saying and asking? They constantly talk about me not reading the manual, but I don't see anything in the manual talking about such a thing, including even how to try it out.
from libsu.
The manual for using Shizuku API is here: https://github.com/RikkaApps/Shizuku-API#guide, I've followed it numerous times setting up apps so I suggest you try it out. There's no point this being added to libsu when it's already available and easily possible to make both su and Shizuku variants where it's possible.
from libsu.
@KieronQuinn See this is another thing that I find weird there as it's not documented: The docs mention "bindUserService", so this means I can write whatever I wish into the UserService class, and it will run on the process that Shizuru created, supposedly as a root device?
If so, this is quite a general solution, no? I could just have there the call to the shell commands, no? And for specific cases that there is an API, I could use it instead.
Thing is, still, as my original question: I don't think it will let me reach the protected files.
I've tried now to add this to the class "UserService" (sample here: Shizuku-API.zip ) :
@Override
public String doSomething() throws RemoteException {
final File protectedFolder = new File("/data/data/com.android.vending");
final String[] innerFiles = protectedFolder.list();
int childCount = innerFiles == null ? 0 : innerFiles.length;
String message="protectedFolder:" + protectedFolder + " exists?" + protectedFolder.exists() + " readable?" + protectedFolder.canRead() + " childCount:" + childCount;
return message;
}
And indeed it shows it can't reach it.
I was about to post there, and they blocked me:
RikkaApps/Shizuku-API#15 (comment)
from libsu.
It's used in the demo, as the guide says: https://github.com/RikkaApps/Shizuku-API/blob/28c6d65ff47f66277422019e87fa56c85e326f78/demo/src/main/java/rikka/shizuku/demo/DemoActivity.java
But I can tell you from the off that that will not work. Shell does not have access to that directory.
from libsu.
@KieronQuinn I used the demo. I modified it in the "UserService" class inside, and it showed it can't. That's why I think they are wrong that it can somehow do what only a rooted device can (such as reaching protected folders).
I don't understand why they blocked me. Is there any way to become unblocked? Is it temporary?
Why are they so rude about it?
Have you ever had such an experience somewhere on Github?
Anyway, I close this post as I don't believe they are correct on this.
If you think I'm wrong in how I tested it, please let me know.
from libsu.
You keep asking if Shizuku can be used like "su", our understanding is you are too lazy to read the document and write new codes, but your real problem is if Shizuku can elevate the privilege from adb to root. The answer is no, of course. We all take this and what adb can do as basic knowledge.
from libsu.
@RikkaW I wrote it as such because that's how it started : I have some apps that use them already on libsu, and of course they require root. Some would require just adb, of course, but some won't. That's why I asked about all possible commands and not specific ones.
I don't think there is a point in asking about "su" if it's not in a rooted environment.
Sorry that the way I wrote it didn't make it clear that my question is about the limitations, if they are still as I know they should.
I suggest to update the repository to explain the limitations (and fix the typo of "bidner" which is supposed to be "binder"), because users ask this and you can see that even a weird question as I wrote got a few upvotes on reddit...
Anyway sorry for the time wasted and I wish you well.
from libsu.
Related Issues (20)
- The jni layer cannot get su correctly HOT 3
- [FR] add ROOT_MOUNT_MASTER feature check to the `example` HOT 1
- Service connect from\to RootService HOT 2
- SuFile.isDirectory() can throw NoShellException (and shouldn't) HOT 4
- Missing Proguard / R8 Config causes crashes HOT 4
- Hey
- RootService seems not working with debug mode ? HOT 1
- Provide settings without debugging RootService
- RootService failed with low version magisk HOT 1
- Add custom logger
- InvocationTargetException HOT 1
- "No such file or directory" when opening file through shell HOT 3
- Version 5.0.4 not work for Virtual Machine like VMOS and VPhoneGaga, please check and fix it HOT 3
- RootService: SQLiteDatabase.openDatabase makes it crash HOT 3
- How do I transfer to Android tablet
- Crashing in onInit() HOT 4
- Remove ROOT_MOUNT_MASTER status HOT 1
- How do I simulate Control + C for a process HOT 3
- 使用360加固后无法绑定RootService HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsu.