Skip to content

Commit e1370c9

Browse files
committed
1 parent 6b4e6ec commit e1370c9

File tree

1 file changed

+78
-72
lines changed

1 file changed

+78
-72
lines changed

README.md

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -372,85 +372,86 @@ Thanks to [Frank from Redroid](https://github.com/zhouziyang)!
372372
[https://github.com/remote-android/redroid-doc/tree/master/native_bridge](https://github.com/remote-android/redroid-doc/tree/master/native_bridge)
373373

374374
```bash
375-
sudo cp ./native-bridge.tar /tmp/
376-
cd /tmp
377-
378375
# warning, this will extract overwriting /etc/system/... so make sure you're in /tmp
379-
sudo tar -xvf ./native-bridge.tar
376+
cd /tmp \
377+
&& sudo wget https://github.com/sickcodes/dock-droid/raw/master/native-bridge.tar.gz \
378+
&& sudo tar -xzvf native-bridge.tar.gz \
379+
&& sudo rm native-bridge.tar.gz
380+
381+
sudo touch /tmp/system/vendor/etc/init/nativebridge.rc
382+
sudo tee /tmp/system/vendor/etc/init/nativebridge.rc <<EOF
383+
on early-init
384+
setprop ro.product.cpu.abilist x86_64,arm64-v8a,x86,armeabi-v7a,armeabi
385+
setprop ro.product.cpu.abilist64 x86_64,arm64-v8a
386+
setprop ro.product.cpu.abilist32 x86,armeabi-v7a,armeabi
387+
setprop ro.dalvik.vm.isa.arm x86
388+
setprop ro.dalvik.vm.isa.arm64 x86_64
389+
setprop ro.enable.native.bridge.exec 1
390+
setprop ro.dalvik.vm.native.bridge libndk_translation.so
391+
setprop ro.ndk_translation.version 0.2.2
392+
EOF
380393

381-
# sudo cp ./nativebridge.rc /tmp/system/vendor/etc/init/nativebridge.rc
382-
# sudo rm ./nativebridge.rc /tmp/system/vendor/etc/init/houdini.rc
383394

384-
sudo sed -i '/ro.dalvik.vm.native.bridge=0/d' /tmp/system/build.prop
385-
sudo sed -i '/ro.product.cpu.abilist32=/d' /tmp/system/build.prop
386-
sudo sed -i '/ro.product.cpu.abilist=/d' /tmp/system/build.prop
387-
sudo sed -i '/ro.product.cpu.abi=/d' /tmp/system/build.prop
395+
# # Enable native bridge for target executables
396+
# on early-init
397+
# mount binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
388398

389-
sudo tee -a /tmp/system/build.prop <<'EOF'
390-
ro.dalvik.vm.native.bridge=libndk_translation.so
391-
ro.product.cpu.abilist=x86_64,arm64-v8a,x86,armeabi-v7a,armeabi
392-
ro.product.cpu.abilist32=x86,armeabi-v7a,armeabi
393-
ro.ndk_translation.version=0.2.2
394-
EOF
395-
# don't forget to unmount
396-
```
399+
# on property:ro.enable.native.bridge.exec=1
400+
# copy /system/etc/binfmt_misc/arm_exe /proc/sys/fs/binfmt_misc/register
401+
# copy /system/etc/binfmt_misc/arm_dyn /proc/sys/fs/binfmt_misc/register
397402

398-
### Enable ADB INSECURE Android x86 BlissOS
403+
# on property:ro.enable.native.bridge.exec64=1
404+
# copy /system/etc/binfmt_misc/arm64_exe /proc/sys/fs/binfmt_misc/register
405+
# copy /system/etc/binfmt_misc/arm64_dyn /proc/sys/fs/binfmt_misc/register
399406

400-
```bash
401-
sudo tee -a /tmp/system/build.prop <<'EOF'
402-
persist.service.adb.enable=1
403-
persist.service.debuggable=1
404-
persist.sys.usb.config=mtp,adb
405-
ro.allow.mock.location=1
406-
persist.adb.notify=0
407-
persist.sys.usb.config=mtp,adb
407+
408+
# add armeabi
409+
sudo sed -i -e 's/abilist32\=x86\,armeabi\-v7a/abilist32\=x86\,armeabi\-v7a\,armeabi/g' /tmp/system/vendor/build.prop
410+
sudo sed -i -e 's/abilist\=x86_64\,x86\,arm64\-v8a\,armeabi\-v7a/abilist\=x86_64\,x86\,arm64\-v8a\,armeabi\-v7a\,armeabi/g' /tmp/system/vendor/build.prop
411+
412+
sudo rm /tmp/system/bin/enable_nativebridge \
413+
/tmp/system/etc/binfmt_misc/arm_exe \
414+
/tmp/system/etc/binfmt_misc/arm64_dyn \
415+
/tmp/system/etc/binfmt_misc/arm_dyn \
416+
/tmp/system/etc/binfmt_misc/arm64_exe
417+
418+
sudo rm /tmp/system/vendor/etc/binfmt_misc/*
419+
420+
sudo rm /tmp/system/etc/init/houdini.rc
421+
422+
sudo tee -a /tmp/system/product/build.prop \
423+
-a /tmp/system/vendor/build.prop \
424+
-a /tmp/system/build.prop <<EOF
425+
ro.product.cpu.abilist64=x86_64,arm64-v8a
426+
ro.product.cpu.abilist32=x86,armeabi-v7a,armeabi
427+
ro.dalvik.vm.isa.arm=x86
428+
ro.dalvik.vm.isa.arm64=x86_64
429+
ro.enable.native.bridge.exec=1
430+
ro.dalvik.vm.native.bridge=libndk_translation.so
408431
ro.secure=0
409-
ro.adb.secure=0
410432
ro.debuggable=1
433+
ro.adb.secure=0
411434
service.adb.root=1
412-
persist.sys.root_access=1
413-
persist.service.adb.enable=1
414435
EOF
415-
# don't forget to unmount
416-
```
417436

418-
### Enable even more insecure Android x86 BlissOS
419-
```bash
420-
sudo tee -a /tmp/system/build.prop <<'EOF'
421-
ro.boot.selinux=permissive
422-
androidboot.selinux=permissive
423-
persist.android.strictmode=0
424-
persist.selinux.enforcing=0
425-
ro.build.selinux.enforce=0
426-
security.perf_harden=0
427-
selinux.reload_policy=0
428-
selinux.sec.restorecon=0
429-
430-
persist.sys.strict_op_enable=false
431-
persist.sys.strictmode.disable=1
432-
persist.sys.strictmode.visual=false
433-
ro.config.knox=0
434-
sys.knox.exists=0
435-
sys.knox.store=0
436-
dev.knoxapp.running=false
437-
init.svc.knox=stopped
438-
ro.config.sec_storage=0
439-
ro.securestorage.knox=false
440-
ro.securestorage.support=false
441-
ro.config.tima=0
442-
ro.config.timaversion=0
443-
ro.sec.fle.encryption=false
444-
persist.security.ams.enforcing=0
445-
ro.config.kap_default_on=false
446-
ro.config.rkp=false
447-
drm.service.enabled=false
448-
init.svc.drm=stopped
449-
init.svc.mediadrm=stopped
450-
init.svc.drmservice=stopped
451-
oma_drm.service.enabled=false
437+
# also swap libhoudini to libndk_translation in the ramdisk
438+
mkdir -p /tmp/ramdisk
439+
sudo /bin/bash -c "
440+
cd /tmp/ramdisk \
441+
&& zcat /tmp/image/bliss-x86-11.13/ramdisk.img | cpio -iud \
442+
&& sed -i -e 's/libhoudini/libndk_translation/g' /tmp/ramdisk/default.prop
443+
&& touch /tmp/image/bliss-x86-11.13/ramdisk.img
444+
&& { find . | cpio -o -H newc | gzip > /tmp/ramdisk.img.new ; } \
445+
&& mv /tmp/ramdisk.img.new /tmp/image/bliss-x86-11.13/ramdisk.img'
446+
"
447+
448+
# sudo tee -a /tmp/system/build.prop <<'EOF'
449+
# ro.dalvik.vm.native.bridge=libndk_translation.so
450+
# ro.product.cpu.abilist=x86_64,arm64-v8a,x86,armeabi-v7a,armeabi
451+
# ro.product.cpu.abilist32=x86,armeabi-v7a,armeabi
452+
# ro.ndk_translation.version=0.2.2
453+
# EOF
452454

453-
EOF
454455
# don't forget to unmount
455456
```
456457

@@ -468,7 +469,7 @@ zcat /tmp/image/bliss-x86-11.13/ramdisk.img | cpio -iud && mv /tmp/ramdisk/init
468469
wget -O /tmp/ramdisk/init https://github.com/axonasif/rusty-magisk/releases/download/v0.1.7/rusty-magisk_x86_64
469470
470471
chmod a+x /tmp/ramdisk/init
471-
touch /tmp/image/bliss-x86-11.13/ramdisk.img:
472+
touch /tmp/image/bliss-x86-11.13/ramdisk.img
472473
/bin/bash -c 'find . | cpio -o -H newc | sudo gzip > /tmp/image/bliss-x86-11.13/ramdisk.img'
473474
"
474475
sudo rm -rf /tmp/ramdisk
@@ -481,15 +482,15 @@ During the next boot you will have Magisk installed.
481482
### Add secure ADB keys.
482483

483484
```bash
484-
# put some keys in the box and copy to your host ~/.android folder
485-
mkdir -p /tmp/image/bliss-x86-11.13/data/.android
486-
mkdir -p /tmp/image/bliss-x86-11.13/data/misc/adb
487-
485+
# generate keys if you don't have already
488486
KEYNAME=adbkey
489487
adb keygen ~/.android/"${KEYNAME}"
490488
touch ~/.android/"${KEYNAME}.pub"
491489
adb pubkey ~/.android/"${KEYNAME}" > ~/.android/"${KEYNAME}.pub"
492490

491+
# put some keys in the box and copy to your host ~/.android folder
492+
mkdir -p /tmp/image/bliss-x86-11.13/data/.android
493+
mkdir -p /tmp/image/bliss-x86-11.13/data/misc/adb
493494
tee /tmp/image/bliss-x86-11.13/data/misc/adb/adb_keys < ~/.android/"${KEYNAME}.pub"
494495
# don't forget to unmount
495496
```
@@ -501,6 +502,7 @@ After completing any of the above automation, you need to unmount the disk.
501502
```bash
502503
# sudo mount /tmp/image/bliss-x86-11.13/ramdisk.img /tmp/ramdisk
503504
# unmount both disks when you're done
505+
sudo umount /tmp/ramdisk
504506
sudo umount /tmp/system
505507
sudo umount /tmp/image
506508
sudo qemu-nbd -d /dev/nbd0
@@ -509,7 +511,9 @@ sudo qemu-nbd -d /dev/nbd0
509511
# Use Frida (latest)
510512
```bash
511513
# choose a version from https://github.com/frida/frida/releases/
514+
# use arm if you're debugging arm apps, via houdini or native bridge (ndk)
512515
HOST_ARCH=x86_64
516+
# HOST_ARCH=arm
513517
GUEST_SYS=android
514518
FRIDA_RELEASE=frida-server
515519

@@ -552,6 +556,8 @@ start adbd
552556
# setprop persist.adb.tcp.port 5555
553557
```
554558

559+
Connect to the virtual WiFi inside Android!
560+
555561
Now, from the host, use the new key to `adb` into the guest:
556562

557563
```bash

0 commit comments

Comments
 (0)