[Q] Root permissions using JNI interface - Android Software Development

Hi all, i have one question i'd like to know if it is possible,
I'm the developer of "droid VNC server", and to access the framebuffer i need root permissions, to do so i have a daemon running with is executed after getting root ("su") permissions.
I wanted to not have a real daemon executable, but use the JNI interface so i could easily add notifications of the android system when for instance a user connects to the server...
Is this possible?
Thanks

Related

How to use root access on Android app

Hi,
I want to use root access on my android app, but I don't know how to get root access and how to use it. I've searched Internet and found someone said that I should call
Runtime.getRuntime().exec("su");
But when I did that the system asked me to give root access to my app, I choose yes, but app still cannot perform any root operations like listening on TCP port 80
please help me
Thank you in advanced!!
Alex
I'm sure there's some reason why it would fail because it seems too obvious, but my first guess would be to get a shell, su to root, then
chmod u+s whatever.apk

[Q] Enable ADB From Code (Temporary Root)

Hello again, and thanks in advance for all your help.
Without going into excessive detail about my project, here is what I need to accomplish:
I want to be able to turn on USB Debugging (ADB) from within my app. For simplicity, lets just say I want to create a clone of the developer settings page, where a checkbox can turn USB Debugging on and off.
I know this can be done through terminal applications by typing:
Code:
setprop persist.service.adb.enable 1
Currently, my code is trying something like this:
Code:
Process process = Runtime.getRuntime().exec(
new String[]{"setprop", "persist.service.adb.enable", "1"});
This isn't giving me any errors or exceptions, but it is also not changing the value. I assume this is a permission issue. I know this isn't designed to be allowed by Android for security reasons, and this isn't an app that I will try and release. This is just for a single-purpose device, (a Galaxy Tab if that is relevant).
My goal here is to NOT have to enable permanent root on the device. I am able to accomplish what I'm attempting by rooting the device, and calling "su" before my setprop commands. For security reasons, I would prefer to NOT have su even available on the device. I am hoping that I can make whatever changes I need during a temporary root (using rageagainstthecage method) and then not have root after the device is restarted.
I'm fairly new to Linux, so all of my knowledge of it is limited to what I have learned from Android and my rooting experience. I was thinking that if I made a shell script that called setprop for me, I could somehow give that permission to run as root, and simply run that script from my app? The script would be something very simple like this:
Code:
echo Running ENABLE Debugging Script
setprop persist.service.adb.enable 1
Then I could call if from my app with:
Code:
Process process = Runtime.getRuntime().exec(
new String[]{"/pathToScript/enableDebugScript.sh"});
Does anyone know how (I assume through use of CHMOD?) I could give this script permission to run as root? Or is there a better way to execute shell commands with elevated privledges from within a standard Android application?
Thanks for all the help, let me know if I can clarify anything. As always, I appreciate the assistance.

[Q] How do i Install Openvpn on Lenged?

Hi,
I tried for hours but cannot get OpenVPN to run or install.
I have the Blayo 0.8.4 Rom installed and know that
ifconfig is in
/system/xbin/ifconfig
and tun.ko is located in
/system/lib/modules/tun.ko
When i run the OpenVPN installer from the market it asks me where to put the files and asks for Superuser permission - but when the app wants to do the copying the phone hangs and does a reboot.
The OpenVPN Library File i used is from here (Sorry its German):
http://www.android-hilfe.de/anleitungen-fuer-motorola-milestone/28392-how-openvpn-auf-dem-milestone.html#post321528
So can anybody help me to get OpenVPN running?
I sadly cannot use the preinstalled VPN methods, because my University Wlan only supports Cisco-VPN or OpenVPN Method.
I thought it might be the problem that OpenVPN installer cannot write to the system Partition -- so i opend a local Terminal in ConnectBot and typed
aufs --enable
But there i get the Message:
Enabling Read-Write /system overlay
/data/local/dosysoverlay: Permission denied
Please reboot your phone for changes to take effect
But after a reboot the OpenVPN installer still doesn't work...
I hope someone has a idea or solution to my problem!
Thanks a lot!
Try enabling system overlay via Terminal Emulator or ADB.
Sent from my HTC Legend using XDA Premium App
You need to su to gain root privileges before executing aufs. Or use adb shell which already has root privileges.
Sent from my HTC Legend
Thanks a lot BlaYo!
I opened a local Session in ConnectBot
then i typed
su (I had to allow SuperUser Access!)
aufs --enable
And it worked!
Its me again -- the installation of OpenVPN works, but i cannot open a connection.
When i try to open the the Connection it asks for username and password,
But then it says:
cannot load ca cert /sdcard/openvpn/RRZE-ca.crt path (null)
I searched with google and found that maybe it is a permission problem, but
su
chmod 555 RRZE-ca.crt
still didn't help
chmod 777 RRZE-ca.crt
also didn't help...
i also edited the config File to
...
ca //sdcard/openvpn/RRZE-ca.crt
...
or:
ca /sdcard/openvpn/RRZE-ca.crt
or ca RRZE-ca.crt
it's alsways the same :-(
The Config files for my university's OpenVPN is here:
RRZE-ca.crt
RRZE-full-tunnel.ovpn
I appreciate every help or idea you might help!
Rename it to ca.crt and edit config file accordingly.

