LoginSignup
11

More than 5 years have passed since last update.

Genymotionでsuによるroot端末チェックを回避する

Last updated at Posted at 2015-02-02

Superuserのアプリにて
Settings -> Superuser Access -> Disabledとしていても

MainActivity.java
String message = "Fail. ";
try {
    Process process = Runtime.getRuntime().exec("su");
    process.destroy();
    message = "Success.";
} catch (IOException e) { message += "IOException - " + e.getMessage();
} catch (Exception e) { message += "Exception - " + e.getMessage(); }

のようなコードで試してみると、su自体が存在するせいか実行に成功してしまう。そのためにアプリのroot端末チェックを回避できない。よって、suを実行できないようにしてやればよい。

I. system領域を確認

/Users/bloodysnow% adb shell

root@vbox86p:/ # mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
/dev/block/sda6 /system ext4 ro,relatime,data=ordered 0 0
/dev/block/sdb1 /cache ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/sdb3 /data ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/sdc /mnt/shell/emulated vfat rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0

/dev/block/sda6が/systemとしてマウントされているようだ。

II. system領域を書き込み可能で再マウントする

root@vbox86p:/ # mount -o rw,remount /dev/block/sda6 /system

III. suを適当な名前にrename

root@vbox86p:/ # mv /system/bin/su /system/bin/sux

最初のテストコードを実行してみると、IOExceptionが発生するようになり、root端末チェックを回避できるようになった。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11