This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Determine if running on a rooted device
I would like to know just whether or not a phone is rooted, without requesting root privileges. How can I do that?
Testing if File.Exists("/system/bin/su")? Not sure, I think I cannot due to permissions
Testing if Superuser app is installed? Hmm, I think I need a special permission to use PackageManager and Superuser is not the onlu su manager (I know SuperSU for example)
Trying to run su is not an option because it triggers the su prompt which is something I don't want in a non-root app
Any idea? My purpose is to obtain anonymous statistics on how many devices are rooted, obviously with user's consent :)
Option 1. It is possible, it doesn't need any special permission.
Option 2. The rooted phone may not come with any Superuser manager application.
Option 3. As you said, it's not a good way to detect.
Besides, there's another option that is to check ro.build.tag (using getprop | grep ro.buil.tag or android.os.Build.TAG) if it contains testkeys string.
Edit: for option 1, I would suggest you find by setuid/setgid permission (i.e. find / -perm -2000 -o -perm -4000, and check if su is in the list)
You cannot reliably do this, as what it means for a phone to be "rooted" is not always the same. What all the proposals you will get do is test for some of the popular root-related tools. But it is not possible to detect if the phone has been rooted in a way that does not utilize those tools.
Related
I'm building a custom Android 10 firmware.
I want to prevent the user of the device from being able to copy the firmware code from the device via ADB.
It's a USER build variant.
The user must have ADB access and can't limit it to specific commands.
Currently to get the code he could just do, for example:
adb pull /system/framework/services.jar
How can I modify AOSP to limit this access? Preferably l would like to prevent access to any other way to get the code from a running device.
Note:
I know obfuscation is an option, rather have a stronger prevention.
The user is prevented from going into bootloader mode.
You can restrict shell process to which all partitions it can get access to. This can be achieved by making the changes in SELinux policy.
Reference:
https://source.android.com/security/selinux/customize
I have an app that helps locate your lost android phone and for rooted phones I have a one click convert to system app feature (so it will survive a factory reset).
Now some of my users complains and say it no longer works on devices that uses systemless root. So questions of the day are:
how do I detect if a user has systemless installed programmatically?
how do I use systemless? I guess it is not through the normal SU command
BR. Theis
Well, I had one of my users do some tests on his phone and a simple call like this will tell you if the user has su installed:
which su
Yes, the new systemless root also uses "su" as a command. Details can be found on XDA
I have many questions about Android command. I do not know where I should start But, anyway, I have put all question related Android commands. Here ;
Is subset of Linux commands come in Android by default ? Or, Are we installing something ?
In system/bin, there are lots of commands. Where can I find their meaning ? I have tried man, but man is not built in.
Can I start and stop application via start and stop command ?
Why cannot I run the reboot from terminal emulator ? The error permission is denied.
NOTE : feel free to reedit the question, if you see meaningless part.
Is subset of Linux commands come in Android by default ? Or, Are we installing something ?
A subset exists by default within the system. Things like ls, cd, mkdir, cat etc... are present. You can gain access to a wider range by installing Busy Box on a rooted device, as stated by Zac.
In system/bin, there are lots of commands. Where can I find their meaning ? I have tried man, but man is not built in.
The ADB Page is a good place to start. That covers many of the basic ADB and shell commands. It states near the bottom:
"For a complete list of commands and programs, start an emulator instance and use the adb -help command."
So you can use adb -help on an emualator or device to see a full list of the ADB and shell commands (note I think this list will be android specific commands only, it won't include things like cd,ls and other basic unix commands).
Can I start and stop application via start and stop command ?
No, it states on the ADB dev page:
start ........ Starts (restarts) an emulator/device instance.
stop ........ Stops execution of an emulator/device instance.
To start an application you'll use the am utility iirc it will look something like am start com.your.packagename It's been a while though, I might have syntax wrong. The instructions are listend if you issue the am command by itself with no params in a shell.
Why cannot I run the reboot from terminal emulator ? The error permission is denied.
The system prevents applications from rebooting the device unless they are signed with the same key as the OS. When you use the terminal emulator you are restricted to whatever permissions that application has declared. The reboot permission is not granted to any third party applications, so it won't work correctly from any terminals. You could probably do it if your device was rooted and you used su though
EDIT:
Here is another good resource that lists more of the shell commands
There are not many Linux commands included in android, however if you are rooted you can easily install busybox which has a large range of linux commands.
You need to have root access to reboot your device via the command line (to prevent any old app being able to do it)
I am trying to create a backup of an android device using ADB.
However adb backup -all gives me this error: adb: unable to connect for backup
why am i getting this error?
I know that some device ask for permission to do that, it asks you whether you want to allow the pc to take a backup, but my device isn't.
I am developing android devices, i dont care about messing it up - so can you tell me how i can enable my device to ask for the permission, or even how i can fix this problem
I can use adb shell and it works fine, and so does adb pull/push however i want the backup file, so i really want adb backup to work.
Is there any other way to take an image of the entire android OS and the apps, and settings? (best is if you can point me into a direction where i can find a solution for the problem i said, but i am open to other ideas.)
Thanks!
It seems not all versions of Android support the backup-interface.
so I'm trying to get root access on my Android in order to use Barnacle. But I keep getting the same error, over and over:
$ adb shell
$ rootshell
rootshell: permission denied
What is the deal with this? I mean, seems logical that I need some permissions to access rootshell, but I can't seem to find any way around it.
Anybody knows how?
Is there any other way to get root access to your phone? (An easy way, hopefully)
EDIT 1:
I will clarify the question.
Unix and Linux systems let you retrieve / change lost passwords for root user. Considering this:
Is there an easy way to root an Android device using the terminal on my Mac OS X? My device is an Xperia X10 mini pro.
Or, does anybody know why I get that permission denied error using adb and rootshell in the first place? It's supposed to work, as stated here?
Thnx!
A.
I'm not sure how much of a question this is or not or whether it is appropriate for StackExchange, but I'm gonna answer it anyway. I don't have enough rep to do anything else about the anyway :D
When you are trying to root any android phone in general, you need to run a program that gives you root access. You can't just simply say "adb give-me-root-permissions-please". :) But yeah, Google is your friend in this case. Apparently your phone the Sony Xperia needs a very specific rooting process that is enumerated here: http://forum.xda-developers.com/showthread.php?t=711907
I would recommend asking this kind of question THERE on XDA because that site is dedicated to questions like this. This site is for programming questions and the like :)
TO BE ROOT AT SONY XPERIA
you can use
king root software
or
rootkitXperia L
how to get temproot by 'getroot'
usage
push 'getroot' in device, set permission, and execute 'getroot'
adb push getroot /data/local/tmp
adb shell
$ cd /data/local/tmp
$ chmod 0755 getroot
$ ./getroot
use CVE-2013-6282 vulnerability
kernel start address 0xc0008000
In some cases, modify KERNEL_START_ADDRESS or KERNEL_SIZE in 'getroot.c'