-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
husky
committed
Mar 9, 2022
1 parent
d527eee
commit a718b56
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use std::error::Error; | ||
use std::env::args; | ||
use std::fs::remove_file; | ||
#[cfg(windows)] use houdini; | ||
#[cfg(windows)] use rand::{thread_rng, Rng}; | ||
#[cfg(windows)] use rand::distributions::Alphanumeric; | ||
|
||
|
||
pub async fn handle() -> Result<String, Box<dyn Error>> { | ||
/// Performs some OPSEC cleanups, deletes itself from disk, and kills the agent. | ||
/// Burn after reading style. | ||
/// For Windows, makes use of Yamakadi's fantastic houdini crate, based on jonaslyk's self-deleting binary research and byt3bl33d3r's Nim POC | ||
/// For Nix, just deletes arg[0] lol. | ||
/// Usage: selfdestruct 🎯 | ||
|
||
// TODO: Overwrite proc memory with junk | ||
|
||
// Delete bin on disk | ||
|
||
#[cfg(windows)] { | ||
let rand_string: String = thread_rng() | ||
.sample_iter(&Alphanumeric) | ||
.take(12) | ||
.map(char::from) | ||
.collect(); | ||
|
||
houdini::disappear_with_placeholder(rand_string); | ||
} | ||
|
||
#[cfg(not(windows))] { | ||
let running_agent: String = args().nth(0).unwrap(); | ||
remove_file(running_agent)?; | ||
} | ||
|
||
// Shutdown agent | ||
// In main.rs, shutdown::handle exits the current running process | ||
Ok("[!] This agent will now self-destruct!\n[!] 3...2...1...💣💥!".to_string()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters