From c606b5fbee51e3f38069d792219561bfee24a8cf Mon Sep 17 00:00:00 2001 From: Cooper Quintin Date: Tue, 22 Oct 2024 12:40:59 -0700 Subject: [PATCH 1/3] fix nits --- dist/install-common.sh | 28 ++++++++++++++++------------ rootshell/src/main.rs | 10 +++++----- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/dist/install-common.sh b/dist/install-common.sh index ba100a8..1b29003 100755 --- a/dist/install-common.sh +++ b/dist/install-common.sh @@ -27,14 +27,14 @@ force_debug_mode() { } wait_for_atfwd_daemon() { - until [ -n "$($ADB shell 'pgrep atfwd_daemon)'" ] + until [ -n "$(_adb_shell 'pgrep atfwd_daemon')" ] do sleep 1 done } wait_for_adb_shell() { - until $ADB shell true 2> /dev/null + until _adb_shell true 2> /dev/null do sleep 1 done @@ -47,29 +47,33 @@ setup_rootshell() { "$SERIAL_PATH" "AT+SYSCMD=chown root /bin/rootshell" sleep 1 "$SERIAL_PATH" "AT+SYSCMD=chmod 4755 /bin/rootshell" - $ADB shell /bin/rootshell -c id + _adb_shell '/bin/rootshell -c id' echo "we have root!" } _adb_push() { - $ADB push "$(dirname "$0")/$1" "$2" + "$ADB" push "$(dirname "$0")/$1" "$2" +} + +_adb_shell() { + "$ADB" shell "$1" } setup_rayhunter() { - $ADB shell '/bin/rootshell -c "mkdir -p /data/rayhunter"' + _adb_shell '/bin/rootshell -c "mkdir -p /data/rayhunter"' _adb_push config.toml.example /data/rayhunter/config.toml _adb_push rayhunter-daemon /data/rayhunter/ _adb_push scripts/rayhunter_daemon /tmp/rayhunter_daemon _adb_push scripts/misc-daemon /tmp/misc-daemon - $ADB shell '/bin/rootshell -c "cp /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"' - $ADB shell '/bin/rootshell -c "cp /tmp/misc-daemon /etc/init.d/misc-daemon"' - $ADB shell '/bin/rootshell -c "chmod 755 /etc/init.d/rayhunter_daemon"' - $ADB shell '/bin/rootshell -c "chmod 755 /etc/init.d/misc-daemon"' + _adb_shell '/bin/rootshell -c "cp /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"' + _adb_shell '/bin/rootshell -c "cp /tmp/misc-daemon /etc/init.d/misc-daemon"' + _adb_shell '/bin/rootshell -c "chmod 755 /etc/init.d/rayhunter_daemon"' + _adb_shell '/bin/rootshell -c "chmod 755 /etc/init.d/misc-daemon"' echo -n "waiting for reboot..." - $ADB shell '/bin/rootshell -c reboot' + _adb_shell '/bin/rootshell -c reboot' # first wait for shutdown (it can take ~10s) - until ! $ADB shell true 2> /dev/null + until ! _adb_shell true 2> /dev/null do sleep 1 done @@ -82,7 +86,7 @@ setup_rayhunter() { test_rayhunter() { URL="http://localhost:8080" - $ADB forward tcp:8080 tcp:8080 > /dev/null + "$ADB" forward tcp:8080 tcp:8080 > /dev/null echo -n "checking for rayhunter server..." SECONDS=0 diff --git a/rootshell/src/main.rs b/rootshell/src/main.rs index ca9e5b5..c380272 100644 --- a/rootshell/src/main.rs +++ b/rootshell/src/main.rs @@ -16,11 +16,11 @@ fn main() { // processes in specific groups. More info here: // https://www.elinux.org/Android_Security#Paranoid_network-ing #[cfg(target_arch = "arm")] { - let gids = &[ - Gid::from_raw(3003), // AID_INET - Gid::from_raw(3004), // AID_NET_RAW - ]; - nix::unistd::setgroups(gids).expect("setgroups failed"); + let gids = &[ + Gid::from_raw(3003), // AID_INET + Gid::from_raw(3004), // AID_NET_RAW + ]; + nix::unistd::setgroups(gids).expect("setgroups failed"); } // discard argv[0] From a85856442fe05b9080e7d2edc2b107d12ff24426 Mon Sep 17 00:00:00 2001 From: Cooper Quintin Date: Tue, 22 Oct 2024 12:46:34 -0700 Subject: [PATCH 2/3] fix release script --- .github/workflows/build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 14d6162..fa4037b 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -8,7 +8,7 @@ env: CARGO_TERM_COLOR: always jobs: - build_serial_and_check: + build_serial: strategy: matrix: platform: From 6d3d96fa4505966911aced3bc427684dde869f74 Mon Sep 17 00:00:00 2001 From: Cooper Quintin Date: Tue, 22 Oct 2024 12:46:34 -0700 Subject: [PATCH 3/3] fix release script --- .github/workflows/build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 14d6162..fa4037b 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -8,7 +8,7 @@ env: CARGO_TERM_COLOR: always jobs: - build_serial_and_check: + build_serial: strategy: matrix: platform: