Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
249ecc786d | ||
|
|
6959e77d57 | ||
|
|
33450cb1ba | ||
|
|
55a6faac2d | ||
|
|
737bee37e7 |
10
pentest_tool/Cargo.lock
generated
10
pentest_tool/Cargo.lock
generated
@@ -238,6 +238,15 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.7"
|
||||
@@ -1257,6 +1266,7 @@ version = "3.1.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clearscreen",
|
||||
"colored",
|
||||
"directories",
|
||||
"dns-lookup",
|
||||
"fs_extra",
|
||||
|
||||
@@ -6,6 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
chrono = "0.4.39"
|
||||
clearscreen = "3.0.0"
|
||||
colored = "3.0.0"
|
||||
directories = "5.0.1"
|
||||
dns-lookup = "2.0.4"
|
||||
fs_extra = "1.3.0"
|
||||
|
||||
@@ -5,6 +5,8 @@ use std::fs;
|
||||
use std::io::Write;
|
||||
use std::thread::{self, JoinHandle};
|
||||
use std::time::Duration;
|
||||
use colored::Colorize;
|
||||
|
||||
use crate::{get_user_input, Project};
|
||||
|
||||
pub fn stop_all_boxes(projects: &Vec<Project>){
|
||||
@@ -74,6 +76,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();
|
||||
@@ -221,8 +224,8 @@ pub fn launch_cobalt_strike(project: Project) -> Option<JoinHandle<()>>{
|
||||
.output();
|
||||
if cobalt_strike_launch_result.is_err(){
|
||||
let error = cobalt_strike_launch_result.err().unwrap();
|
||||
println!("error launching cobalt strike!");
|
||||
println!("{}", error);
|
||||
println!("{}", "error launching cobalt strike!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -236,6 +239,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?");
|
||||
@@ -257,8 +261,8 @@ pub fn launch_bloodhound_gui(project: Project) -> Option<JoinHandle<()>>{
|
||||
.status();
|
||||
if neo4jstart_res.is_err(){
|
||||
let error = neo4jstart_res.err().unwrap();
|
||||
println!("errror starting neo4j...");
|
||||
println!("{}", error);
|
||||
println!("{}","errror starting neo4j...".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
neo4j_started = true;
|
||||
@@ -278,8 +282,8 @@ pub fn launch_bloodhound_gui(project: Project) -> Option<JoinHandle<()>>{
|
||||
.output();
|
||||
if bloodhound_res.is_err(){
|
||||
let error = bloodhound_res.err().unwrap();
|
||||
println!("error starting bloodhound!");
|
||||
println!("{}", error);
|
||||
println!("{}","error starting bloodhound!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
});
|
||||
return Some(handle);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::os::unix::thread;
|
||||
use std::path::PathBuf;
|
||||
use std::process::exit;
|
||||
use std::thread::JoinHandle;
|
||||
@@ -6,6 +5,7 @@ use chrono::Datelike;
|
||||
use clearscreen::clear;
|
||||
use clearscreen;
|
||||
use chrono::Local;
|
||||
use colored::Colorize;
|
||||
use crate::Project;
|
||||
use crate::project_controls;
|
||||
use crate::box_controls;
|
||||
@@ -17,6 +17,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 +60,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,31 +103,37 @@ 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
|
||||
")
|
||||
}
|
||||
|
||||
pub fn get_active_project(projects: &Vec<Project>) -> &Project{
|
||||
pub fn get_active_project(projects: &Vec<Project>) -> Option<&Project>{
|
||||
let mut active_project = &projects[0];
|
||||
for project in projects{
|
||||
if project.active == true{
|
||||
active_project = project
|
||||
}
|
||||
}
|
||||
return active_project
|
||||
return Some(active_project)
|
||||
}
|
||||
|
||||
pub fn next_project_id(config_path: &PathBuf) -> i32{
|
||||
let projects = project_controls::get_projects(config_path, false);
|
||||
pub fn next_project_id(config_path: &PathBuf) -> Option<i32>{
|
||||
let projects_res = project_controls::get_projects(config_path, false);
|
||||
if projects_res.is_none(){
|
||||
println!("{}", "Error loading projects!!".red());
|
||||
return None;
|
||||
}
|
||||
let projects = projects_res.unwrap();
|
||||
let mut new_id = 0;
|
||||
for project in projects.clone(){
|
||||
if project.id > new_id{
|
||||
new_id = project.id + 1;
|
||||
}
|
||||
}
|
||||
return new_id;
|
||||
return Some(new_id);
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn run_command(cmd: String,
|
||||
mut projects: &mut Vec<Project>,
|
||||
config_path: PathBuf,
|
||||
@@ -142,8 +150,18 @@ pub fn run_command(cmd: String,
|
||||
password_spray_file: &PathBuf,
|
||||
fingerprint: bool,
|
||||
vault_name: String) -> Option<JoinHandle<()>> {
|
||||
let mut new_id = next_project_id(&config_path);
|
||||
let active_project = get_active_project(&projects);
|
||||
let new_id_res = next_project_id(&config_path);
|
||||
if new_id_res.is_none(){
|
||||
println!("{}", "failed to get new project ID!".red());
|
||||
return None;
|
||||
}
|
||||
let mut new_id = new_id_res.unwrap();
|
||||
let active_project_res = get_active_project(&projects);
|
||||
if active_project_res.is_none(){
|
||||
println!("{}", "failed to get active project!".red());
|
||||
return None;
|
||||
}
|
||||
let active_project = active_project_res.unwrap();
|
||||
let mut notes_folder_string = format!("{}", &active_project.notes_folder.display());
|
||||
let mut obsidian_folder_vec = PathBuf::new();
|
||||
let mut reached_vault_folder = false;
|
||||
@@ -216,13 +234,15 @@ 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;}
|
||||
}
|
||||
}
|
||||
|
||||
fn print_banner(banner: &str){
|
||||
print!("{}", banner);
|
||||
print!("{}", banner.custom_color((255,165,0)));
|
||||
}
|
||||
|
||||
pub fn cli(interactive: bool,
|
||||
@@ -295,7 +315,12 @@ pub fn cli(interactive: bool,
|
||||
print_banner(banner);
|
||||
while loopize{
|
||||
project_controls::save_projects(&projects, &config_path);
|
||||
let active_project = get_active_project(&projects);
|
||||
let active_project_res = get_active_project(&projects);
|
||||
if active_project_res.is_none(){
|
||||
println!("{}", "failed to get active project!".red());
|
||||
return;
|
||||
}
|
||||
let active_project = active_project_res.unwrap();
|
||||
let current_information = format!("
|
||||
Active Project: {}, {}
|
||||
Project Status: {}
|
||||
@@ -307,8 +332,8 @@ Obsidian URI: {}
|
||||
for help enter help or ?. for information about a specific command enter help (command)
|
||||
|
||||
|
||||
", active_project.customer, active_project.project_name, active_project.stage, active_project.files_folder.display(), active_project.notes_folder.display(), active_project.boxname, "coming soon");
|
||||
let prompt = format!("\n{}:{}\nCommand?", active_project.customer, active_project.project_name);
|
||||
", active_project.customer.green(), active_project.project_name.green(), active_project.stage.green(), active_project.files_folder.display().to_string().green(), active_project.notes_folder.display().to_string().green(), active_project.boxname.green(), "coming soon".red());
|
||||
let prompt = format!("\n{}:{}\nCommand?", active_project.customer.green(), active_project.project_name.green());
|
||||
let command = get_user_input(&prompt);
|
||||
match command.as_str(){
|
||||
"exit" => loopize = false,
|
||||
|
||||
149
pentest_tool/src/configuration.rs
Normal file
149
pentest_tool/src/configuration.rs
Normal file
@@ -0,0 +1,149 @@
|
||||
use std::path::PathBuf;
|
||||
use std::fs::read_to_string;
|
||||
use std::io::Write;
|
||||
use colored::Colorize;
|
||||
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!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
println!("nothing was saved...");
|
||||
return;
|
||||
}
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,21 @@
|
||||
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 colored::Colorize;
|
||||
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.");
|
||||
@@ -54,16 +53,17 @@ pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>
|
||||
.output();
|
||||
if output_res.is_err(){
|
||||
let error = output_res.err().unwrap();
|
||||
println!("From DNS Enumeration Thread: error running dnsrecon in the project's distrobox!");
|
||||
println!("{}", error);
|
||||
println!("{}", "From DNS Enumeration Thread: error running dnsrecon in the project's distrobox!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
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();
|
||||
println!("From DNS Enumeration Thread: error reading output data!");
|
||||
println!("{}", error);
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let output_string = output_string_res.unwrap();
|
||||
@@ -122,14 +122,15 @@ 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");
|
||||
let enumeration_file_res = OpenOptions::new().append(true).create(true).open(enumeration_path);
|
||||
if enumeration_file_res.is_err(){
|
||||
let error = enumeration_file_res.err().unwrap();
|
||||
println!("error opening enumeration notes file!");
|
||||
println!("{}", error);
|
||||
println!("{}","error opening enumeration notes file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return None;
|
||||
}
|
||||
let mut enumeration_file = enumeration_file_res.unwrap();
|
||||
@@ -182,10 +183,12 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
|
||||
.output();
|
||||
if gobuster_cmd_res.is_err(){
|
||||
let error = gobuster_cmd_res.err().unwrap();
|
||||
println!("From gobuster thread: Error running gobuster command!");
|
||||
println!("{}", error);
|
||||
println!("{}","From gobuster thread: Error running gobuster command!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
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);
|
||||
@@ -216,8 +219,8 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
|
||||
let write_res = write!(enumeration_file, "{}", out_data);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("FROM Gobuster Thread: error writing notes!");
|
||||
println!("{}", error);
|
||||
println!("{}","FROM Gobuster Thread: error writing notes!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
write_res.unwrap();
|
||||
@@ -225,14 +228,90 @@ 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".red());
|
||||
println!("{}", error.to_string().red());
|
||||
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!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
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!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
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");
|
||||
let enumeration_file_res = OpenOptions::new().append(true).create(true).open(enumeration_path);
|
||||
if enumeration_file_res.is_err(){
|
||||
let error = enumeration_file_res.err().unwrap();
|
||||
println!("error opening enumeration notes file!");
|
||||
println!("{}", error);
|
||||
println!("{}","error opening enumeration notes file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return None;
|
||||
}
|
||||
let mut enumeration_file = enumeration_file_res.unwrap();
|
||||
@@ -253,8 +332,8 @@ pub fn do_all_dns_enumeration(project: &Project) -> Option<JoinHandle<()>>{
|
||||
let write_res = write!(enumeration_file, "# DNS Enumeration\n");
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("From All DNS thread: Error writing notes file!");
|
||||
println!("{}", error);
|
||||
println!("{}","From All DNS thread: Error writing notes file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
write_success = false;
|
||||
}
|
||||
if write_success{
|
||||
@@ -271,6 +350,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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
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 colored::Colorize;
|
||||
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 {
|
||||
@@ -40,8 +34,8 @@ pub fn run_initial_enum(project: &Project){
|
||||
let csv_read_res = fs::read_to_string(&csv_path);
|
||||
if csv_read_res.is_err(){
|
||||
let error = csv_read_res.err().unwrap();
|
||||
println!("error reading csv!");
|
||||
println!("{}", error);
|
||||
println!("{}","error reading csv!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let csv_data = csv_read_res.unwrap();
|
||||
@@ -77,16 +71,16 @@ pub fn run_initial_enum(project: &Project){
|
||||
let host_notes_open_res = fs::OpenOptions::new().append(true).create(true).open(&host_notes_path);
|
||||
if host_notes_open_res.is_err(){
|
||||
let error = host_notes_open_res.err().unwrap();
|
||||
println!("error opening host notes file!");
|
||||
println!("{}", error);
|
||||
println!("{}","error opening host notes file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let host_notes = host_notes_open_res.unwrap();
|
||||
let attack_notes_open_res = fs::OpenOptions::new().append(true).create(true).open(&attack_notes_path);
|
||||
if attack_notes_open_res.is_err(){
|
||||
let error = attack_notes_open_res.err().unwrap();
|
||||
println!("error opening attack notes!");
|
||||
println!("{}", error);
|
||||
println!("{}","error opening attack notes!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
for target in targets.clone(){
|
||||
@@ -101,7 +95,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,
|
||||
@@ -117,7 +111,7 @@ pub fn build_external_attack_notes(project: &Project){
|
||||
if host_notes_read_res.is_err(){
|
||||
let error = host_notes_read_res.err().unwrap();
|
||||
println!("error reading host notes");
|
||||
println!("{}", error);
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let host_notes_string = host_notes_read_res.unwrap();
|
||||
@@ -173,7 +167,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 +194,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 +204,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);
|
||||
@@ -228,8 +222,8 @@ pub fn print_report_information(project: &Project){
|
||||
let enumeration_read_res = fs::read_to_string(notes_path);
|
||||
if enumeration_read_res.is_err(){
|
||||
let error = enumeration_read_res.err().unwrap();
|
||||
println!("error reading enumeration notes!");
|
||||
println!("{}", error);
|
||||
println!("{}","error reading enumeration notes!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
let enumeration_text = enumeration_read_res.unwrap();
|
||||
@@ -364,6 +358,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 +446,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 +591,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");
|
||||
@@ -757,7 +753,7 @@ pub fn get_mssql_column_names(project: &Project) -> Option<JoinHandle<()>>{
|
||||
if netexec_cmd_res.is_err(){
|
||||
let error = netexec_cmd_res.err().unwrap();
|
||||
println!("error running netexec command!");
|
||||
println!("{}", error);
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
let output_string = String::from_utf8(netexec_cmd_res.unwrap().stdout).unwrap();
|
||||
@@ -775,7 +771,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>>{
|
||||
@@ -832,8 +828,8 @@ last
|
||||
let gather_source = fs::read_to_string(gather_file);
|
||||
if gather_source.is_err(){
|
||||
let error = gather_source.err().unwrap();
|
||||
println!("error reading gather contacts output!");
|
||||
println!("{}", error);
|
||||
println!("{}","error reading gather contacts output!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let gather_source_string = gather_source.unwrap();
|
||||
@@ -859,15 +855,15 @@ last
|
||||
let email_text_res = OpenOptions::new().append(true).create(true).open(email_text_path);
|
||||
if email_text_res.is_err(){
|
||||
let error = email_text_res.err().unwrap();
|
||||
println!("error opening email text file!");
|
||||
println!("{}", error);
|
||||
println!("{}","error opening email text file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let email_notes_res = OpenOptions::new().append(true).create(true).open(email_note_path);
|
||||
if email_notes_res.is_err(){
|
||||
let error = email_notes_res.err().unwrap();
|
||||
println!("error opeing email notes file!");
|
||||
println!("{}", error);
|
||||
println!("{}","error opeing email notes file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let mut email_text_file = email_text_res.unwrap();
|
||||
@@ -876,8 +872,8 @@ last
|
||||
let note_wriet_res = write!(email_note_file, "# Email Enumeration\n");
|
||||
if note_wriet_res.is_err(){
|
||||
let error = note_wriet_res.err().unwrap();
|
||||
println!("error writing to email notes file!");
|
||||
println!("{}", error);
|
||||
println!("{}","error writing to email notes file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
write_success = false;
|
||||
}
|
||||
if write_success{
|
||||
@@ -896,9 +892,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();
|
||||
@@ -906,8 +902,8 @@ pub fn get_scope_entries(project: &Project) -> Option<Vec<String>>{
|
||||
let genera_read_res = read_to_string(general_path);
|
||||
if genera_read_res.is_err(){
|
||||
let error = genera_read_res.err().unwrap();
|
||||
println!("ooof error reading your general notes file!");
|
||||
println!("{}", error);
|
||||
println!("{}","ooof error reading your general notes file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return None;
|
||||
}
|
||||
let general_string = genera_read_res.unwrap();
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
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 colored::Colorize;
|
||||
|
||||
use crate::get_user_input;
|
||||
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn install(config_path: &PathBuf){
|
||||
let mut _terminal_commands = HashMap::from([
|
||||
("kde", "konsole -e !!!"),
|
||||
@@ -53,8 +52,8 @@ pub fn install(config_path: &PathBuf){
|
||||
let create_res = create_dir_all(folder);
|
||||
if create_res.is_err(){
|
||||
let error = create_res.err().unwrap();
|
||||
println!("error creating folder {}", folder.display());
|
||||
println!("{}", error);
|
||||
println!("{}{}","error creating folder ".red(), folder.display().to_string().red());
|
||||
println!("{}", error.to_string().red());
|
||||
println!("you'll need to create this manually after the install is done!");
|
||||
folder_creation = false;
|
||||
}
|
||||
@@ -65,12 +64,12 @@ pub fn install(config_path: &PathBuf){
|
||||
let distrobox_run_res = Command::new("distrobox").arg("list").arg("--root").output();
|
||||
if distrobox_run_res.is_err(){
|
||||
let error = distrobox_run_res.err().unwrap();
|
||||
println!("Distrobox file was not found!");
|
||||
println!("This usually means that distrobox is not installed.");
|
||||
println!("please install distrobox, if you're on kali run `sudo apt install distrobox`");
|
||||
println!("{}", error);
|
||||
println!("this project heavily relies on distrobox, as its primarily a distrobox mangement tool.");
|
||||
println!("cleaning up up configuration folders, please install distrobox and re-run this program.");
|
||||
println!("{}","Distrobox file was not found!".red());
|
||||
println!("{}","This usually means that distrobox is not installed.".red());
|
||||
println!("{}","please install distrobox, if you're on kali run `sudo apt install distrobox`".red());
|
||||
println!("{}", error.to_string().red());
|
||||
println!("{}","this project heavily relies on distrobox, as its primarily a distrobox mangement tool.".red());
|
||||
println!("{}","cleaning up up configuration folders, please install distrobox and re-run this program.".red());
|
||||
let cleanup = remove_dir_all(&del_on_fail);
|
||||
if cleanup.is_err(){
|
||||
println!("error cleaning up configuration folder!");
|
||||
@@ -120,9 +119,9 @@ pub fn install(config_path: &PathBuf){
|
||||
.status();
|
||||
if template_box_create_res.is_err(){
|
||||
let error = template_box_create_res.err().unwrap();
|
||||
println!("error creating template box!");
|
||||
println!("{}", error);
|
||||
println!("\n\n\nplese create it yourself with the following command.");
|
||||
println!("{}","error creating template box!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
println!("{}","\n\n\nplese create it yourself with the following command.".red());
|
||||
println!("\n\ndistrobox create --root --image {}, --name {}, --init --volume {}", &box_image, &template_box_name, &tool_volume);
|
||||
}
|
||||
else{
|
||||
@@ -214,8 +213,8 @@ vault_name:{}"
|
||||
let project_conf_res = File::create_new(&projects_conf_path);
|
||||
if project_conf_res.is_err(){
|
||||
let error = project_conf_res.err().unwrap();
|
||||
println!("ooof error creating the projects configuration file.");
|
||||
println!("try creating it manually!");
|
||||
println!("{}","ooof error creating the projects configuration file.".red());
|
||||
println!("{}","try creating it manually!".red());
|
||||
println!("copy the following configuration and save it to {}", &projects_conf_path.display());
|
||||
println!("customer:name:notes:files:active:time:box_name:stage");
|
||||
println!("default:default:{}:{}:yes:{}:current", ¤t_notes.display(), ¤t_projects.display(), &template_box_name);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::{io::stdin, path::PathBuf, process::Command};
|
||||
use directories::UserDirs;
|
||||
use reqwest::Response;
|
||||
use std::process::exit;
|
||||
use std::fs::{self, File};
|
||||
use colored::Colorize;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Project{
|
||||
@@ -27,13 +27,14 @@ 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);
|
||||
if file_create_res.is_err(){
|
||||
let error = file_create_res.err().unwrap();
|
||||
println!("error opening {} file!", path.display());
|
||||
println!("{}", error);
|
||||
println!("{} {} {}","error opening".red(), path.display().to_string().red(), " file".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return None;
|
||||
}
|
||||
else {
|
||||
@@ -46,8 +47,8 @@ pub fn open_append(path: &PathBuf) -> Option<File>{
|
||||
let file_create_res = fs::OpenOptions::new().create(true).append(true).open(path);
|
||||
if file_create_res.is_err(){
|
||||
let error = file_create_res.err().unwrap();
|
||||
println!("error opening {} file!", path.display());
|
||||
println!("{}", error);
|
||||
println!("{} {} {}","error opening".red(), path.display().to_string().red(), " file".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return None;
|
||||
}
|
||||
else {
|
||||
@@ -74,7 +75,7 @@ pub fn get_user_input(prompt: &str) -> String{
|
||||
|
||||
|
||||
fn main() {
|
||||
print!("
|
||||
print!("{}","
|
||||
⠀⠀⠀⣠⠶⠚⠛⠛⠛⠲⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⣠⣾⣷⣄⠀⠀⠀⢀⣠⣤⣤⡀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
@@ -93,7 +94,7 @@ fn main() {
|
||||
⠀⠀⠀⠀⣀⡀⠀⣰⠇⣾⠀⠀⠈⣩⣥⣄⣿⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⢿⡉⠳⡟⣸⠃⠀⠀⠀⠘⢷⣌⠉⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠙⢦⣴⠏⠀⠀⠀⠀⠀⠀⠉⠳⠶⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
");
|
||||
".red());
|
||||
let mut config_path = PathBuf::new();
|
||||
let user_dirs_res = UserDirs::new();
|
||||
if user_dirs_res.is_none(){
|
||||
@@ -161,9 +162,15 @@ fn main() {
|
||||
cracking_rig: {}\n
|
||||
upcoming project folders: {}
|
||||
upcoming project notes: {}
|
||||
", &project_base_folder.display(), &project_base_notes.display(), &tools_folder.display(), box_template, terminal_command, cracking_rig, &upcoming_files.display(), &upcoming_notes.display());
|
||||
println!("loading project configs...");
|
||||
let projects = project_controls::get_projects(&config_path, true);
|
||||
", &project_base_folder.display().to_string().green(), &project_base_notes.display().to_string().green(), &tools_folder.display().to_string().green(), box_template.to_string().green(), terminal_command.green(), cracking_rig.green(), &upcoming_files.display().to_string().green(), &upcoming_notes.display().to_string().green());
|
||||
println!("{}","loading project configs...".green());
|
||||
let projects_res = project_controls::get_projects(&config_path, true);
|
||||
if projects_res.is_none(){
|
||||
println!("{}", "ERROR NO PROJECTS LOADED!!!".red());
|
||||
println!("{}", "CHECK YOUR PROJECTS.CONF FILE".red());
|
||||
return;
|
||||
}
|
||||
let projects = projects_res.unwrap();
|
||||
let _continue = get_user_input("press enter to load command line interface.");
|
||||
cli::cli(true, projects, config_path, &project_base_folder, &project_base_notes, &tools_folder, box_template, terminal_command, cracking_rig, rockyou, rule, &upcoming_files, &upcoming_notes, &pass_spray_file, fingerprint, vault_name);
|
||||
}
|
||||
|
||||
@@ -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!"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
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 colored::Colorize;
|
||||
use walkdir::WalkDir;
|
||||
use crate::get_user_input;
|
||||
use crate::Project;
|
||||
@@ -54,8 +56,8 @@ pub fn parse_normal_nmap_output(project: &Project){
|
||||
let file_read_res = fs::read_to_string(file_to_parse);
|
||||
if file_read_res.is_err(){
|
||||
let error = file_read_res.err().unwrap();
|
||||
println!("ooof error reading the file!");
|
||||
println!("{}", error);
|
||||
println!("{}","ooof error reading the file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let nmap_string = file_read_res.unwrap();
|
||||
@@ -96,8 +98,8 @@ pub fn parse_normal_nmap_output(project: &Project){
|
||||
let save_open_res = fs::OpenOptions::new().create(true).append(true).open(&save_path);
|
||||
if save_open_res.is_err(){
|
||||
let error = save_open_res.err().unwrap();
|
||||
println!("oof error opening the save file!");
|
||||
println!("{}", error);
|
||||
println!("{}","oof error opening the save file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
if get_user_input("do you want to print the results to the console instead?").to_lowercase().contains("y"){
|
||||
for host in &host_ports{
|
||||
println!("{}", host);
|
||||
@@ -111,8 +113,8 @@ pub fn parse_normal_nmap_output(project: &Project){
|
||||
let tsv_open_res = fs::OpenOptions::new().create(true).append(true).open(save_path);
|
||||
if tsv_open_res.is_err(){
|
||||
let error = tsv_open_res.err().unwrap();
|
||||
println!("error opening tsv file!");
|
||||
println!("{}", error);
|
||||
println!("{}","error opening tsv file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
if get_user_input("do you want to print the results to the console instead?").to_lowercase().contains("y"){
|
||||
for host in &host_ports{
|
||||
println!("{}", host);
|
||||
@@ -259,8 +261,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let tsv_read_res = read_to_string(tsv_path);
|
||||
if tsv_read_res.is_err(){
|
||||
let error = tsv_read_res.err().unwrap();
|
||||
println!("ooof error reading tsv file!");
|
||||
println!("{}", error);
|
||||
println!("{}","ooof error reading tsv file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
println!("tsv read, parsing lines...");
|
||||
@@ -335,8 +337,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(windows_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing windows_hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing windows_hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -352,8 +354,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(ssh_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing ssh_hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing ssh_hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -369,8 +371,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(telnet_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing _hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -386,8 +388,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(ftp_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing _hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -403,8 +405,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(snmp_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing _hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -420,8 +422,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(dns_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing _hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -437,8 +439,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(rdp_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing _hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -454,8 +456,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(web_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("oooof error writing _hosts.txt!!");
|
||||
println!("{}", error);
|
||||
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
@@ -469,8 +471,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let untagged_res = create_dir_all(&outfile);
|
||||
if untagged_res.is_err(){
|
||||
let error = untagged_res.err().unwrap();
|
||||
println!("ooof error creating untagged folder!");
|
||||
println!("{}", error);
|
||||
println!("{}","ooof error creating untagged folder!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
untagged_res.unwrap();
|
||||
@@ -488,8 +490,8 @@ pub fn parse_csportscan(project: &Project){
|
||||
let write_res = write!(write_file, "{}\n", host);
|
||||
if write_res.is_err(){
|
||||
let error = write_res.err().unwrap();
|
||||
println!("ooof error writing to file...");
|
||||
println!("{}", error);
|
||||
println!("{}","ooof error writing to file...".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
@@ -498,8 +500,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 +518,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 +559,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 +578,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")
|
||||
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 = project.files_folder.clone();
|
||||
}
|
||||
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(project.boxname.to_owned())
|
||||
.arg(working_project.boxname)
|
||||
.arg("--")
|
||||
.arg("proxychains")
|
||||
.arg("namp")
|
||||
.arg("nmap")
|
||||
.arg("-sT")
|
||||
.arg("-p")
|
||||
.arg(port_string)
|
||||
.arg(hosts_string)
|
||||
.arg(ports_to_scan.join(","))
|
||||
.arg(targets.join(" "))
|
||||
.output();
|
||||
if command_res.is_err(){
|
||||
let error = command_res.err().unwrap();
|
||||
println!("error running portscan command!");
|
||||
println!("{}", error);
|
||||
if port_scancmd_res.is_err(){
|
||||
let error = port_scancmd_res.err().unwrap();
|
||||
println!("{}","FROM NMAP THREAD: error running portscan!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let output = command_res.unwrap().stdout;
|
||||
scan_results = String::from_utf8_lossy(&output).into_owned();
|
||||
nmap_output = port_scancmd_res.unwrap().stdout;
|
||||
}
|
||||
else{
|
||||
let command_res = Command::new("distrobox")
|
||||
let port_scancmd_res = Command::new("distrobox")
|
||||
.arg("enter")
|
||||
.arg("--root")
|
||||
.arg(project.boxname.to_owned())
|
||||
.arg(working_project.boxname)
|
||||
.arg("--")
|
||||
.arg("proxychains")
|
||||
.arg("namp")
|
||||
.arg("nmap")
|
||||
.arg("-sT")
|
||||
.arg("-p")
|
||||
.arg(port_string)
|
||||
.arg(hosts_string)
|
||||
.arg(ports_to_scan.join(","))
|
||||
.arg(targets.join(" "))
|
||||
.output();
|
||||
if command_res.is_err(){
|
||||
let error = command_res.err().unwrap();
|
||||
println!("error running portscan command!");
|
||||
println!("{}", error);
|
||||
if port_scancmd_res.is_err(){
|
||||
let error = port_scancmd_res.err().unwrap();
|
||||
println!("{}","FROM NMAP THREAD: error running portscan!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let output = command_res.unwrap().stdout;
|
||||
scan_results = String::from_utf8_lossy(&output).into_owned();
|
||||
nmap_output = port_scancmd_res.unwrap().stdout;
|
||||
}
|
||||
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"){
|
||||
save_path.clear();
|
||||
save_path.push(get_user_input("where do you want to save it then? (full path)"));
|
||||
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 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);
|
||||
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 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);
|
||||
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!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
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){
|
||||
|
||||
@@ -8,6 +8,8 @@ use std::process::Command;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::str::FromStr;
|
||||
use colored::Colorize;
|
||||
|
||||
use crate::get_user_input;
|
||||
use crate::Project;
|
||||
use crate::box_controls::make_box;
|
||||
@@ -68,6 +70,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();
|
||||
@@ -290,7 +293,7 @@ pub fn remove_project(projects: &mut Vec<Project>, config_path: &PathBuf){
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_projects(config_path: &PathBuf, show: bool) -> Vec<Project>{
|
||||
pub fn get_projects(config_path: &PathBuf, show: bool) -> Option<Vec<Project>>{
|
||||
let mut mut_config_path = config_path.clone();
|
||||
mut_config_path.pop();
|
||||
mut_config_path.push("projects.conf");
|
||||
@@ -300,11 +303,18 @@ pub fn get_projects(config_path: &PathBuf, show: bool) -> Vec<Project>{
|
||||
let bkup_result = fs::copy(&mut_config_path, &bkup_config_path);
|
||||
if bkup_result.is_err(){
|
||||
let error = bkup_result.err().unwrap();
|
||||
println!("error backing up the projects.conf file!");
|
||||
println!("error: {}", error);
|
||||
println!("{}","error backing up the projects.conf file!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
let mut projects = Vec::new();
|
||||
let projects_string = fs::read_to_string(mut_config_path).expect("error reading projects file");
|
||||
let projects_string_res = fs::read_to_string(mut_config_path);
|
||||
if projects_string_res.is_err(){
|
||||
let error = projects_string_res.err().unwrap();
|
||||
println!("{}", "Error Loading Project!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return None;
|
||||
}
|
||||
let projects_string = projects_string_res.unwrap();
|
||||
let project_lines:Vec<&str> = projects_string.split("\n").collect();
|
||||
let mut first = 0;
|
||||
let mut already_active = false;
|
||||
@@ -337,13 +347,13 @@ pub fn get_projects(config_path: &PathBuf, show: bool) -> Vec<Project>{
|
||||
let project_stage = settings[6].to_owned();
|
||||
let new_project = Project{customer: customer, project_name: project, files_folder: project_folder, notes_folder: notes_folder, active: active, id: first, boxname: boxname, stage: project_stage};
|
||||
if show{
|
||||
println!("{} {} LOADED!", &new_project.customer, &new_project.project_name);
|
||||
println!("{} {} {}", &new_project.customer, &new_project.project_name, "LOADED!".green());
|
||||
}
|
||||
projects.push(new_project);
|
||||
}
|
||||
}
|
||||
}
|
||||
return projects
|
||||
return Some(projects)
|
||||
}
|
||||
|
||||
pub fn print_upcoming_projects(projects: &Vec<Project>){
|
||||
|
||||
@@ -2,6 +2,8 @@ use std::fs;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
use colored::Colorize;
|
||||
|
||||
use crate::Project;
|
||||
use crate::project_controls;
|
||||
use crate::get_user_input;
|
||||
@@ -37,7 +39,8 @@ fn external(passtemp: &PathBuf, project: &Project){
|
||||
let file_creation_res = fs::create_dir_all(¬es_path);
|
||||
if file_creation_res.is_err(){
|
||||
let error = file_creation_res.err().unwrap();
|
||||
println!("error creating notes folder! {}", error);
|
||||
println!("{}","error creating notes folder!".red());
|
||||
println!("{}", error.to_string().red())
|
||||
}
|
||||
else{
|
||||
file_creation_res.unwrap();
|
||||
@@ -75,18 +78,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();
|
||||
@@ -146,7 +138,8 @@ fn internal(passtemp: &PathBuf, project: &Project){
|
||||
let file_creation_res = fs::create_dir_all(¬es_path);
|
||||
if file_creation_res.is_err(){
|
||||
let error = file_creation_res.err().unwrap();
|
||||
println!("error creating notes folder! {}", error);
|
||||
println!("{}","error creating notes folder!".red());
|
||||
println!("{}", error.to_string().red())
|
||||
}
|
||||
else{
|
||||
file_creation_res.unwrap();
|
||||
@@ -156,7 +149,8 @@ fn internal(passtemp: &PathBuf, project: &Project){
|
||||
let pass_result = fs::copy(&passtemp, ¬es_path);
|
||||
if pass_result.is_err(){
|
||||
let error = pass_result.err().unwrap();
|
||||
println!("error copying password spray file, try again manually! {}", error);
|
||||
println!("{}","error copying password spray file, try again manually!".red());
|
||||
println!("{}", error.to_string().red())
|
||||
}
|
||||
else{
|
||||
pass_result.unwrap();
|
||||
@@ -327,8 +321,8 @@ fn vishing(project: &Project){
|
||||
let mknote_folder_res = fs::create_dir_all(¬es_path);
|
||||
if mknote_folder_res.is_err(){
|
||||
let error = mknote_folder_res.err().unwrap();
|
||||
println!("Error creating notes folder!");
|
||||
println!("{}", error);
|
||||
println!("{}","Error creating notes folder!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
notes_path.push("general.md");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use std::{env::set_current_dir, path::PathBuf};
|
||||
use std::process::Command;
|
||||
use colored::Colorize;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
|
||||
@@ -16,8 +17,8 @@ pub fn update_git_tools(tools_dir: &PathBuf){
|
||||
let cd_res = set_current_dir(&folder);
|
||||
if cd_res.is_err(){
|
||||
let error = cd_res.err().unwrap();
|
||||
println!("error changing directory!");
|
||||
println!("{}", error);
|
||||
println!("{}","error changing directory!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
let _cd = cd_res.unwrap();
|
||||
@@ -27,8 +28,8 @@ pub fn update_git_tools(tools_dir: &PathBuf){
|
||||
.status();
|
||||
if git_command_res.is_err(){
|
||||
let error = git_command_res.err().unwrap();
|
||||
println!("error running git pull command!");
|
||||
println!("{}", error);
|
||||
println!("{}","error running git pull command!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
}
|
||||
else{
|
||||
let git_command = git_command_res.unwrap();
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user