Compare commits

..

No commits in common. "main" and "674d3c6" have entirely different histories.

3 changed files with 29 additions and 6 deletions

View file

@ -1,5 +1 @@
# Remote Code Execution Program
I implemented this for my remote server.
Sometimes ssh can't be possible because of NAT. That's why I add a public remote server as a relay.
# rust-remote

View file

@ -53,12 +53,16 @@ impl Config {
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Payload {
pub sudo: bool,
pub user: String,
pub args: String,
}
impl Payload {
fn print(&self) {
println!("-------");
println!("sudo = {}", self.sudo);
println!("user = {}", self.user);
println!("args = {}", self.args);
}
}

View file

@ -94,8 +94,31 @@ async fn establish_connection(
async fn payload_from_input(debug: bool) -> Option<Payload> {
println!("-------");
println!("User");
// let user = match get_input(debug) {
// Some(input) => input,
// None => return None,
// };
let user = "tahinli".to_string();
println!("Command");
get_input(debug).map(|args| Payload { args })
match get_input(debug) {
Some(input) => {
let mut sudo = false;
let args = match input.split_once(' ') {
Some(input_splitted) => {
if input_splitted.0 == "sudo" {
sudo = true;
input_splitted.1.to_string()
} else {
input
}
}
None => input,
};
Some(Payload { sudo, user, args })
}
None => None,
}
}
fn get_input(debug: bool) -> Option<String> {