mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-06-12 15:53:30 -07:00
Cleanup rootshell, add better setup/testing to install script
This commit is contained in:
committed by
Cooper Quintin
parent
8e256b6455
commit
f18b993df3
@@ -63,7 +63,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
- name: Fix executable permissions on binaries
|
||||
run: chmod +x serial-*/serial rayhunter-daemon
|
||||
run: chmod +x serial-*/serial rayhunter-daemon/rayhunter-daemon
|
||||
- name: Setup release directory
|
||||
run: mv rayhunter-daemon/rayhunter-daemon rootshell/rootshell serial-* dist
|
||||
- name: Archive release directory
|
||||
|
||||
Vendored
+38
-2
@@ -9,6 +9,7 @@ install() {
|
||||
force_debug_mode
|
||||
setup_rootshell
|
||||
setup_rayhunter
|
||||
test_rayhunter
|
||||
}
|
||||
|
||||
check_adb() {
|
||||
@@ -24,13 +25,17 @@ force_debug_mode() {
|
||||
echo "$SERIAL_PATH"
|
||||
"$SERIAL_PATH" AT
|
||||
echo -n "adb enabled, waiting for reboot"
|
||||
wait_for_adb_shell
|
||||
echo "it's alive!"
|
||||
}
|
||||
|
||||
wait_for_adb_shell() {
|
||||
until adb shell true 2> /dev/null
|
||||
do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
echo "it's alive!"
|
||||
}
|
||||
|
||||
setup_rootshell() {
|
||||
@@ -58,5 +63,36 @@ setup_rayhunter() {
|
||||
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 "/etc/init.d/rayhunter_daemon start"'
|
||||
echo -n "rebooting, this may take a sec..."
|
||||
adb shell '/bin/rootshell -c reboot'
|
||||
|
||||
# first wait for shutdown (it can take ~10s)
|
||||
until ! adb shell true 2> /dev/null
|
||||
do
|
||||
echo -n '.'
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# now wait for boot to finish
|
||||
wait_for_adb_shell
|
||||
|
||||
echo "rebooted successfully!"
|
||||
}
|
||||
|
||||
test_rayhunter() {
|
||||
URL="http://localhost:8080"
|
||||
adb forward tcp:8080 tcp:8080
|
||||
echo -n "checking for rayhunter server..."
|
||||
|
||||
SECONDS=0
|
||||
while (( SECONDS < 30 )); do
|
||||
if curl -L --fail-with-body "$URL" -o /dev/null -s; then
|
||||
echo
|
||||
echo "success! you can access rayhunter at $URL"
|
||||
return
|
||||
fi
|
||||
sleep 1
|
||||
echo -n "."
|
||||
done
|
||||
echo "timeout reached! failed to reach rayhunter url $URL, something went wrong :("
|
||||
}
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
//! a simple shell for uploading to the orbic device.
|
||||
//!
|
||||
//! It literally just runs bash as UID/GID 0
|
||||
//! It literally just runs bash as UID/GID 0, with special Android GIDs 3003
|
||||
//! (AID_INET) and 3004 (AID_NET_RAW).
|
||||
use std::process::Command;
|
||||
use std::os::unix::process::CommandExt;
|
||||
use std::env;
|
||||
|
||||
use nix::unistd::{Gid, Uid};
|
||||
use nix::unistd::Gid;
|
||||
|
||||
fn main() {
|
||||
let mut args = env::args();
|
||||
|
||||
nix::unistd::setegid(Gid::from_raw(0)).expect("setegid(0) failed");
|
||||
nix::unistd::seteuid(Uid::from_raw(0)).expect("seteuid(0) 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]
|
||||
let _ = args.next();
|
||||
|
||||
Reference in New Issue
Block a user