A run-as implementation without the app-debuggable capability check — run a
command in any installed app's uid / SELinux / data-directory context on a rooted
device. (Equivalent in purpose to JEB's ranod.)
Requires the Android NDK and CMake.
export NDK=/path/to/android-ndk
for ABI in arm64-v8a armeabi-v7a x86_64 x86; do
cmake -S . -B build/$ABI \
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=$ABI -DANDROID_PLATFORM=android-24
cmake --build build/$ABI -j
doneBinaries land at build/<abi>/jrunas.
jrunas is launched as root on a rooted device:
adb push build/arm64-v8a/jrunas /data/local/tmp/jrunas
adb shell su -c '/data/local/tmp/jrunas <package-name> [--user <id>] [<command> [<args>]]'The packages.list parser has host unit tests:
c++ -std=c++17 -I. tests/test_packages_list.cpp packages_list.cpp -o /tmp/jrunas_test_pl
/tmp/jrunas_test_pl