Cleanup rootshell, add better setup/testing to install script

This commit is contained in:
Will Greenberg
2024-07-22 19:17:01 -07:00
committed by Cooper Quintin
parent 8e256b6455
commit f18b993df3
3 changed files with 47 additions and 7 deletions

View File

@@ -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();