Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b0501ebe68 | ||
![]() |
5f7cd49e37 |
3 changed files with 6 additions and 29 deletions
|
@ -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.
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue