mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-07-17 13:28:10 -07:00
rootshell: use seteuid/setegid instead
This is also what sshell does.
This commit is contained in:
committed by
Cooper Quintin
parent
a5b784c259
commit
8e256b6455
+4
-10
@@ -1,5 +1,3 @@
|
||||
#![feature(setgroups)]
|
||||
|
||||
//! a simple shell for uploading to the orbic device.
|
||||
//!
|
||||
//! It literally just runs bash as UID/GID 0
|
||||
@@ -7,23 +5,19 @@ use std::process::Command;
|
||||
use std::os::unix::process::CommandExt;
|
||||
use std::env;
|
||||
|
||||
const ANDROID_PARANOID_NETWORK_GROUPS: &[u32] = &[
|
||||
3001, // AID_BT
|
||||
3002, // AID_BT_NET
|
||||
3003, // AID_INET
|
||||
3004, // AID_NET_RAW
|
||||
3005, // AID_ADMIN
|
||||
];
|
||||
use nix::unistd::{Gid, Uid};
|
||||
|
||||
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");
|
||||
|
||||
// discard argv[0]
|
||||
let _ = args.next();
|
||||
Command::new("/bin/bash")
|
||||
.args(args)
|
||||
.uid(0)
|
||||
.gid(0)
|
||||
.groups(ANDROID_PARANOID_NETWORK_GROUPS)
|
||||
.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user