su

Root detection methodology in android which cannot be bypassed

筅森魡賤 提交于 2019-12-03 16:17:38
I know that running an app which possess sensitive information on a rooted device is not secure at all. So developers usually do root detection in such cases and if the device is found rooted,then that app won't get installed. everything is ok. The major techniques used by developers in root detection are checking for the superuser.apk file,check for chainfire,busybox,executing su command,etc. But an attacker can simply bypass these checks by several means like renaming the superuser.apk to superuser0.apk. So what I am looking for is a unique solution for this issue where the root detection

Android- performing su commands programatically does not work

随声附和 提交于 2019-12-03 14:31:56
I need my app to perform some su commands programatically (phone is rooted). When done using adb, the commands work. For instance: su -c "mkdir /sdcard/testdir" creates a directory called "testdir" in /sdcard. When I call: p = Runtime.getRuntime().exec("su -c \"mkdir /sdcard/testdir\""); p.waitFor(); It just moves on and no change happens. I tried reading the input: DataInputStream dis = new DataInputStream(p.getInputStream()); while((temp = dis.readLine())!=null) Log.d(ctx.TAG,"shell:"+temp); But it reports nothing (loop does 0 iterations). Has anyone ever faced this issue before? How can it

Ubuntu/linux在未知root密码的情况下修改root密码. 史上最简单实用的一种办法

孤街醉人 提交于 2019-12-03 08:50:24
 在未知root密码,未知任何用户身份密码的情况下修改root密码,进而修改任何用户的密码.Ubuntu/linux. 史上最简单实用的一种办法 By 韩大卫@吉林师范大学 大致上分为两步: 一, 进入可读写的root用户模式. 二, 修改root密码. 开机按 F12 (或长按Shift), 进入GRUB界面. 一, 选择 Advanced options for Ubuntu 二, 可以看到两个模式, 1, Ubuntu, Linux 3.5.0-17-generic 2, Ubuntu, Linux 3.5.0-17-generic (恢复模式) (或recovery mode) 在恢复模式处, 按e, 进入Ubuntu恢复模式的脚本编辑界面, 找到以下语句: 开头是linux, 后面有 … ro recovery nomodeset 将 ro recovery nomodeset 改为 rw single init=/bin/bash 注 :如不修改此处, 后面进入root后,但是不能修改文件. 以上修改意为改为可读可写的单用户模式, 之后按 Ctrl + x , 进入单用户模式, 此时的用户即位root用户. 以上步骤是为了进入可读写的root用户模式.以下步骤为修改root密码. 进入命令行后, 再输入新的root密码, 在命令行中执行 passwd root

Android Root execute su with parameters

一个人想着一个人 提交于 2019-12-02 11:16:53
I ve got a problem, executing su with parameters (containing blank space?!). My Command.java looks like this: public class Command { Process process; public String executeCommand(String command) { StringBuffer output = new StringBuffer(); try { process = Runtime.getRuntime().exec(command); process.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } String response = output.toString(); return response; } }

Working Directory : null environment when running Process.Builder on android

痴心易碎 提交于 2019-12-02 04:51:48
I am using two phones, Galaxy Nexus(JellyBean) and Nexus 5(KitKat). I am trying to execute a script which exists in /data/folder/scripts/run.sh I use Process.Builder to build the command. This command is built by getting Environment.getDataDirectory().toString() + "/folder/scripts/run.sh" There are no issues running this on the Galaxy Nexus but when I run it on the Nexus 5, I catch an exception when I run the process.start(). The output which I get contains: Error running exec(). Command: [/data/folder/scripts/run.sh, "param"]. Working directory: null Environment: [ADNROID_ROOT=/system ... ]

implement at command on rooted android and get the result

时间秒杀一切 提交于 2019-12-02 02:46:27
问题 I'm a beginner in stackoverflow so I cant add a comment. I saw this page: Read command output inside su process and I tried this answer and it is ok: Process p = Runtime.getRuntime().exec(new String[]{"su", "-c", "system/bin/sh"}); DataOutputStream stdin = new DataOutputStream(p.getOutputStream()); //from here all commands are executed with su permissions stdin.writeBytes("ls /data\n"); // \n executes the command InputStream stdout = p.getInputStream(); byte[] buffer = new byte[BUFF_LEN]; int

implement at command on rooted android and get the result

你。 提交于 2019-12-02 02:23:22
I'm a beginner in stackoverflow so I cant add a comment. I saw this page: Read command output inside su process and I tried this answer and it is ok: Process p = Runtime.getRuntime().exec(new String[]{"su", "-c", "system/bin/sh"}); DataOutputStream stdin = new DataOutputStream(p.getOutputStream()); //from here all commands are executed with su permissions stdin.writeBytes("ls /data\n"); // \n executes the command InputStream stdout = p.getInputStream(); byte[] buffer = new byte[BUFF_LEN]; int read; String out = new String(); //read method will wait forever if there is nothing in the stream /

sudo hadoop vs su hadoop

♀尐吖头ヾ 提交于 2019-12-01 13:37:42
Has anybody got into a strange environment issue and been forced to use SU rather than SUDO when calling hadoop commands? sudo su -c 'hadoop fs -ls /' hdfs Found 4 items drwxr-xr-x - hdfs hdfs 0 2014-02-11 12:33 /apps drwx------ - mapred hdfs 0 2014-03-10 10:25 /mapred drwxrwxrwx - hdfs hdfs 0 2014-03-10 10:26 /tmp drwxr-xr-x - hdfs hdfs 0 2014-02-11 12:34 /user The environment allows finding of the executable: sudo -u hdfs 'hadoop' Usage: hadoop [--config confdir] COMMAND where COMMAND is one of: namenode -format format the DFS filesystem ... fs run a generic filesystem user client ... ...

Running an SFTP operation as a different user via Python Paramiko

别来无恙 提交于 2019-12-01 13:30:34
I want connect to my Ubuntu server using a service account but perform file transfer operations on behalf of another user. My sshd_config has the following content (among other stuff): PubKeyAuthentication yes PasswordAuthentication yes Subsystem sftp /usr/lib/openssh/sftp-server I have tried the following code but without any success: t = paramiko.Transport(('<address>', <port>)) t.connect(username='serviceAccount', password='<password>') channel = t.open_session() channel.exec_command('sudo su -l <other user> -c /usr/lib/openssh/sftp-server') sftp = t.open_sftp_client() file = sftp.file("

Running an SFTP operation as a different user via Python Paramiko

隐身守侯 提交于 2019-12-01 11:33:56
问题 I want connect to my Ubuntu server using a service account but perform file transfer operations on behalf of another user. My sshd_config has the following content (among other stuff): PubKeyAuthentication yes PasswordAuthentication yes Subsystem sftp /usr/lib/openssh/sftp-server I have tried the following code but without any success: t = paramiko.Transport(('<address>', <port>)) t.connect(username='serviceAccount', password='<password>') channel = t.open_session() channel.exec_command('sudo