Compare commits
No commits in common. "main" and "674d3c6" have entirely different histories.
3 changed files with 29 additions and 6 deletions
|
@ -1,5 +1 @@
|
||||||
# Remote Code Execution Program
|
# rust-remote
|
||||||
|
|
||||||
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.
|
|
|
@ -53,12 +53,16 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,31 @@ 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");
|
||||||
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> {
|
fn get_input(debug: bool) -> Option<String> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue