4 Commits
3.1.3 ... 3.1.5

Author SHA1 Message Date
Pyro57000
6959e77d57 cleaned up all the warnings so it should compile without any! 2025-05-28 09:39:02 -05:00
Pyro57000
33450cb1ba ditto 2025-05-27 12:19:20 -05:00
Pyro57000
55a6faac2d added the ability to run dnstwist scans for
dns enumeration, and added the ability to modify
the tool's configuration.
2025-05-27 12:18:52 -05:00
Pyro57000
737bee37e7 added dns commands to the menu. 2025-05-20 11:52:46 -05:00
12 changed files with 448 additions and 131 deletions

View File

@@ -74,6 +74,7 @@ pub fn project_inline_terminal(project: Project){
process::Command::new("distrobox").arg("enter").arg("--root").arg(project.boxname).arg("--").arg("script").arg("-a").arg("-B").arg("/pentest/working/terminal.log").status().expect("error opeing konsole");
}
#[allow(unused)]
pub fn make_box(project: &Project, tools_dir: &PathBuf, boxtemplate: &String, new: bool, fingerprint: bool){
println!("stopping template box to ensure we can clone it!");
let stop_result = Command::new("distrobox").arg("stop").arg("--root").arg(boxtemplate).status();
@@ -236,6 +237,7 @@ pub fn launch_cobalt_strike(project: Project) -> Option<JoinHandle<()>>{
return Some(handle);
}
#[allow(unused)]
pub fn launch_bloodhound_gui(project: Project) -> Option<JoinHandle<()>>{
let mut bloodhound_command = String::new();
let version_response = get_user_input("do you want to use a specific bloodhound version?");

View File

@@ -1,4 +1,3 @@
use std::os::unix::thread;
use std::path::PathBuf;
use std::process::exit;
use std::thread::JoinHandle;
@@ -17,6 +16,7 @@ use crate::portscan_controls;
use crate::victim_commands;
use crate::enumeration;
use crate:: tool_controls;
use crate::configuration;
fn help(command: Option<String>){
@@ -59,6 +59,7 @@ fn help(command: Option<String>){
"dns records" | "dr" => {println!("Command:dnsrecords\nAliases:dr\n\nThis command will run dns recon inside of your distrobox and save the results to your enumeration notes.")},
"brute force subdomains"| "bsd" | "gobuster dns" | "gd" => {println!("Command:brute force subdomains\nAliases:bsd,gobuster dns, gd\n\nthis command will run gobuster in the project's distrobox and save the results to your notes.")},
"dns enumeration" | "de" | "all dns stuff" | "ads" | "dns stuff" | "ds" => {println!("Command:dns enumeration\nAliases:de, all dns stuff, ads, dns stuff, de\n\nThis command will perform both dns record enumeration with dnsrecon, and subdomain enumeration using gobster inside of your distrobox and save the output to your notes.")},
"modify tool config" | "mtc" => {println!("Command: modify tool config\nAliases: mtc\n\nThis command lets you modify the tool's configuration.");}
_ => ()
}
}
@@ -101,6 +102,7 @@ update git tools | ugt | update git | ug
dns records | dr
brute force subdomains| bsd | gobuster dns | gd
dns enumeration | de | all dns stuff | ads | dns stuff | ds
modify tool config | mtc
help | ? | -h
")
}
@@ -125,7 +127,7 @@ pub fn next_project_id(config_path: &PathBuf) -> i32{
}
return new_id;
}
#[allow(unused)]
pub fn run_command(cmd: String,
mut projects: &mut Vec<Project>,
config_path: PathBuf,
@@ -216,7 +218,9 @@ pub fn run_command(cmd: String,
"dns records" | "dr" => {let dns_handle = enumeration::run_dns_enumeration(&active_project, None, true); return dns_handle;},
"brute force subdomains"| "bsd" | "gobuster dns" | "gd" => {let gobuster_handle = enumeration::bruteforce_subs(&active_project, None,None, true); return gobuster_handle},
"dns enumeration" | "de" | "all dns stuff" | "ads" | "dns stuff" | "ds" => {let all_dns_handle = enumeration::do_all_dns_enumeration(&active_project); return all_dns_handle},
"dns squatting scan" | "dnstwist" | "dss" => {let twist_handle = enumeration::dns_squatting(&active_project, None, true); return twist_handle},
"print report information" | "pri" => {info_controls::print_report_information(&active_project); return None;},
"modify tool config" | "mtc" => {configuration::generate_tool_config(&config_path); return None;},
_ => {help(None); println!("\n\n unknown command."); return None;}
}
}

View File

@@ -0,0 +1,148 @@
use std::path::PathBuf;
use std::fs::read_to_string;
use std::io::Write;
use crate::{get_user_input, open_overwrite};
#[allow(unused)]
pub fn generate_tool_config(config_dir: &PathBuf){
let mut config_file_path = config_dir.clone();
println!("{}", config_file_path.display());
let mut current_config = String::new();
let current_config_read_res = read_to_string(&config_file_path);
if current_config_read_res.is_ok(){
current_config = current_config_read_res.unwrap();
println!("current configuration loaded!");
}
print!("{}", current_config);
let mut project_base_folder = PathBuf::new();
let mut project_base_notes = PathBuf::new();
let mut tools_folder = PathBuf::new();
let mut terminal_command = String::new();
let mut box_template = String::new();
let mut cracking_rig = String::new();
let mut rockyou = String::new();
let mut rule = String::new();
let mut upcoming_files = PathBuf::new();
let mut upcoming_notes = PathBuf::new();
let mut pass_spray_file = PathBuf::new();
let mut fingerprint = false;
let mut vault_name = String::new();
let settings: Vec<&str> = current_config.split("\n").collect();
for line in settings{
if line.len() > 1{
let setting_vec: Vec<&str> = line.split(":").collect();
match setting_vec[0]{
"Project_files" => project_base_folder.push(setting_vec[1].trim_end()),
"Project_notes" => project_base_notes.push(setting_vec[1].trim_end()),
"tools_folder" => tools_folder.push(setting_vec[1].trim_end()),
"upcoming_files" => upcoming_files.push(setting_vec[1].trim_end()),
"upcoming_notes" => upcoming_notes.push(setting_vec[1].trim_end()),
"box_template" => box_template = setting_vec[1].trim_end().to_owned(),
"terminal" => terminal_command = setting_vec[1].trim_end().to_owned(),
"cracking_rig" => cracking_rig = setting_vec[1].trim_end().to_owned(),
"rockyou_location" => rockyou = setting_vec[1].trim_end().to_owned(),
"rule_location" => rule = setting_vec[1].trim_end().to_owned(),
"pass_file"=> pass_spray_file.push(setting_vec[1]),
"fingerprint" => {if setting_vec[1].contains("y"){fingerprint = true}},
"vault_name" => vault_name = setting_vec[1].trim_end().to_owned(),
_ => println!("error unknown setting: {}", setting_vec[0])
}
}
}
println!("1.) recreate entire configuration");
println!("2.) modify one setting");
if get_user_input("Selection?").contains("2"){
print!("
1 .) project_files
2 .) project_notes
3 .) tools_folder
4 .) upcoming_files
5 .) upcoming_notes
6 .) box_template
7 .) terminal
8 .) cracking_rig
9 .) rockyou_location
10.) rule_location
11.) pass_file
12.) fingerprint
13.) vault_name
");
match get_user_input("which setting would you like to modify?").as_str(){
"1" => {project_base_folder.clear(); project_base_folder.push(get_user_input("full path to the base project files folder?"));},
"2" => {project_base_notes.clear(); project_base_notes.push(get_user_input("full path to the base project notes folder"));},
"3" => {tools_folder.clear(); tools_folder.push(get_user_input("full path to your custom tools folder?"));},
"4" => {upcoming_files.clear(); upcoming_files.push(get_user_input("full path to your upcoming projects folder"));},
"5" => {upcoming_notes.clear(); upcoming_notes.push(get_user_input("full path to your upcoming project nots folder"));},
"6" => {box_template = get_user_input("name of your distrobox template?")},
"7" => {terminal_command = get_user_input("comand to run your terminal while executing a specific command, ex: konsole -e ")},
"8" => {cracking_rig = get_user_input("username and address of your personal cracking rig, example pyro@crackingrig or pyro@192.168.1.10?")},
"9" => {rockyou = get_user_input("location of rockyou.txt on your cracking rig?")},
"10" => {rule = get_user_input("location of the one rule on your crakcing rig?")},
"11" => {pass_spray_file.clear(); pass_spray_file.push(get_user_input("location of your password spray list file?"));},
"12" => {fingerprint = get_user_input("will you be using fingerprint authentication in your distroboxes?").to_lowercase().contains("y")},
"13" => {vault_name = get_user_input("obsidian vault name?")},
_ => {println!("unknown selection, please try again...");}
};
}
else{
project_base_folder = PathBuf::from(get_user_input("path to store your active projects?"));
project_base_notes = PathBuf::from(get_user_input("path to store your active project notes?"));
upcoming_files = PathBuf::from(get_user_input("path to store your upcomming projects?"));
upcoming_notes = PathBuf::from(get_user_input("path to store your upcomming project notes?"));
tools_folder = PathBuf::from(get_user_input("path where you store your custom tools (like from github and places)?"));
box_template = get_user_input("Name of the distrobox you want to use as a template?");
cracking_rig = String::from("nobody@nothing");
rockyou = String::from("n/a");
rule = String::from("n/a");
let cracking_rig_response = get_user_input("do you have a separate machine to crack passwords on? (not the ambush cracking rig)");
if cracking_rig_response.to_lowercase().contains("y"){
let rig_ip = get_user_input("ip address or hostname of your cracking rig?");
let rig_user = get_user_input("username to log into your cracking rig with?");
rockyou = get_user_input("location of rockyou.txt on the cracking rig?");
rule = get_user_input("location of one rule to rule them all on the cracking rig?");
cracking_rig = format!("{}@{}", rig_user, rig_ip);
}
else{
println!("ok free loader");
}
fingerprint = get_user_input("will you be using fingerprint authentication for your distroboxes?").to_lowercase().contains("y");
terminal_command = get_user_input("command to launch your terminal, while executing a command, for example konsel -e ");
vault_name = get_user_input("the name of the vault you're going to use?");
}
let new_config = format!("
Project_files:{}
Project_notes:{}
tools_folder:{}
upcoming_files:{}
upcoming_notes:{}
box_template:{}
terminal:{}
cracking_rig:{}
rockyou_location:{}
rule_location:{}
pass_file:{}
fingerprint:{}
vault_name:{}
",project_base_folder.display(), project_base_notes.display(), tools_folder.display(), upcoming_files.display(), upcoming_notes.display(), box_template, terminal_command, cracking_rig, rockyou, rule, pass_spray_file.display(), fingerprint, vault_name);
println!("this will be the new config that will be saved:\n");
println!("{}", new_config);
if get_user_input("is this ok?").to_lowercase().contains("y"){
let config_file_res = open_overwrite(&config_file_path);
if config_file_res.is_none(){
println!("failed to open config file in overwrite mode... quitting... nothing was saved.");
return;
}
let mut config_file = config_file_res.unwrap();
let write_res= write!(config_file, "{}", new_config);
if write_res.is_err(){
let error = write_res.err().unwrap();
println!("error writing config file!");
println!("{}", error);
println!("nothing was saved...");
return;
}
write_res.unwrap();
}
}

View File

@@ -1,22 +1,20 @@
use core::error;
use std::fmt::write;
use std::fs::{read_to_string, remove_file, OpenOptions};
use std::process::Command;
use std::thread::JoinHandle;
use std::thread::{spawn, sleep};
use std::io::{self, Write};
use std::io::Write;
use std::time::Duration;
use dns_lookup::lookup_host;
use crate::enumeration;
use crate::get_user_input;
use crate::Project;
use crate::open_append;
#[allow(unused)]
pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>>, standalone: bool) -> Option<JoinHandle<()>>{
let notes_folder = project.notes_folder.clone();
let mut enumeration = notes_folder.clone();
enumeration.push("enumeration.md");
let mut enumeration_file_res = open_append(&enumeration);
let enumeration_file_res = open_append(&enumeration);
if enumeration_file_res.is_none(){
println!("error opening enumeration_file!");
println!("try creating it manually.");
@@ -58,7 +56,8 @@ pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>
println!("{}", error);
return;
}
//sleep(Duration::from_secs(10));
println!("sleping for 10 seconds to allow for sudo password input.");
sleep(Duration::from_secs(10));
let output_string_res = read_to_string("dns_temp.csv");
if output_string_res.is_err(){
let error = output_string_res.err().unwrap();
@@ -122,6 +121,7 @@ pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>
return Some(dns_handle);
}
#[allow(unused)]
pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, given_wordlist: Option<String>, standalone: bool) -> Option<JoinHandle<()>>{
let mut enumeration_path = project.notes_folder.clone();
enumeration_path.push("enumeration.md");
@@ -186,6 +186,8 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
println!("{}", error);
return;
}
println!("sleeping for 10 seconds to allow for sudo password input.");
sleep(Duration::from_secs(10));
let gobuser_output = gobuster_cmd_res.unwrap().stdout;
println!("From Gobuster Thread: Sudomain enumeration Done!");
let gobuster_string = String::from_utf8_lossy(&gobuser_output);
@@ -225,6 +227,82 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
return Some(gobuster_thread);
}
pub fn dns_squatting(project: &Project, given_domains: Option<&Vec<String>>, standalone: bool) -> Option<JoinHandle<()>>{
let mut enumeration_notes = project.notes_folder.clone();
enumeration_notes.push("enumeration.md");
let open_enumeration_notes_res = OpenOptions::new().append(true).create(true).open(enumeration_notes);
if open_enumeration_notes_res.is_err(){
let error = open_enumeration_notes_res.err().unwrap();
println!("Error opening enumeration notes");
println!("{}", error);
return None;
}
let mut enumeration_file = open_enumeration_notes_res.unwrap();
let mut domains = Vec::new();
if given_domains.is_none(){
loop{
let domain = get_user_input("Domain to add? enter DONE in all caps when you're finished");
if domain == "DONE"{
break;
}
else{
domains.push(domain);
}
}
}
else{
domains = given_domains.unwrap().to_owned();
}
let working_project = project.clone();
let squatting_thread = spawn(move || {
let write_res = write!(enumeration_file, "### Domain Squatting\n");
if write_res.is_err(){
let error = write_res.err().unwrap();
println!("error writing to enumeration notes file!");
println!("{}", error);
return;
}
write_res.unwrap();
for domain in domains{
if standalone{
write!(enumeration_file, "#### {}\n", domain).unwrap();
}
write!(enumeration_file, "\n| type | domain name | ns servers |\n").unwrap();
write!(enumeration_file, "| ---- | ----------- | ---------- |\n").unwrap();
let twist_output = Command::new("distrobox")
.arg("enter")
.arg("--root")
.arg(working_project.boxname.to_owned())
.arg("--")
.arg("dnstwist")
.arg("-r")
.arg(domain)
.output();
if twist_output.is_err(){
let error = twist_output.err().unwrap();
println!("From DNSTwist thread: Error running dnstwist command!");
println!("{}", error);
return;
}
println!("sleeping for 10 seconds to allow for sudo password input.");
sleep(Duration::from_secs(10));
let twist_output_vec = twist_output.unwrap().stdout;
let output_string = String::from_utf8_lossy(&twist_output_vec);
let output_lines = output_string.split("\n");
for line in output_lines{
if line.len() > 0{
let words: Vec<&str> = line.split_whitespace().collect();
let twist_type = words[0];
let name = words[1];
let ns_servers = words[2..].join(" ");
write!(enumeration_file, "| {} | {} | {} |\n", twist_type, name, ns_servers).unwrap();
}
}
}
});
return Some(squatting_thread);
}
pub fn do_all_dns_enumeration(project: &Project) -> Option<JoinHandle<()>>{
let mut enumeration_path = project.notes_folder.clone();
enumeration_path.push("enumeration.md");
@@ -271,6 +349,11 @@ pub fn do_all_dns_enumeration(project: &Project) -> Option<JoinHandle<()>>{
if gobuster_thread.is_some(){
let _ = gobuster_thread.unwrap().join();
}
write!(enumeration_file, "### Domain Squatting\n").unwrap();
let twist_thread = dns_squatting(&working_project, Some(&thread_domain), false);
if twist_thread.is_some(){
let _ = twist_thread.unwrap().join();
}
write!(enumeration_file, "\n---\n").unwrap();
}
}

View File

@@ -1,28 +1,21 @@
use std::collections::HashMap;
use std::fs;
use std::fs::create_dir_all;
use std::fs::read_to_string;
use std::fs::OpenOptions;
use std::hash::Hash;
use std::io::BufReader;
use std::io::Write;
use std::path::PathBuf;
use std::process;
use std::process::Command;
use std::thread;
use std::time::Duration;
use std::io::stdin;
use std::thread::JoinHandle;
use walkdir::WalkDir;
use clearscreen::clear;
use clearscreen;
use rodio::{Decoder, OutputStream, Sink};
use crate::get_user_input;
use crate::open_overwrite;
use crate::open_append;
use crate::project_controls::get_projects;
use crate::Project;
#[allow(unused)]
pub fn run_initial_enum(project: &Project){
#[derive(Clone)]
struct Target {
@@ -101,7 +94,7 @@ pub fn run_initial_enum(project: &Project){
}
}
pub fn build_external_attack_notes(project: &Project){
/*pub fn build_external_attack_notes(project: &Project){
#[derive(Clone)]
struct Port{
service: String,
@@ -173,7 +166,7 @@ pub fn build_external_attack_notes(project: &Project){
write!(attack_file, "\n---\n").expect("since we used the open options already this should never fail.");
}
}
}
}*/
pub fn generate_userpass(project: &Project){
let mut outlines = Vec::new();
@@ -200,7 +193,7 @@ pub fn generate_userpass(project: &Project){
}
}
pub fn open_in_dolphin(folder: &str, project: Project){
/*pub fn open_in_dolphin(folder: &str, project: Project){
let mut to_open = PathBuf::new();
match folder{
"notes" => to_open.push(project.notes_folder),
@@ -210,7 +203,7 @@ pub fn open_in_dolphin(folder: &str, project: Project){
process::Command::new("dolphin")
.arg(to_open)
.spawn().expect("error opening dolphin");
}
}*/
pub fn print_report_information(project: &Project){
let scope = get_scope_entries(project);
@@ -364,6 +357,7 @@ fn nefarious_config(tools_dir: &PathBuf) -> String{
}
}
#[allow(unused)]
fn msolspray_config(tools_dir: &PathBuf) -> String{
let mut msolspray_path = String::new();
let mut outline = String::new();
@@ -451,6 +445,7 @@ fn msolspray_config(tools_dir: &PathBuf) -> String{
return outline;
}
#[allow(unused)]
pub fn password_spray_help(project: &Project, season: String, lseason: String, year: i32, tools_dir: &PathBuf, config_path: &PathBuf){
let mut wait_time:u64 = 0;
let mut wait_time_response = String::new();
@@ -595,7 +590,7 @@ pub fn password_spray_help(project: &Project, season: String, lseason: String, y
}
}
pub fn crack_hashes(cracking_rig: &String, project: &Project, terminal: &String, rockyou: &String, rule: &String){
/*pub fn crack_hashes(cracking_rig: &String, project: &Project, terminal: &String, rockyou: &String, rule: &String){
let mut hash_file = String::new();
println!("trying to automatically find hashes.txt file...");
let find_result = find_file(&project.files_folder, "hashes.txt");
@@ -775,7 +770,7 @@ pub fn get_mssql_column_names(project: &Project) -> Option<JoinHandle<()>>{
}
});
return Some(db_handle);
}
}*/
pub fn partse_gathercontacts(project: &Project){
fn format_names(names: Vec<&str>) -> HashMap<&str, Vec<String>>{
@@ -896,9 +891,9 @@ last
}
}
pub fn get_all_host_addresses(project: &Project){
/*pub fn get_all_host_addresses(project: &Project){
println!("to do");
}
}*/
pub fn get_scope_entries(project: &Project) -> Option<Vec<String>>{
let mut general_path = project.notes_folder.clone();

View File

@@ -1,20 +1,18 @@
use std::collections::HashMap;
use std::fs::{File, create_dir_all, remove_dir_all};
use std::io::{read_to_string, Read};
use std::io::Read;
use std::io::Write;
use std::io::stdin;
use std::io::copy;
use std::process::Command;
use std::time::Duration;
use reqwest::blocking::get;
use std::{path::Path, path::PathBuf};
use std::{process, thread};
use std::thread;
use std::process::exit;
use directories::UserDirs;
use crate::get_user_input;
#[allow(unused)]
pub fn install(config_path: &PathBuf){
let mut _terminal_commands = HashMap::from([
("kde", "konsole -e !!!"),

View File

@@ -1,6 +1,5 @@
use std::{io::stdin, path::PathBuf, process::Command};
use directories::UserDirs;
use reqwest::Response;
use std::process::exit;
use std::fs::{self, File};
@@ -27,6 +26,7 @@ mod portscan_controls;
mod victim_commands;
mod enumeration;
mod tool_controls;
mod configuration;
pub fn open_overwrite(path: &PathBuf) -> Option<File>{
let file_create_res = fs::OpenOptions::new().create(true).write(true).open(path);

View File

@@ -96,9 +96,12 @@ ___ ___ _ ___ ___
22.) Launch bloodhound with the current project's distrobox
23.) Parse GatherContacts output file
24.) prune unused distroboxes (free up system storage)
25.) enter external only menu
26.) enter internal only menu
27.) exit menu
25.) Gather DNS Records
26.) Bruteforce Subdomains
27.) Do all DNS enumeration
28.) enter external only menu
29.) enter internal only menu
30.) exit menu
\n", banner);
match get_user_input("selection?").as_str(){
"1" => {let thread_option = cli::run_command("show active project".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
@@ -125,9 +128,12 @@ ___ ___ _ ___ ___
"22" => {let thread_option = cli::run_command("bloodhound".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"23" => {let thread_option = cli::run_command("parse gather contacts".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"24" => {let thread_option = cli::run_command("prune distroboxes".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"25" => {let threads_option = external_menu(banner, projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.clone(), cracking_rig.clone(), rockyou.clone(), rule.clone(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.clone()); if threads_option.is_some(){for thread in threads_option.unwrap(){threads.push(thread)}}},
"26" => {let threads_option = internal_menu(banner, projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.clone(), cracking_rig.clone(), rockyou.clone(), rule.clone(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.clone()); if threads_option.is_some(){for thread in threads_option.unwrap(){threads.push(thread)}}},
"27" => loopize = false,
"25" => {let thread_option = cli::run_command("dns records".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"26" => {let thread_option = cli::run_command("brute force subdomains".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"27" => {let thread_option = cli::run_command("dns enumeration".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"28" => {let threads_option = external_menu(banner, projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.clone(), cracking_rig.clone(), rockyou.clone(), rule.clone(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.clone()); if threads_option.is_some(){for thread in threads_option.unwrap(){threads.push(thread)}}},
"29" => {let threads_option = internal_menu(banner, projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.clone(), cracking_rig.clone(), rockyou.clone(), rule.clone(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.clone()); if threads_option.is_some(){for thread in threads_option.unwrap(){threads.push(thread)}}},
"30" => loopize = false,
_ => println!("unknown selection, try again!"),
}
}
@@ -186,7 +192,10 @@ ___ ___ _ ___ ___
17.) Password Spray (will print password to spray, and wait the obervation window time)
18.) Parse GatherContacts output file
19.) prune unused distroboxes (free up system storage)
20.) exit menu
20.) Gather DNS Records
21.) Brute force Subdomains
22.) Do all DNS Enumeration
23.) exit menu
\n", banner);
match get_user_input("selection?").as_str(){
"1" => {let thread_option = cli::run_command("show active project".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
@@ -200,7 +209,7 @@ ___ ___ _ ___ ___
"9" => {let thread_option = cli::run_command("promote project".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"10" => {let thread_option = cli::run_command("new terminal".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"11" => {let thread_option = cli::run_command("inline terminal".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"11" => {let thread_option = cli::run_command("recreate distrobox".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"12" => {let thread_option = cli::run_command("recreate distrobox".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"13" => {let thread_option = cli::run_command("generate userpass".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"14" => {let thread_option = cli::run_command("initial enum".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"15" => {let thread_option = cli::run_command("build attack notes".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
@@ -208,7 +217,10 @@ ___ ___ _ ___ ___
"17" => {let thread_option = cli::run_command("password spray".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"18" => {let thread_option = cli::run_command("parse gather contacts".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"19" => {let thread_option = cli::run_command("prune distroboxes".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"20" => loopize = false,
"20" => {let thread_option = cli::run_command("dns records".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"21" => {let thread_option = cli::run_command("brute force subdomains".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"22" => {let thread_option = cli::run_command("dns enumeration".to_owned(), projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.to_owned(), cracking_rig.to_owned(), rockyou.to_owned(), rule.to_owned(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.to_owned()); if thread_option.is_some(){threads.push(thread_option.unwrap());}},
"23" => loopize = false,
_ => println!("unknown selection, try again!"),
}
}

View File

@@ -1,10 +1,11 @@
use std::fs::{self, OpenOptions};
use std::collections::HashMap;
use std::fs;
use std::fs::{read_to_string, create_dir_all};
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;
use chrono::format::format;
use reqwest::blocking::get;
use std::thread::{sleep, spawn, JoinHandle};
use std::time::Duration;
use walkdir::WalkDir;
use crate::get_user_input;
use crate::Project;
@@ -498,8 +499,8 @@ pub fn parse_csportscan(project: &Project){
println!("note if no hosts were found for a protocol their files will be empty.");
}
pub fn run_nmap_portscan(project: &Project){
let files_folder = project.files_folder.clone();
#[allow(unused)]
pub fn run_nmap_portscan(project: &Project) -> Option<JoinHandle<()>>{
let notes_folder = project.notes_folder.clone();
let mut ports_to_scan = vec![String::from("80"), String::from("443"),
String::from("161"),
@@ -516,13 +517,12 @@ pub fn run_nmap_portscan(project: &Project){
String::from("1433"),
String::from("3306"),
String::from("2222"),];
let mut save_path = files_folder.clone();
let mut general_notes = notes_folder.clone();
general_notes.push("general.md");
println!("building targets from scope in general notes...");
let targets_res = info_controls::get_scope_entries(project);
if targets_res.is_none(){
return;
return None;
}
let mut targets = targets_res.unwrap();
println!("Got targets from scope!");
@@ -558,7 +558,7 @@ pub fn run_nmap_portscan(project: &Project){
}
if get_user_input("continue?").to_lowercase().contains("n"){
println!("ok exiting this function, feel free to try again...");
return;
return None;
}
targets = modified_targets;
}
@@ -577,83 +577,168 @@ pub fn run_nmap_portscan(project: &Project){
}
}
}
let proxy = get_user_input("will you be using proxychains for this scan?").to_lowercase();
let proxy = get_user_input("will you be using proxychains for this scan?").to_lowercase().contains("y");
println!("sweet we have what we need!");
println!("building portscan command...");
let port_string = ports_to_scan.join(",");
let hosts_string = targets.join(" ");
let mut scan_results = String::new();
if proxy.contains("y"){
println!("running command, this may take a bit of time...");
let command_res = Command::new("distrobox")
.arg("enter")
.arg("--root")
.arg(project.boxname.to_owned())
.arg("--")
.arg("proxychains")
.arg("namp")
.arg("-sT")
.arg("-p")
.arg(port_string)
.arg(hosts_string)
.output();
if command_res.is_err(){
let error = command_res.err().unwrap();
println!("error running portscan command!");
println!("{}", error);
return;
}
let output = command_res.unwrap().stdout;
scan_results = String::from_utf8_lossy(&output).into_owned();
}
else{
let command_res = Command::new("distrobox")
.arg("enter")
.arg("--root")
.arg(project.boxname.to_owned())
.arg("--")
.arg("proxychains")
.arg("namp")
.arg("-sT")
.arg("-p")
.arg(port_string)
.arg(hosts_string)
.output();
if command_res.is_err(){
let error = command_res.err().unwrap();
println!("error running portscan command!");
println!("{}", error);
return;
}
let output = command_res.unwrap().stdout;
scan_results = String::from_utf8_lossy(&output).into_owned();
}
save_path.push("working/nmap_output.txt");
println!("going to save to {}", save_path.display());
if get_user_input("is that ok?").to_lowercase().contains("n"){
let working_project = project.clone();
let mut save_path = project.files_folder.clone();
save_path.push("working");
if !save_path.exists(){
save_path.clear();
save_path.push(get_user_input("where do you want to save it then? (full path)"));
save_path = project.files_folder.clone();
}
let save_file_res = OpenOptions::new().create(true).append(true).open(save_path);
if save_file_res.is_err(){
let error = save_file_res.err().unwrap();
println!("error opening save file!");
println!("{}", error);
if get_user_input("output results to console?").to_lowercase().contains("y"){
println!("{}", &scan_results);
save_path.push("services.tsv");
let mut enumeration_notes_path = project.notes_folder.clone();
enumeration_notes_path.push("enumeration.md");
println!("{}", save_path.display());
let mut nmap_output = Vec::new();
let nmap_thread = spawn(move || {
if proxy{
let port_scancmd_res = Command::new("distrobox")
.arg("enter")
.arg("--root")
.arg(working_project.boxname)
.arg("--")
.arg("proxychains")
.arg("nmap")
.arg("-sT")
.arg("-p")
.arg(ports_to_scan.join(","))
.arg(targets.join(" "))
.output();
if port_scancmd_res.is_err(){
let error = port_scancmd_res.err().unwrap();
println!("FROM NMAP THREAD: error running portscan!");
println!("{}", error);
return;
}
nmap_output = port_scancmd_res.unwrap().stdout;
}
return;
}
let mut save_file = save_file_res.unwrap();
let write_res = write!(save_file, "{}", scan_results);
if write_res.is_err(){
let error = write_res.err().unwrap();
println!("error writing results to file!");
println!("{}", error);
if get_user_input("print results to console instead?").to_lowercase().contains("y"){
println!("{}", scan_results);
else{
let port_scancmd_res = Command::new("distrobox")
.arg("enter")
.arg("--root")
.arg(working_project.boxname)
.arg("--")
.arg("nmap")
.arg("-sT")
.arg("-p")
.arg(ports_to_scan.join(","))
.arg(targets.join(" "))
.output();
if port_scancmd_res.is_err(){
let error = port_scancmd_res.err().unwrap();
println!("FROM NMAP THREAD: error running portscan!");
println!("{}", error);
return;
}
nmap_output = port_scancmd_res.unwrap().stdout;
}
}
println!("FROM NMAP THREAD: nmap scan finished, parsing the results...");
let nmap_output_string = String::from_utf8_lossy(&nmap_output);
let mut nmap_log_path = save_path.clone();
nmap_log_path.pop();
nmap_log_path.push("nmap.log");
let nmap_log_file = open_append(&nmap_log_path);
if nmap_log_file.is_some(){
let mut nmap_log_file = nmap_log_file.unwrap();
write!(nmap_log_file, "{}", nmap_output_string).unwrap();
}
let mut host_ports = Vec::new();
let host_sections: Vec<&str> = nmap_output_string.split("Nmap scan report ").collect();
for section in host_sections{
let mut host = String::new();
let mut ports = Vec::new();
let lines: Vec<&str> = section.split("\n").collect();
let mut port_section = false;
for line in lines{
if line.contains("for "){
if !line.contains("(not scanned)"){
host = line.split(" ").collect::<Vec<&str>>()[1..].join(" ").to_owned();
}
}
else if line.contains("Host is up"){
port_section = true;
}
else if port_section{
if line.contains("open"){
let words: Vec<&str> = line.split_whitespace().collect();
if words.len() >= 3{
let port = words [0];
let service = words [2];
let port_entry = format!("{}:{}", port, service);
ports.push(port_entry);
}
}
}
}
for port in ports{
let entry_words: Vec<&str> = port.split(":").collect();
let port = entry_words[0];
let service = entry_words[1];
let host_entry = format!("{}\t{}\t{}", host, port, service);
host_ports.push(host_entry);
}
}
let services_file_open_res = open_overwrite(&save_path);
if services_file_open_res.is_none(){
println!("FROM NMAP THREAD: error opening the services.tsv file to write!");
println!("FROM NMAP THREAD: exiting");
return;
}
let mut services_file = services_file_open_res.unwrap();
let enumeration_open_res = open_append(&enumeration_notes_path);
if enumeration_open_res.is_none(){
println!("error opening enumeration notes file!");
println!("scan data will not be saved to enumeration notes!");
}
let services_write_res = write!(services_file, "host\tport\tbanner\tnotes\n");
if services_write_res.is_err(){
let error = services_write_res.err().unwrap();
println!("FROM NMAP THREAD: error writing to the services.tsv file!");
println!("{}", error);
return;
}
let mut enumeration_write = false;
if enumeration_open_res.is_some(){
enumeration_write = true;
}
let mut host_all_ports: HashMap<String, Vec<String>> = HashMap::new();
for host in &host_ports{
write!(services_file, "{}\n", host).unwrap();
let host_data: Vec<&str> = host.split_whitespace().collect();
let address = host_data[0].to_owned();
let port = host_data[1].to_owned();
let service = host_data[2..].join(" ");
if host_all_ports.contains_key(&address){
host_all_ports.get_mut(&address).unwrap().push(format!("{}:{}", port, service));
}
else {
host_all_ports.insert(address, vec![format!("{}:{}", port, service)]);
}
}
if enumeration_write{
let mut enumeration_file = enumeration_open_res.unwrap();
let write_res = write!(enumeration_file, "\n# Port Scan\n");
if write_res.is_ok(){
write_res.unwrap();
for host in host_all_ports.keys(){
write!(enumeration_file, "## {}\n| HOST | PORT | SERVICE |\n| ---- | ---- | ------- |\n", host).unwrap();
for port_entry in &host_all_ports[host]{
println!("{}", port_entry);
let parts: Vec<&str> = port_entry.split(":").collect();
let port = parts[0];
let services = parts[1];
write!(enumeration_file, "| {} | {} |\n", port, services).unwrap();
}
}
write!(enumeration_file, "---\n").unwrap();
}
}
println!("FROM NMAP THREAD: Parsing done! You're scan results are saved in cobalt strike services.tsv format at {}", save_path.display());
});
sleep(Duration::from_secs(10));
return Some(nmap_thread);
}
pub fn build_nmap_command(project: &Project){

View File

@@ -68,6 +68,7 @@ pub fn save_projects(projects: &Vec<Project>, config_path: &PathBuf){
}
}
#[allow(unused)]
pub fn new_project(projects: &mut Vec<Project>, project_dir: &PathBuf, notes_dir: &PathBuf, tools_dir: &PathBuf, boxtemplate: &String, config_path: &PathBuf, new_id: i32, upcoming_files: &PathBuf, upcoming_notes: &PathBuf, fingerprint: bool){
let mut new_project_dir = PathBuf::new();
let mut new_note_dir = PathBuf::new();

View File

@@ -75,18 +75,7 @@ Planning call notes:
* password attacks
* password sprays 3-12 hours
* lock out policy -
## Enumeration in progress
### DNS Bruteforcing
| domain name | IP | inscope? |
| ----------- | -- | -------- |
# Attack Surface Enumeration
| IP | host notes | needs? |
| -- | ---------- | ------ |\n").expect("faile to write pentest notes");
|\n").expect("faile to write pentest notes");
}
notes_path.pop();

View File

@@ -1,6 +1,6 @@
use std::path::PathBuf;
use walkdir::WalkDir;
use crate::{get_user_input, Project};
use crate::get_user_input;
pub fn sharp_persist_command(tools_dir: &PathBuf){
let filename = "SharPersist.exe";