Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90aa4a1b28 |
125
src/main.rs
125
src/main.rs
@@ -17,7 +17,10 @@ struct Args{
|
|||||||
outfile: Option<PathBuf>,
|
outfile: Option<PathBuf>,
|
||||||
|
|
||||||
#[arg(short, long, help = "number of threads to use, default to 10.")]
|
#[arg(short, long, help = "number of threads to use, default to 10.")]
|
||||||
threads: Option<usize>
|
threads: Option<usize>,
|
||||||
|
|
||||||
|
#[arg(short, long, help = "specific targets. should be comma separated.")]
|
||||||
|
targets: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ShareFinder{
|
struct ShareFinder{
|
||||||
@@ -74,10 +77,53 @@ async fn find_shares(task: ShareFinder, mut rx: Receiver<String>){
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main(){
|
async fn main(){
|
||||||
|
print!{"
|
||||||
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||||
|
⣿⣿⣿⡿⠋⠁⠙⠿⠿⠟⠀⠀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||||
|
⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||||
|
⣿⣿⣿⡿⠁⠀⢀⣴⣾⣷⣦⡀⠀⠈⠉⠉⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||||
|
⣿⡇⠀⠀⠀⠀⢸⣿⣿⣿⣿⡇⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||||
|
⣿⣧⣤⣤⣄⠀⠈⠛⠿⠿⠋⠀⠀⣰⡿⠿⣿⣿⣿⣿⠁⠀⠀⢸⣿⣿⣿⣿⠿⣿
|
||||||
|
⣿⣿⣿⣿⣿⠁⠀⠀⢀⣀⡀⠀⠀⠈⠀⠀⠘⣿⠿⠿⠀⠀⠀⠸⠿⢿⣿⠃⠀⣿
|
||||||
|
⣿⣿⣿⣿⣇⣀⠀⢀⣿⣿⣿⣄⣀⣴⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿
|
||||||
|
⣿⣿⣿⣿⣿⣿⣿⣾⡿⠋⠛⠿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿
|
||||||
|
⣿⣿⣿⣿⣿⣿⣿⣿⣅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿
|
||||||
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⠀⠀⠀⠀⠀⣿
|
||||||
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⣿
|
||||||
|
⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⣿
|
||||||
|
⣿⣿⣿⣿⣿⣿⣧⣤⣤⣄⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⣿
|
||||||
|
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣤⣤⣤⣤⣤⣤⣤⣤⣽⣿⣿⣿⣿⣭⣤⣤⣤⣤⣿
|
||||||
|
|
||||||
|
|
||||||
|
( ( ( )
|
||||||
|
)\\))( ' ( )\\ ) ( ( /(
|
||||||
|
((_)()\\ ) ))((_)( ( ( ))\\ )\\())(
|
||||||
|
_(())\\_)()/((_) )\\ )\\ )\\ '/((_) (_))/ )\\
|
||||||
|
\\ \\((_)/ (_))| |((_|(_)_((_))(_)) | |_ ((_)
|
||||||
|
\\ \\/\\/ // -_) / _/ _ \\ ' \\() -_) | _/ _ \\
|
||||||
|
\\_/\\_/ \\___|_\\__\\___/_|_|_|\\___| \\__\\___/
|
||||||
|
* ) ) )
|
||||||
|
` ) /( ( ( /( ) ( ( /( ) ( ( ( ) (
|
||||||
|
( )(_))))\\ )\\()| /( ( ))\\ ( ( )\\())( /( )( ))\\( ))\\( /( ))\\
|
||||||
|
(_(_())/((_|_))/)(_)) )\\ ) /((_))\\ )\\((_)\\ )(_)|()\\ /((_)\\ /((_)\\())((_)
|
||||||
|
|_ _(_)) | |_((_)_ _(_/((_))(((_) ((_) |(_|(_)_ ((_|_))((_) (_))((_)(_))
|
||||||
|
| | / -_)| _/ _` | ' \\)) || (_-< (_-< ' \\/ _` | '_/ -_|_-<_/ -_) \\ / -_)
|
||||||
|
|_| \\___| \\__\\__,_|_||_| \\_,_/__/___/__/_||_\\__,_|_| \\___/__(_)___/_\\_\\___|(
|
||||||
|
( ) ) |___(_| ) ) )\\ ) ) )\\ ) )
|
||||||
|
)\\ ( ( /(( /( ( ( )\\ ( ( /( ||_( /( (()/(( ( /((()/( ( /(
|
||||||
|
((((_)( ))\\ )\\())\\()) ( )( )((_) ))\\ )\\()|_-<)\\()) /(_))\\ ) )\\())/(_)))\\())
|
||||||
|
)\\ _ )\\ /((_|_))((_)\\ )\\(()\\ _ ((_)_ /((_)((_)\\/ _(_))/ (_))(()/( ((_)\\(_)) ((_)\\
|
||||||
|
(_)_\\(_|_))(| |_| |(_)((_)((_|_) | _ |_))(| | (_)||| |_ | _ \\)(_)) | (_) _ \\/ (_)
|
||||||
|
/ _ \\ | || | _| ' \\/ _ \\ '_|_ | _ \\ || |_ _| | _| | _/ || |_ _|| / () |
|
||||||
|
/_/ \\_\\ \\_,_|\\__|_||_\\___/_| (_) |___/\\_,_| |_| \\__|___|_| \\_, | |_| |_|_\\\\__/
|
||||||
|
|_____| |__/
|
||||||
|
|
||||||
|
"}
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
let mut outfile = PathBuf::new();
|
let mut outfile = PathBuf::new();
|
||||||
let mut threads = 10;
|
let mut threads = 10;
|
||||||
let mut save = false;
|
let mut save = false;
|
||||||
|
let mut computers = Vec::new();
|
||||||
if args.outfile.is_some(){
|
if args.outfile.is_some(){
|
||||||
outfile = args.outfile.unwrap();
|
outfile = args.outfile.unwrap();
|
||||||
save = true;
|
save = true;
|
||||||
@@ -85,41 +131,56 @@ async fn main(){
|
|||||||
if args.threads.is_some(){
|
if args.threads.is_some(){
|
||||||
threads = args.threads.unwrap();
|
threads = args.threads.unwrap();
|
||||||
}
|
}
|
||||||
println!("finding computers...");
|
if args.targets.is_some(){
|
||||||
let command_string = String::from("net group \"domain computers\" /domain");
|
println!("gathering the targets you gave me.");
|
||||||
let mut temp_file = fs::File::create("./temp.bat").unwrap();
|
let targets = args.targets.unwrap();
|
||||||
write!(temp_file, "{}", command_string).unwrap();
|
if targets.contains(","){
|
||||||
let computer_res = Command::new(".\\temp.bat").output();
|
let split_targets: Vec<&str> = targets.split(",").collect();
|
||||||
let mut error_string = String::new();
|
for target in split_targets{
|
||||||
let mut success_string = String::new();
|
computers.push(target.to_string());
|
||||||
fs::remove_file("./temp.bat").unwrap();
|
}
|
||||||
if computer_res.is_ok(){
|
|
||||||
let output = computer_res.unwrap();
|
|
||||||
if output.stdout.len() > 0{
|
|
||||||
success_string = String::from_utf8_lossy(&output.stdout).to_string();
|
|
||||||
}
|
}
|
||||||
else if output.stderr.len() > 0{
|
else{
|
||||||
error_string = String::from_utf8_lossy(&output.stderr).to_string();
|
computers.push(targets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
error_string = computer_res.err().unwrap().to_string();
|
println!("no targets given, proceeding with domain computer enumeration...");
|
||||||
}
|
println!("finding computers...");
|
||||||
if error_string.len() > 0{
|
let command_string = String::from("net group \"domain computers\" /domain");
|
||||||
eprintln!("{}", "error getting computers!".red());
|
let mut temp_file = fs::File::create("./temp.bat").unwrap();
|
||||||
eprintln!("{}", error_string.red());
|
write!(temp_file, "{}", command_string).unwrap();
|
||||||
exit(1);
|
let computer_res = Command::new(".\\temp.bat").output();
|
||||||
}
|
let mut error_string = String::new();
|
||||||
let mut computers = Vec::new();
|
let mut success_string = String::new();
|
||||||
if success_string.len() > 0{
|
fs::remove_file("./temp.bat").unwrap();
|
||||||
for line in success_string.lines(){
|
if computer_res.is_ok(){
|
||||||
if line.contains("$"){
|
let output = computer_res.unwrap();
|
||||||
let words:Vec<&str> = line.split_whitespace().collect();
|
if output.stdout.len() > 0{
|
||||||
for word in words{
|
success_string = String::from_utf8_lossy(&output.stdout).to_string();
|
||||||
let mut computer_name = word.to_string();
|
}
|
||||||
computer_name.pop();
|
else if output.stderr.len() > 0{
|
||||||
println!("{} {}", "found".green(), computer_name.green());
|
error_string = String::from_utf8_lossy(&output.stderr).to_string();
|
||||||
computers.push(computer_name);
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
error_string = computer_res.err().unwrap().to_string();
|
||||||
|
}
|
||||||
|
if error_string.len() > 0{
|
||||||
|
eprintln!("{}", "error getting computers!".red());
|
||||||
|
eprintln!("{}", error_string.red());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if success_string.len() > 0{
|
||||||
|
for line in success_string.lines(){
|
||||||
|
if line.contains("$"){
|
||||||
|
let words:Vec<&str> = line.split_whitespace().collect();
|
||||||
|
for word in words{
|
||||||
|
let mut computer_name = word.to_string();
|
||||||
|
computer_name.pop();
|
||||||
|
println!("{} {}", "found".green(), computer_name.green());
|
||||||
|
computers.push(computer_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user