Compare commits

...

2 commits

Author SHA1 Message Date
Ahmet Kaan GÜMÜŞ
b0501ebe68 docs: 📝 readme 2025-01-05 23:52:33 +03:00
Ahmet Kaan GÜMÜŞ
5f7cd49e37 feat: 🏗️ design strategy about sudo and user changed 2024-07-10 15:43:00 +03:00
3 changed files with 6 additions and 29 deletions

View file

@ -1 +1,5 @@
# rust-remote # 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.

View file

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

View file

@ -94,31 +94,8 @@ async fn establish_connection(
async fn payload_from_input(debug: bool) -> Option<Payload> { async fn payload_from_input(debug: bool) -> Option<Payload> {
println!("-------"); println!("-------");
println!("User");
// let user = match get_input(debug) {
// Some(input) => input,
// None => return None,
// };
let user = "tahinli".to_string();
println!("Command"); println!("Command");
match get_input(debug) { get_input(debug).map(|args| Payload { args })
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> { fn get_input(debug: bool) -> Option<String> {