[Q] How can i get ADB ROOT? i want to know rageagainstthecage's working principle

hi,guys!
as this title says i found a tool named "rageagainstthecage",but i want to know how dose it work.Can anyone help me ? thanks
try superoneclick
Are you using Linux to grant root access on your Defy?
I rooted mine yestarday and I was a little confused on how to make it, I have same file as you as I read. rageagainstthecage is the exploit that will you grant root privileges. The instructions for linux are here [1]. I replaced 'exploit.bin' with 'rageagainstthecage' or you can use the one provided in that post 'psneuter', the proccess is simple
1. Copy files to phone using adb (I used /data/local/tmp as directory in the phone): su, busybox, Superuser.apk and exploit (exploit name, let's say: rageagainstthecage)
2. Make the exploit executable and execute it
3. Give permissions to the commands su and busybox
4. There you go
All the credits for the autor of the post on IBM forum
I hope this help you with your question
[1]
PHP:
www_ibm_com/developerworks/mydeveloperworks/blogs/coolwinding/entry/how_to_root_defy_on_linux1
jianbangguo said:
try superoneclick
Click to expand...
Click to collapse
Dose the superoneclick use "rageagainstthecage" to grant adb root access? i just want to know "rageagainstthecage", how dose it work? can you help me? thanks
cristianpark said:
Are you using Linux to grant root access on your Defy?
I rooted mine yestarday and I was a little confused on how to make it, I have same file as you as I read. rageagainstthecage is the exploit that will you grant root privileges. The instructions for linux are here [1]. I replaced 'exploit.bin' with 'rageagainstthecage' or you can use the one provided in that post 'psneuter', the proccess is simple
1. Copy files to phone using adb (I used /data/local/tmp as directory in the phone): su, busybox, Superuser.apk and exploit (exploit name, let's say: rageagainstthecage)
2. Make the exploit executable and execute it
3. Give permissions to the commands su and busybox
4. There you go
All the credits for the autor of the post on IBM forum
I hope this help you with your question
[1]
PHP:
www_ibm_com/developerworks/mydeveloperworks/blogs/coolwinding/entry/how_to_root_defy_on_linux1
Click to expand...
Click to collapse
pardon my poor english,I just want to know how dose it work, for example : rageagainstthecage's Working principle,not how to use "rageagainstthecage" to grant root access,thank you !!
The principle of how it works is very simple, the rageinthecage exploit just forks proccesses until the proccessor hits the max, then the system will kill the olders apps, because you are using adb and running psneuter, the system will kill the adb shell, and here is the magic, when you restart the adb shell it start with root rights, to prevent that, inmediatly adb starts, the system calls setuid function, but because the proccesses list is full, the explot prevents the setuid call, allowing you to maintain the root rights, and in that point, you push Superuser.apk to allow the root access to the apps, changin before the permissions to the su binary allowing you to call that binary with a less rights user, that is the idea beyond the exploit!, wish that help you!
Sorry for the bad english
LeonardoJegigzem said:
The principle of how it works is very simple, the rageinthecage exploit just forks proccesses until the proccessor hits the max, then the system will kill the olders apps, because you are using adb and running psneuter, the system will kill the adb shell, and here is the magic, when you restart the adb shell it start with root rights, to prevent that, inmediatly adb starts, the system calls setuid function, but because the proccesses list is full, the explot prevents the setuid call, allowing you to maintain the root rights, and in that point, you push Superuser.apk to allow the root access to the apps, changin before the permissions to the su binary allowing you to call that binary with a less rights user, that is the idea beyond the exploit!, wish that help you!
Sorry for the bad english
Click to expand...
Click to collapse
Great info, thanks for sharing this with us I was wondering the same

Fake 'su' using service started through adb shell

Many of the root tools/apps such as screencast, Helium... allow an option to start a background service through adb shell, and then connect to this service to execute commands with elevated permissions.
My idea is around generalizing this experience. There is only one app that starts a background service and acts as a proxy for all other apps (like the SuperSu app).
To make this interaction compatible with all root apps, I was thinking to writing a shell script "su" which redirects all the arguments to the above service.
This will give users with non-rooted devices access to many of the root apps.
But this will require the "su" script to be in the $PATH directory.
[Q] Is there a way to change the $PATH variable from adb shell (without root) so that it is retained system-wide? Any alternatives?

Categories

Resources