Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
249ecc786d | ||
|
|
6959e77d57 |
10
pentest_tool/Cargo.lock
generated
10
pentest_tool/Cargo.lock
generated
@@ -238,6 +238,15 @@ dependencies = [
|
|||||||
"winapi",
|
"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]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.7"
|
version = "4.6.7"
|
||||||
@@ -1257,6 +1266,7 @@ version = "3.1.1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clearscreen",
|
"clearscreen",
|
||||||
|
"colored",
|
||||||
"directories",
|
"directories",
|
||||||
"dns-lookup",
|
"dns-lookup",
|
||||||
"fs_extra",
|
"fs_extra",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4.39"
|
chrono = "0.4.39"
|
||||||
clearscreen = "3.0.0"
|
clearscreen = "3.0.0"
|
||||||
|
colored = "3.0.0"
|
||||||
directories = "5.0.1"
|
directories = "5.0.1"
|
||||||
dns-lookup = "2.0.4"
|
dns-lookup = "2.0.4"
|
||||||
fs_extra = "1.3.0"
|
fs_extra = "1.3.0"
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ use std::fs;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::thread::{self, JoinHandle};
|
use std::thread::{self, JoinHandle};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use colored::Colorize;
|
||||||
|
|
||||||
use crate::{get_user_input, Project};
|
use crate::{get_user_input, Project};
|
||||||
|
|
||||||
pub fn stop_all_boxes(projects: &Vec<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");
|
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){
|
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!");
|
println!("stopping template box to ensure we can clone it!");
|
||||||
let stop_result = Command::new("distrobox").arg("stop").arg("--root").arg(boxtemplate).status();
|
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();
|
.output();
|
||||||
if cobalt_strike_launch_result.is_err(){
|
if cobalt_strike_launch_result.is_err(){
|
||||||
let error = cobalt_strike_launch_result.err().unwrap();
|
let error = cobalt_strike_launch_result.err().unwrap();
|
||||||
println!("error launching cobalt strike!");
|
println!("{}", "error launching cobalt strike!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -236,6 +239,7 @@ pub fn launch_cobalt_strike(project: Project) -> Option<JoinHandle<()>>{
|
|||||||
return Some(handle);
|
return Some(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub fn launch_bloodhound_gui(project: Project) -> Option<JoinHandle<()>>{
|
pub fn launch_bloodhound_gui(project: Project) -> Option<JoinHandle<()>>{
|
||||||
let mut bloodhound_command = String::new();
|
let mut bloodhound_command = String::new();
|
||||||
let version_response = get_user_input("do you want to use a specific bloodhound version?");
|
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();
|
.status();
|
||||||
if neo4jstart_res.is_err(){
|
if neo4jstart_res.is_err(){
|
||||||
let error = neo4jstart_res.err().unwrap();
|
let error = neo4jstart_res.err().unwrap();
|
||||||
println!("errror starting neo4j...");
|
println!("{}","errror starting neo4j...".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
neo4j_started = true;
|
neo4j_started = true;
|
||||||
@@ -278,8 +282,8 @@ pub fn launch_bloodhound_gui(project: Project) -> Option<JoinHandle<()>>{
|
|||||||
.output();
|
.output();
|
||||||
if bloodhound_res.is_err(){
|
if bloodhound_res.is_err(){
|
||||||
let error = bloodhound_res.err().unwrap();
|
let error = bloodhound_res.err().unwrap();
|
||||||
println!("error starting bloodhound!");
|
println!("{}","error starting bloodhound!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return Some(handle);
|
return Some(handle);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use std::os::unix::thread;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use std::thread::JoinHandle;
|
use std::thread::JoinHandle;
|
||||||
@@ -6,6 +5,7 @@ use chrono::Datelike;
|
|||||||
use clearscreen::clear;
|
use clearscreen::clear;
|
||||||
use clearscreen;
|
use clearscreen;
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
|
use colored::Colorize;
|
||||||
use crate::Project;
|
use crate::Project;
|
||||||
use crate::project_controls;
|
use crate::project_controls;
|
||||||
use crate::box_controls;
|
use crate::box_controls;
|
||||||
@@ -108,27 +108,32 @@ 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];
|
let mut active_project = &projects[0];
|
||||||
for project in projects{
|
for project in projects{
|
||||||
if project.active == true{
|
if project.active == true{
|
||||||
active_project = project
|
active_project = project
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return active_project
|
return Some(active_project)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_project_id(config_path: &PathBuf) -> i32{
|
pub fn next_project_id(config_path: &PathBuf) -> Option<i32>{
|
||||||
let projects = project_controls::get_projects(config_path, false);
|
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;
|
let mut new_id = 0;
|
||||||
for project in projects.clone(){
|
for project in projects.clone(){
|
||||||
if project.id > new_id{
|
if project.id > new_id{
|
||||||
new_id = project.id + 1;
|
new_id = project.id + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new_id;
|
return Some(new_id);
|
||||||
}
|
}
|
||||||
|
#[allow(unused)]
|
||||||
pub fn run_command(cmd: String,
|
pub fn run_command(cmd: String,
|
||||||
mut projects: &mut Vec<Project>,
|
mut projects: &mut Vec<Project>,
|
||||||
config_path: PathBuf,
|
config_path: PathBuf,
|
||||||
@@ -145,8 +150,18 @@ pub fn run_command(cmd: String,
|
|||||||
password_spray_file: &PathBuf,
|
password_spray_file: &PathBuf,
|
||||||
fingerprint: bool,
|
fingerprint: bool,
|
||||||
vault_name: String) -> Option<JoinHandle<()>> {
|
vault_name: String) -> Option<JoinHandle<()>> {
|
||||||
let mut new_id = next_project_id(&config_path);
|
let new_id_res = next_project_id(&config_path);
|
||||||
let active_project = get_active_project(&projects);
|
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 notes_folder_string = format!("{}", &active_project.notes_folder.display());
|
||||||
let mut obsidian_folder_vec = PathBuf::new();
|
let mut obsidian_folder_vec = PathBuf::new();
|
||||||
let mut reached_vault_folder = false;
|
let mut reached_vault_folder = false;
|
||||||
@@ -227,7 +242,7 @@ pub fn run_command(cmd: String,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn print_banner(banner: &str){
|
fn print_banner(banner: &str){
|
||||||
print!("{}", banner);
|
print!("{}", banner.custom_color((255,165,0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cli(interactive: bool,
|
pub fn cli(interactive: bool,
|
||||||
@@ -300,7 +315,12 @@ pub fn cli(interactive: bool,
|
|||||||
print_banner(banner);
|
print_banner(banner);
|
||||||
while loopize{
|
while loopize{
|
||||||
project_controls::save_projects(&projects, &config_path);
|
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!("
|
let current_information = format!("
|
||||||
Active Project: {}, {}
|
Active Project: {}, {}
|
||||||
Project Status: {}
|
Project Status: {}
|
||||||
@@ -312,8 +332,8 @@ Obsidian URI: {}
|
|||||||
for help enter help or ?. for information about a specific command enter help (command)
|
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");
|
", 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, active_project.project_name);
|
let prompt = format!("\n{}:{}\nCommand?", active_project.customer.green(), active_project.project_name.green());
|
||||||
let command = get_user_input(&prompt);
|
let command = get_user_input(&prompt);
|
||||||
match command.as_str(){
|
match command.as_str(){
|
||||||
"exit" => loopize = false,
|
"exit" => loopize = false,
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
use std::{fmt::write, path::PathBuf};
|
use std::path::PathBuf;
|
||||||
use std::fs::read_to_string;
|
use std::fs::read_to_string;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use crate::{get_user_input, open_overwrite, Project};
|
use colored::Colorize;
|
||||||
|
use crate::{get_user_input, open_overwrite};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub fn generate_tool_config(config_dir: &PathBuf){
|
pub fn generate_tool_config(config_dir: &PathBuf){
|
||||||
let mut config_file_path = config_dir.clone();
|
let mut config_file_path = config_dir.clone();
|
||||||
println!("{}", config_file_path.display());
|
println!("{}", config_file_path.display());
|
||||||
@@ -137,8 +139,8 @@ vault_name:{}
|
|||||||
let write_res= write!(config_file, "{}", new_config);
|
let write_res= write!(config_file, "{}", new_config);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("error writing config file!");
|
println!("{}","error writing config file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
println!("nothing was saved...");
|
println!("nothing was saved...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,17 +4,18 @@ use std::thread::JoinHandle;
|
|||||||
use std::thread::{spawn, sleep};
|
use std::thread::{spawn, sleep};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use colored::Colorize;
|
||||||
use dns_lookup::lookup_host;
|
use dns_lookup::lookup_host;
|
||||||
use crate::get_user_input;
|
use crate::get_user_input;
|
||||||
use crate::info_controls::get_scope_entries;
|
|
||||||
use crate::Project;
|
use crate::Project;
|
||||||
use crate::open_append;
|
use crate::open_append;
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>>, standalone: bool) -> Option<JoinHandle<()>>{
|
pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>>, standalone: bool) -> Option<JoinHandle<()>>{
|
||||||
let notes_folder = project.notes_folder.clone();
|
let notes_folder = project.notes_folder.clone();
|
||||||
let mut enumeration = notes_folder.clone();
|
let mut enumeration = notes_folder.clone();
|
||||||
enumeration.push("enumeration.md");
|
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(){
|
if enumeration_file_res.is_none(){
|
||||||
println!("error opening enumeration_file!");
|
println!("error opening enumeration_file!");
|
||||||
println!("try creating it manually.");
|
println!("try creating it manually.");
|
||||||
@@ -52,16 +53,17 @@ pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>
|
|||||||
.output();
|
.output();
|
||||||
if output_res.is_err(){
|
if output_res.is_err(){
|
||||||
let error = output_res.err().unwrap();
|
let error = output_res.err().unwrap();
|
||||||
println!("From DNS Enumeration Thread: error running dnsrecon in the project's distrobox!");
|
println!("{}", "From DNS Enumeration Thread: error running dnsrecon in the project's distrobox!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
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");
|
let output_string_res = read_to_string("dns_temp.csv");
|
||||||
if output_string_res.is_err(){
|
if output_string_res.is_err(){
|
||||||
let error = output_string_res.err().unwrap();
|
let error = output_string_res.err().unwrap();
|
||||||
println!("From DNS Enumeration Thread: error reading output data!");
|
println!("From DNS Enumeration Thread: error reading output data!");
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let output_string = output_string_res.unwrap();
|
let output_string = output_string_res.unwrap();
|
||||||
@@ -120,14 +122,15 @@ pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>
|
|||||||
return Some(dns_handle);
|
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<()>>{
|
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();
|
let mut enumeration_path = project.notes_folder.clone();
|
||||||
enumeration_path.push("enumeration.md");
|
enumeration_path.push("enumeration.md");
|
||||||
let enumeration_file_res = OpenOptions::new().append(true).create(true).open(enumeration_path);
|
let enumeration_file_res = OpenOptions::new().append(true).create(true).open(enumeration_path);
|
||||||
if enumeration_file_res.is_err(){
|
if enumeration_file_res.is_err(){
|
||||||
let error = enumeration_file_res.err().unwrap();
|
let error = enumeration_file_res.err().unwrap();
|
||||||
println!("error opening enumeration notes file!");
|
println!("{}","error opening enumeration notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut enumeration_file = enumeration_file_res.unwrap();
|
let mut enumeration_file = enumeration_file_res.unwrap();
|
||||||
@@ -180,10 +183,12 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
|
|||||||
.output();
|
.output();
|
||||||
if gobuster_cmd_res.is_err(){
|
if gobuster_cmd_res.is_err(){
|
||||||
let error = gobuster_cmd_res.err().unwrap();
|
let error = gobuster_cmd_res.err().unwrap();
|
||||||
println!("From gobuster thread: Error running gobuster command!");
|
println!("{}","From gobuster thread: Error running gobuster command!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
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;
|
let gobuser_output = gobuster_cmd_res.unwrap().stdout;
|
||||||
println!("From Gobuster Thread: Sudomain enumeration Done!");
|
println!("From Gobuster Thread: Sudomain enumeration Done!");
|
||||||
let gobuster_string = String::from_utf8_lossy(&gobuser_output);
|
let gobuster_string = String::from_utf8_lossy(&gobuser_output);
|
||||||
@@ -214,8 +219,8 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
|
|||||||
let write_res = write!(enumeration_file, "{}", out_data);
|
let write_res = write!(enumeration_file, "{}", out_data);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("FROM Gobuster Thread: error writing notes!");
|
println!("{}","FROM Gobuster Thread: error writing notes!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -229,8 +234,8 @@ pub fn dns_squatting(project: &Project, given_domains: Option<&Vec<String>>, sta
|
|||||||
let open_enumeration_notes_res = OpenOptions::new().append(true).create(true).open(enumeration_notes);
|
let open_enumeration_notes_res = OpenOptions::new().append(true).create(true).open(enumeration_notes);
|
||||||
if open_enumeration_notes_res.is_err(){
|
if open_enumeration_notes_res.is_err(){
|
||||||
let error = open_enumeration_notes_res.err().unwrap();
|
let error = open_enumeration_notes_res.err().unwrap();
|
||||||
println!("Error opening enumeration notes");
|
println!("{}","Error opening enumeration notes".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut enumeration_file = open_enumeration_notes_res.unwrap();
|
let mut enumeration_file = open_enumeration_notes_res.unwrap();
|
||||||
@@ -254,8 +259,8 @@ pub fn dns_squatting(project: &Project, given_domains: Option<&Vec<String>>, sta
|
|||||||
let write_res = write!(enumeration_file, "### Domain Squatting\n");
|
let write_res = write!(enumeration_file, "### Domain Squatting\n");
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("error writing to enumeration notes file!");
|
println!("{}","error writing to enumeration notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -276,10 +281,12 @@ pub fn dns_squatting(project: &Project, given_domains: Option<&Vec<String>>, sta
|
|||||||
.output();
|
.output();
|
||||||
if twist_output.is_err(){
|
if twist_output.is_err(){
|
||||||
let error = twist_output.err().unwrap();
|
let error = twist_output.err().unwrap();
|
||||||
println!("From DNSTwist thread: Error running dnstwist command!");
|
println!("{}","From DNSTwist thread: Error running dnstwist command!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
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 twist_output_vec = twist_output.unwrap().stdout;
|
||||||
let output_string = String::from_utf8_lossy(&twist_output_vec);
|
let output_string = String::from_utf8_lossy(&twist_output_vec);
|
||||||
let output_lines = output_string.split("\n");
|
let output_lines = output_string.split("\n");
|
||||||
@@ -303,8 +310,8 @@ pub fn do_all_dns_enumeration(project: &Project) -> Option<JoinHandle<()>>{
|
|||||||
let enumeration_file_res = OpenOptions::new().append(true).create(true).open(enumeration_path);
|
let enumeration_file_res = OpenOptions::new().append(true).create(true).open(enumeration_path);
|
||||||
if enumeration_file_res.is_err(){
|
if enumeration_file_res.is_err(){
|
||||||
let error = enumeration_file_res.err().unwrap();
|
let error = enumeration_file_res.err().unwrap();
|
||||||
println!("error opening enumeration notes file!");
|
println!("{}","error opening enumeration notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut enumeration_file = enumeration_file_res.unwrap();
|
let mut enumeration_file = enumeration_file_res.unwrap();
|
||||||
@@ -325,8 +332,8 @@ pub fn do_all_dns_enumeration(project: &Project) -> Option<JoinHandle<()>>{
|
|||||||
let write_res = write!(enumeration_file, "# DNS Enumeration\n");
|
let write_res = write!(enumeration_file, "# DNS Enumeration\n");
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("From All DNS thread: Error writing notes file!");
|
println!("{}","From All DNS thread: Error writing notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
write_success = false;
|
write_success = false;
|
||||||
}
|
}
|
||||||
if write_success{
|
if write_success{
|
||||||
|
|||||||
@@ -1,28 +1,22 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::fs::create_dir_all;
|
|
||||||
use std::fs::read_to_string;
|
use std::fs::read_to_string;
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::hash::Hash;
|
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process;
|
|
||||||
use std::process::Command;
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::io::stdin;
|
use std::io::stdin;
|
||||||
use std::thread::JoinHandle;
|
use colored::Colorize;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
use clearscreen::clear;
|
use clearscreen::clear;
|
||||||
use clearscreen;
|
use clearscreen;
|
||||||
use rodio::{Decoder, OutputStream, Sink};
|
use rodio::{Decoder, OutputStream, Sink};
|
||||||
use crate::get_user_input;
|
use crate::get_user_input;
|
||||||
use crate::open_overwrite;
|
|
||||||
use crate::open_append;
|
|
||||||
use crate::project_controls::get_projects;
|
|
||||||
use crate::Project;
|
use crate::Project;
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub fn run_initial_enum(project: &Project){
|
pub fn run_initial_enum(project: &Project){
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Target {
|
struct Target {
|
||||||
@@ -40,8 +34,8 @@ pub fn run_initial_enum(project: &Project){
|
|||||||
let csv_read_res = fs::read_to_string(&csv_path);
|
let csv_read_res = fs::read_to_string(&csv_path);
|
||||||
if csv_read_res.is_err(){
|
if csv_read_res.is_err(){
|
||||||
let error = csv_read_res.err().unwrap();
|
let error = csv_read_res.err().unwrap();
|
||||||
println!("error reading csv!");
|
println!("{}","error reading csv!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let csv_data = csv_read_res.unwrap();
|
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);
|
let host_notes_open_res = fs::OpenOptions::new().append(true).create(true).open(&host_notes_path);
|
||||||
if host_notes_open_res.is_err(){
|
if host_notes_open_res.is_err(){
|
||||||
let error = host_notes_open_res.err().unwrap();
|
let error = host_notes_open_res.err().unwrap();
|
||||||
println!("error opening host notes file!");
|
println!("{}","error opening host notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let host_notes = host_notes_open_res.unwrap();
|
let host_notes = host_notes_open_res.unwrap();
|
||||||
let attack_notes_open_res = fs::OpenOptions::new().append(true).create(true).open(&attack_notes_path);
|
let attack_notes_open_res = fs::OpenOptions::new().append(true).create(true).open(&attack_notes_path);
|
||||||
if attack_notes_open_res.is_err(){
|
if attack_notes_open_res.is_err(){
|
||||||
let error = attack_notes_open_res.err().unwrap();
|
let error = attack_notes_open_res.err().unwrap();
|
||||||
println!("error opening attack notes!");
|
println!("{}","error opening attack notes!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for target in targets.clone(){
|
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)]
|
#[derive(Clone)]
|
||||||
struct Port{
|
struct Port{
|
||||||
service: String,
|
service: String,
|
||||||
@@ -117,7 +111,7 @@ pub fn build_external_attack_notes(project: &Project){
|
|||||||
if host_notes_read_res.is_err(){
|
if host_notes_read_res.is_err(){
|
||||||
let error = host_notes_read_res.err().unwrap();
|
let error = host_notes_read_res.err().unwrap();
|
||||||
println!("error reading host notes");
|
println!("error reading host notes");
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let host_notes_string = host_notes_read_res.unwrap();
|
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.");
|
write!(attack_file, "\n---\n").expect("since we used the open options already this should never fail.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
pub fn generate_userpass(project: &Project){
|
pub fn generate_userpass(project: &Project){
|
||||||
let mut outlines = Vec::new();
|
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();
|
let mut to_open = PathBuf::new();
|
||||||
match folder{
|
match folder{
|
||||||
"notes" => to_open.push(project.notes_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")
|
process::Command::new("dolphin")
|
||||||
.arg(to_open)
|
.arg(to_open)
|
||||||
.spawn().expect("error opening dolphin");
|
.spawn().expect("error opening dolphin");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
pub fn print_report_information(project: &Project){
|
pub fn print_report_information(project: &Project){
|
||||||
let scope = get_scope_entries(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);
|
let enumeration_read_res = fs::read_to_string(notes_path);
|
||||||
if enumeration_read_res.is_err(){
|
if enumeration_read_res.is_err(){
|
||||||
let error = enumeration_read_res.err().unwrap();
|
let error = enumeration_read_res.err().unwrap();
|
||||||
println!("error reading enumeration notes!");
|
println!("{}","error reading enumeration notes!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
let enumeration_text = enumeration_read_res.unwrap();
|
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{
|
fn msolspray_config(tools_dir: &PathBuf) -> String{
|
||||||
let mut msolspray_path = String::new();
|
let mut msolspray_path = String::new();
|
||||||
let mut outline = String::new();
|
let mut outline = String::new();
|
||||||
@@ -451,6 +446,7 @@ fn msolspray_config(tools_dir: &PathBuf) -> String{
|
|||||||
return outline;
|
return outline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub fn password_spray_help(project: &Project, season: String, lseason: String, year: i32, tools_dir: &PathBuf, config_path: &PathBuf){
|
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:u64 = 0;
|
||||||
let mut wait_time_response = String::new();
|
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();
|
let mut hash_file = String::new();
|
||||||
println!("trying to automatically find hashes.txt file...");
|
println!("trying to automatically find hashes.txt file...");
|
||||||
let find_result = find_file(&project.files_folder, "hashes.txt");
|
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(){
|
if netexec_cmd_res.is_err(){
|
||||||
let error = netexec_cmd_res.err().unwrap();
|
let error = netexec_cmd_res.err().unwrap();
|
||||||
println!("error running netexec command!");
|
println!("error running netexec command!");
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
let output_string = String::from_utf8(netexec_cmd_res.unwrap().stdout).unwrap();
|
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);
|
return Some(db_handle);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
pub fn partse_gathercontacts(project: &Project){
|
pub fn partse_gathercontacts(project: &Project){
|
||||||
fn format_names(names: Vec<&str>) -> HashMap<&str, Vec<String>>{
|
fn format_names(names: Vec<&str>) -> HashMap<&str, Vec<String>>{
|
||||||
@@ -832,8 +828,8 @@ last
|
|||||||
let gather_source = fs::read_to_string(gather_file);
|
let gather_source = fs::read_to_string(gather_file);
|
||||||
if gather_source.is_err(){
|
if gather_source.is_err(){
|
||||||
let error = gather_source.err().unwrap();
|
let error = gather_source.err().unwrap();
|
||||||
println!("error reading gather contacts output!");
|
println!("{}","error reading gather contacts output!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let gather_source_string = gather_source.unwrap();
|
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);
|
let email_text_res = OpenOptions::new().append(true).create(true).open(email_text_path);
|
||||||
if email_text_res.is_err(){
|
if email_text_res.is_err(){
|
||||||
let error = email_text_res.err().unwrap();
|
let error = email_text_res.err().unwrap();
|
||||||
println!("error opening email text file!");
|
println!("{}","error opening email text file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let email_notes_res = OpenOptions::new().append(true).create(true).open(email_note_path);
|
let email_notes_res = OpenOptions::new().append(true).create(true).open(email_note_path);
|
||||||
if email_notes_res.is_err(){
|
if email_notes_res.is_err(){
|
||||||
let error = email_notes_res.err().unwrap();
|
let error = email_notes_res.err().unwrap();
|
||||||
println!("error opeing email notes file!");
|
println!("{}","error opeing email notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let mut email_text_file = email_text_res.unwrap();
|
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");
|
let note_wriet_res = write!(email_note_file, "# Email Enumeration\n");
|
||||||
if note_wriet_res.is_err(){
|
if note_wriet_res.is_err(){
|
||||||
let error = note_wriet_res.err().unwrap();
|
let error = note_wriet_res.err().unwrap();
|
||||||
println!("error writing to email notes file!");
|
println!("{}","error writing to email notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
write_success = false;
|
write_success = false;
|
||||||
}
|
}
|
||||||
if write_success{
|
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");
|
println!("to do");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
pub fn get_scope_entries(project: &Project) -> Option<Vec<String>>{
|
pub fn get_scope_entries(project: &Project) -> Option<Vec<String>>{
|
||||||
let mut general_path = project.notes_folder.clone();
|
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);
|
let genera_read_res = read_to_string(general_path);
|
||||||
if genera_read_res.is_err(){
|
if genera_read_res.is_err(){
|
||||||
let error = genera_read_res.err().unwrap();
|
let error = genera_read_res.err().unwrap();
|
||||||
println!("ooof error reading your general notes file!");
|
println!("{}","ooof error reading your general notes file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let general_string = genera_read_res.unwrap();
|
let general_string = genera_read_res.unwrap();
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs::{File, create_dir_all, remove_dir_all};
|
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::Write;
|
||||||
use std::io::stdin;
|
|
||||||
use std::io::copy;
|
use std::io::copy;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use reqwest::blocking::get;
|
use reqwest::blocking::get;
|
||||||
use std::{path::Path, path::PathBuf};
|
use std::{path::Path, path::PathBuf};
|
||||||
use std::{process, thread};
|
use std::thread;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use directories::UserDirs;
|
use colored::Colorize;
|
||||||
|
|
||||||
use crate::get_user_input;
|
use crate::get_user_input;
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub fn install(config_path: &PathBuf){
|
pub fn install(config_path: &PathBuf){
|
||||||
let mut _terminal_commands = HashMap::from([
|
let mut _terminal_commands = HashMap::from([
|
||||||
("kde", "konsole -e !!!"),
|
("kde", "konsole -e !!!"),
|
||||||
@@ -53,8 +52,8 @@ pub fn install(config_path: &PathBuf){
|
|||||||
let create_res = create_dir_all(folder);
|
let create_res = create_dir_all(folder);
|
||||||
if create_res.is_err(){
|
if create_res.is_err(){
|
||||||
let error = create_res.err().unwrap();
|
let error = create_res.err().unwrap();
|
||||||
println!("error creating folder {}", folder.display());
|
println!("{}{}","error creating folder ".red(), folder.display().to_string().red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
println!("you'll need to create this manually after the install is done!");
|
println!("you'll need to create this manually after the install is done!");
|
||||||
folder_creation = false;
|
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();
|
let distrobox_run_res = Command::new("distrobox").arg("list").arg("--root").output();
|
||||||
if distrobox_run_res.is_err(){
|
if distrobox_run_res.is_err(){
|
||||||
let error = distrobox_run_res.err().unwrap();
|
let error = distrobox_run_res.err().unwrap();
|
||||||
println!("Distrobox file was not found!");
|
println!("{}","Distrobox file was not found!".red());
|
||||||
println!("This usually means that distrobox is not installed.");
|
println!("{}","This usually means that distrobox is not installed.".red());
|
||||||
println!("please install distrobox, if you're on kali run `sudo apt install distrobox`");
|
println!("{}","please install distrobox, if you're on kali run `sudo apt install distrobox`".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
println!("this project heavily relies on distrobox, as its primarily a distrobox mangement tool.");
|
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.");
|
println!("{}","cleaning up up configuration folders, please install distrobox and re-run this program.".red());
|
||||||
let cleanup = remove_dir_all(&del_on_fail);
|
let cleanup = remove_dir_all(&del_on_fail);
|
||||||
if cleanup.is_err(){
|
if cleanup.is_err(){
|
||||||
println!("error cleaning up configuration folder!");
|
println!("error cleaning up configuration folder!");
|
||||||
@@ -120,9 +119,9 @@ pub fn install(config_path: &PathBuf){
|
|||||||
.status();
|
.status();
|
||||||
if template_box_create_res.is_err(){
|
if template_box_create_res.is_err(){
|
||||||
let error = template_box_create_res.err().unwrap();
|
let error = template_box_create_res.err().unwrap();
|
||||||
println!("error creating template box!");
|
println!("{}","error creating template box!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
println!("\n\n\nplese create it yourself with the following command.");
|
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);
|
println!("\n\ndistrobox create --root --image {}, --name {}, --init --volume {}", &box_image, &template_box_name, &tool_volume);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -214,8 +213,8 @@ vault_name:{}"
|
|||||||
let project_conf_res = File::create_new(&projects_conf_path);
|
let project_conf_res = File::create_new(&projects_conf_path);
|
||||||
if project_conf_res.is_err(){
|
if project_conf_res.is_err(){
|
||||||
let error = project_conf_res.err().unwrap();
|
let error = project_conf_res.err().unwrap();
|
||||||
println!("ooof error creating the projects configuration file.");
|
println!("{}","ooof error creating the projects configuration file.".red());
|
||||||
println!("try creating it manually!");
|
println!("{}","try creating it manually!".red());
|
||||||
println!("copy the following configuration and save it to {}", &projects_conf_path.display());
|
println!("copy the following configuration and save it to {}", &projects_conf_path.display());
|
||||||
println!("customer:name:notes:files:active:time:box_name:stage");
|
println!("customer:name:notes:files:active:time:box_name:stage");
|
||||||
println!("default:default:{}:{}:yes:{}:current", ¤t_notes.display(), ¤t_projects.display(), &template_box_name);
|
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 std::{io::stdin, path::PathBuf, process::Command};
|
||||||
use directories::UserDirs;
|
use directories::UserDirs;
|
||||||
use reqwest::Response;
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
|
use colored::Colorize;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Project{
|
pub struct Project{
|
||||||
@@ -33,8 +33,8 @@ pub fn open_overwrite(path: &PathBuf) -> Option<File>{
|
|||||||
let file_create_res = fs::OpenOptions::new().create(true).write(true).open(path);
|
let file_create_res = fs::OpenOptions::new().create(true).write(true).open(path);
|
||||||
if file_create_res.is_err(){
|
if file_create_res.is_err(){
|
||||||
let error = file_create_res.err().unwrap();
|
let error = file_create_res.err().unwrap();
|
||||||
println!("error opening {} file!", path.display());
|
println!("{} {} {}","error opening".red(), path.display().to_string().red(), " file".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -47,8 +47,8 @@ pub fn open_append(path: &PathBuf) -> Option<File>{
|
|||||||
let file_create_res = fs::OpenOptions::new().create(true).append(true).open(path);
|
let file_create_res = fs::OpenOptions::new().create(true).append(true).open(path);
|
||||||
if file_create_res.is_err(){
|
if file_create_res.is_err(){
|
||||||
let error = file_create_res.err().unwrap();
|
let error = file_create_res.err().unwrap();
|
||||||
println!("error opening {} file!", path.display());
|
println!("{} {} {}","error opening".red(), path.display().to_string().red(), " file".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -75,7 +75,7 @@ pub fn get_user_input(prompt: &str) -> String{
|
|||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
print!("
|
print!("{}","
|
||||||
⠀⠀⠀⣠⠶⠚⠛⠛⠛⠲⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
⠀⠀⠀⣠⠶⠚⠛⠛⠛⠲⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
⠀⠀⠀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
⠀⠀⠀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠻⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
⠀⣠⣾⣷⣄⠀⠀⠀⢀⣠⣤⣤⡀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
⠀⣠⣾⣷⣄⠀⠀⠀⢀⣠⣤⣤⡀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
@@ -94,7 +94,7 @@ fn main() {
|
|||||||
⠀⠀⠀⠀⣀⡀⠀⣰⠇⣾⠀⠀⠈⣩⣥⣄⣿⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
⠀⠀⠀⠀⣀⡀⠀⣰⠇⣾⠀⠀⠈⣩⣥⣄⣿⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
⠀⠀⠀⠀⢿⡉⠳⡟⣸⠃⠀⠀⠀⠘⢷⣌⠉⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
⠀⠀⠀⠀⢿⡉⠳⡟⣸⠃⠀⠀⠀⠘⢷⣌⠉⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
⠀⠀⠀⠀⠀⠙⢦⣴⠏⠀⠀⠀⠀⠀⠀⠉⠳⠶⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
⠀⠀⠀⠀⠀⠙⢦⣴⠏⠀⠀⠀⠀⠀⠀⠉⠳⠶⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||||
");
|
".red());
|
||||||
let mut config_path = PathBuf::new();
|
let mut config_path = PathBuf::new();
|
||||||
let user_dirs_res = UserDirs::new();
|
let user_dirs_res = UserDirs::new();
|
||||||
if user_dirs_res.is_none(){
|
if user_dirs_res.is_none(){
|
||||||
@@ -162,9 +162,15 @@ fn main() {
|
|||||||
cracking_rig: {}\n
|
cracking_rig: {}\n
|
||||||
upcoming project folders: {}
|
upcoming project folders: {}
|
||||||
upcoming project notes: {}
|
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());
|
", &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...");
|
println!("{}","loading project configs...".green());
|
||||||
let projects = project_controls::get_projects(&config_path, true);
|
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.");
|
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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::fs::{read_to_string, create_dir_all};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use chrono::format::format;
|
use std::thread::{sleep, spawn, JoinHandle};
|
||||||
use reqwest::blocking::get;
|
use std::time::Duration;
|
||||||
|
use colored::Colorize;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
use crate::get_user_input;
|
use crate::get_user_input;
|
||||||
use crate::Project;
|
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);
|
let file_read_res = fs::read_to_string(file_to_parse);
|
||||||
if file_read_res.is_err(){
|
if file_read_res.is_err(){
|
||||||
let error = file_read_res.err().unwrap();
|
let error = file_read_res.err().unwrap();
|
||||||
println!("ooof error reading the file!");
|
println!("{}","ooof error reading the file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let nmap_string = file_read_res.unwrap();
|
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);
|
let save_open_res = fs::OpenOptions::new().create(true).append(true).open(&save_path);
|
||||||
if save_open_res.is_err(){
|
if save_open_res.is_err(){
|
||||||
let error = save_open_res.err().unwrap();
|
let error = save_open_res.err().unwrap();
|
||||||
println!("oof error opening the save file!");
|
println!("{}","oof error opening the save file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
if get_user_input("do you want to print the results to the console instead?").to_lowercase().contains("y"){
|
if get_user_input("do you want to print the results to the console instead?").to_lowercase().contains("y"){
|
||||||
for host in &host_ports{
|
for host in &host_ports{
|
||||||
println!("{}", host);
|
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);
|
let tsv_open_res = fs::OpenOptions::new().create(true).append(true).open(save_path);
|
||||||
if tsv_open_res.is_err(){
|
if tsv_open_res.is_err(){
|
||||||
let error = tsv_open_res.err().unwrap();
|
let error = tsv_open_res.err().unwrap();
|
||||||
println!("error opening tsv file!");
|
println!("{}","error opening tsv file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
if get_user_input("do you want to print the results to the console instead?").to_lowercase().contains("y"){
|
if get_user_input("do you want to print the results to the console instead?").to_lowercase().contains("y"){
|
||||||
for host in &host_ports{
|
for host in &host_ports{
|
||||||
println!("{}", host);
|
println!("{}", host);
|
||||||
@@ -259,8 +261,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let tsv_read_res = read_to_string(tsv_path);
|
let tsv_read_res = read_to_string(tsv_path);
|
||||||
if tsv_read_res.is_err(){
|
if tsv_read_res.is_err(){
|
||||||
let error = tsv_read_res.err().unwrap();
|
let error = tsv_read_res.err().unwrap();
|
||||||
println!("ooof error reading tsv file!");
|
println!("{}","ooof error reading tsv file!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
println!("tsv read, parsing lines...");
|
println!("tsv read, parsing lines...");
|
||||||
@@ -335,8 +337,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(windows_file, "{}\n", host);
|
let write_res = write!(windows_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing windows_hosts.txt!!");
|
println!("{}","oooof error writing windows_hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -352,8 +354,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(ssh_file, "{}\n", host);
|
let write_res = write!(ssh_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing ssh_hosts.txt!!");
|
println!("{}","oooof error writing ssh_hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -369,8 +371,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(telnet_file, "{}\n", host);
|
let write_res = write!(telnet_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing _hosts.txt!!");
|
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -386,8 +388,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(ftp_file, "{}\n", host);
|
let write_res = write!(ftp_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing _hosts.txt!!");
|
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -403,8 +405,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(snmp_file, "{}\n", host);
|
let write_res = write!(snmp_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing _hosts.txt!!");
|
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -420,8 +422,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(dns_file, "{}\n", host);
|
let write_res = write!(dns_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing _hosts.txt!!");
|
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -437,8 +439,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(rdp_file, "{}\n", host);
|
let write_res = write!(rdp_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing _hosts.txt!!");
|
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -454,8 +456,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(web_file, "{}\n", host);
|
let write_res = write!(web_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("oooof error writing _hosts.txt!!");
|
println!("{}","oooof error writing _hosts.txt!!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write_res.unwrap();
|
write_res.unwrap();
|
||||||
@@ -469,8 +471,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let untagged_res = create_dir_all(&outfile);
|
let untagged_res = create_dir_all(&outfile);
|
||||||
if untagged_res.is_err(){
|
if untagged_res.is_err(){
|
||||||
let error = untagged_res.err().unwrap();
|
let error = untagged_res.err().unwrap();
|
||||||
println!("ooof error creating untagged folder!");
|
println!("{}","ooof error creating untagged folder!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
untagged_res.unwrap();
|
untagged_res.unwrap();
|
||||||
@@ -488,8 +490,8 @@ pub fn parse_csportscan(project: &Project){
|
|||||||
let write_res = write!(write_file, "{}\n", host);
|
let write_res = write!(write_file, "{}\n", host);
|
||||||
if write_res.is_err(){
|
if write_res.is_err(){
|
||||||
let error = write_res.err().unwrap();
|
let error = write_res.err().unwrap();
|
||||||
println!("ooof error writing to file...");
|
println!("{}","ooof error writing to file...".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outfile.pop();
|
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.");
|
println!("note if no hosts were found for a protocol their files will be empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_nmap_portscan(project: &Project){
|
#[allow(unused)]
|
||||||
let files_folder = project.files_folder.clone();
|
pub fn run_nmap_portscan(project: &Project) -> Option<JoinHandle<()>>{
|
||||||
let notes_folder = project.notes_folder.clone();
|
let notes_folder = project.notes_folder.clone();
|
||||||
let mut ports_to_scan = vec![String::from("80"), String::from("443"),
|
let mut ports_to_scan = vec![String::from("80"), String::from("443"),
|
||||||
String::from("161"),
|
String::from("161"),
|
||||||
@@ -516,13 +518,12 @@ pub fn run_nmap_portscan(project: &Project){
|
|||||||
String::from("1433"),
|
String::from("1433"),
|
||||||
String::from("3306"),
|
String::from("3306"),
|
||||||
String::from("2222"),];
|
String::from("2222"),];
|
||||||
let mut save_path = files_folder.clone();
|
|
||||||
let mut general_notes = notes_folder.clone();
|
let mut general_notes = notes_folder.clone();
|
||||||
general_notes.push("general.md");
|
general_notes.push("general.md");
|
||||||
println!("building targets from scope in general notes...");
|
println!("building targets from scope in general notes...");
|
||||||
let targets_res = info_controls::get_scope_entries(project);
|
let targets_res = info_controls::get_scope_entries(project);
|
||||||
if targets_res.is_none(){
|
if targets_res.is_none(){
|
||||||
return;
|
return None;
|
||||||
}
|
}
|
||||||
let mut targets = targets_res.unwrap();
|
let mut targets = targets_res.unwrap();
|
||||||
println!("Got targets from scope!");
|
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"){
|
if get_user_input("continue?").to_lowercase().contains("n"){
|
||||||
println!("ok exiting this function, feel free to try again...");
|
println!("ok exiting this function, feel free to try again...");
|
||||||
return;
|
return None;
|
||||||
}
|
}
|
||||||
targets = modified_targets;
|
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!("sweet we have what we need!");
|
||||||
println!("building portscan command...");
|
println!("building portscan command...");
|
||||||
let port_string = ports_to_scan.join(",");
|
let working_project = project.clone();
|
||||||
let hosts_string = targets.join(" ");
|
let mut save_path = project.files_folder.clone();
|
||||||
let mut scan_results = String::new();
|
save_path.push("working");
|
||||||
if proxy.contains("y"){
|
if !save_path.exists(){
|
||||||
println!("running command, this may take a bit of time...");
|
save_path.clear();
|
||||||
let command_res = Command::new("distrobox")
|
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("enter")
|
||||||
.arg("--root")
|
.arg("--root")
|
||||||
.arg(project.boxname.to_owned())
|
.arg(working_project.boxname)
|
||||||
.arg("--")
|
.arg("--")
|
||||||
.arg("proxychains")
|
.arg("proxychains")
|
||||||
.arg("namp")
|
.arg("nmap")
|
||||||
.arg("-sT")
|
.arg("-sT")
|
||||||
.arg("-p")
|
.arg("-p")
|
||||||
.arg(port_string)
|
.arg(ports_to_scan.join(","))
|
||||||
.arg(hosts_string)
|
.arg(targets.join(" "))
|
||||||
.output();
|
.output();
|
||||||
if command_res.is_err(){
|
if port_scancmd_res.is_err(){
|
||||||
let error = command_res.err().unwrap();
|
let error = port_scancmd_res.err().unwrap();
|
||||||
println!("error running portscan command!");
|
println!("{}","FROM NMAP THREAD: error running portscan!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let output = command_res.unwrap().stdout;
|
nmap_output = port_scancmd_res.unwrap().stdout;
|
||||||
scan_results = String::from_utf8_lossy(&output).into_owned();
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
let command_res = Command::new("distrobox")
|
let port_scancmd_res = Command::new("distrobox")
|
||||||
.arg("enter")
|
.arg("enter")
|
||||||
.arg("--root")
|
.arg("--root")
|
||||||
.arg(project.boxname.to_owned())
|
.arg(working_project.boxname)
|
||||||
.arg("--")
|
.arg("--")
|
||||||
.arg("proxychains")
|
.arg("nmap")
|
||||||
.arg("namp")
|
|
||||||
.arg("-sT")
|
.arg("-sT")
|
||||||
.arg("-p")
|
.arg("-p")
|
||||||
.arg(port_string)
|
.arg(ports_to_scan.join(","))
|
||||||
.arg(hosts_string)
|
.arg(targets.join(" "))
|
||||||
.output();
|
.output();
|
||||||
if command_res.is_err(){
|
if port_scancmd_res.is_err(){
|
||||||
let error = command_res.err().unwrap();
|
let error = port_scancmd_res.err().unwrap();
|
||||||
println!("error running portscan command!");
|
println!("{}","FROM NMAP THREAD: error running portscan!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let output = command_res.unwrap().stdout;
|
nmap_output = port_scancmd_res.unwrap().stdout;
|
||||||
scan_results = String::from_utf8_lossy(&output).into_owned();
|
|
||||||
}
|
}
|
||||||
save_path.push("working/nmap_output.txt");
|
println!("FROM NMAP THREAD: nmap scan finished, parsing the results...");
|
||||||
println!("going to save to {}", save_path.display());
|
let nmap_output_string = String::from_utf8_lossy(&nmap_output);
|
||||||
if get_user_input("is that ok?").to_lowercase().contains("n"){
|
let mut nmap_log_path = save_path.clone();
|
||||||
save_path.clear();
|
nmap_log_path.pop();
|
||||||
save_path.push(get_user_input("where do you want to save it then? (full path)"));
|
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);
|
let mut host_ports = Vec::new();
|
||||||
if save_file_res.is_err(){
|
let host_sections: Vec<&str> = nmap_output_string.split("Nmap scan report ").collect();
|
||||||
let error = save_file_res.err().unwrap();
|
for section in host_sections{
|
||||||
println!("error opening save file!");
|
let mut host = String::new();
|
||||||
println!("{}", error);
|
let mut ports = Vec::new();
|
||||||
if get_user_input("output results to console?").to_lowercase().contains("y"){
|
let lines: Vec<&str> = section.split("\n").collect();
|
||||||
println!("{}", &scan_results);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
let mut save_file = save_file_res.unwrap();
|
let mut services_file = services_file_open_res.unwrap();
|
||||||
let write_res = write!(save_file, "{}", scan_results);
|
let enumeration_open_res = open_append(&enumeration_notes_path);
|
||||||
if write_res.is_err(){
|
if enumeration_open_res.is_none(){
|
||||||
let error = write_res.err().unwrap();
|
println!("error opening enumeration notes file!");
|
||||||
println!("error writing results to file!");
|
println!("scan data will not be saved to enumeration notes!");
|
||||||
println!("{}", error);
|
}
|
||||||
if get_user_input("print results to console instead?").to_lowercase().contains("y"){
|
let services_write_res = write!(services_file, "host\tport\tbanner\tnotes\n");
|
||||||
println!("{}", scan_results);
|
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){
|
pub fn build_nmap_command(project: &Project){
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use std::process::Command;
|
|||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
use colored::Colorize;
|
||||||
|
|
||||||
use crate::get_user_input;
|
use crate::get_user_input;
|
||||||
use crate::Project;
|
use crate::Project;
|
||||||
use crate::box_controls::make_box;
|
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){
|
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_project_dir = PathBuf::new();
|
||||||
let mut new_note_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();
|
let mut mut_config_path = config_path.clone();
|
||||||
mut_config_path.pop();
|
mut_config_path.pop();
|
||||||
mut_config_path.push("projects.conf");
|
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);
|
let bkup_result = fs::copy(&mut_config_path, &bkup_config_path);
|
||||||
if bkup_result.is_err(){
|
if bkup_result.is_err(){
|
||||||
let error = bkup_result.err().unwrap();
|
let error = bkup_result.err().unwrap();
|
||||||
println!("error backing up the projects.conf file!");
|
println!("{}","error backing up the projects.conf file!".red());
|
||||||
println!("error: {}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
let mut projects = Vec::new();
|
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 project_lines:Vec<&str> = projects_string.split("\n").collect();
|
||||||
let mut first = 0;
|
let mut first = 0;
|
||||||
let mut already_active = false;
|
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 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};
|
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{
|
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);
|
projects.push(new_project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return projects
|
return Some(projects)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_upcoming_projects(projects: &Vec<Project>){
|
pub fn print_upcoming_projects(projects: &Vec<Project>){
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ use std::fs;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use colored::Colorize;
|
||||||
|
|
||||||
use crate::Project;
|
use crate::Project;
|
||||||
use crate::project_controls;
|
use crate::project_controls;
|
||||||
use crate::get_user_input;
|
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);
|
let file_creation_res = fs::create_dir_all(¬es_path);
|
||||||
if file_creation_res.is_err(){
|
if file_creation_res.is_err(){
|
||||||
let error = file_creation_res.err().unwrap();
|
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{
|
else{
|
||||||
file_creation_res.unwrap();
|
file_creation_res.unwrap();
|
||||||
@@ -75,18 +78,7 @@ Planning call notes:
|
|||||||
* password attacks
|
* password attacks
|
||||||
* password sprays 3-12 hours
|
* password sprays 3-12 hours
|
||||||
* lock out policy -
|
* lock out policy -
|
||||||
|
|\n").expect("faile to write pentest notes");
|
||||||
## Enumeration in progress
|
|
||||||
|
|
||||||
### DNS Bruteforcing
|
|
||||||
|
|
||||||
| domain name | IP | inscope? |
|
|
||||||
| ----------- | -- | -------- |
|
|
||||||
|
|
||||||
# Attack Surface Enumeration
|
|
||||||
|
|
||||||
| IP | host notes | needs? |
|
|
||||||
| -- | ---------- | ------ |\n").expect("faile to write pentest notes");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
notes_path.pop();
|
notes_path.pop();
|
||||||
@@ -146,7 +138,8 @@ fn internal(passtemp: &PathBuf, project: &Project){
|
|||||||
let file_creation_res = fs::create_dir_all(¬es_path);
|
let file_creation_res = fs::create_dir_all(¬es_path);
|
||||||
if file_creation_res.is_err(){
|
if file_creation_res.is_err(){
|
||||||
let error = file_creation_res.err().unwrap();
|
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{
|
else{
|
||||||
file_creation_res.unwrap();
|
file_creation_res.unwrap();
|
||||||
@@ -156,7 +149,8 @@ fn internal(passtemp: &PathBuf, project: &Project){
|
|||||||
let pass_result = fs::copy(&passtemp, ¬es_path);
|
let pass_result = fs::copy(&passtemp, ¬es_path);
|
||||||
if pass_result.is_err(){
|
if pass_result.is_err(){
|
||||||
let error = pass_result.err().unwrap();
|
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{
|
else{
|
||||||
pass_result.unwrap();
|
pass_result.unwrap();
|
||||||
@@ -327,8 +321,8 @@ fn vishing(project: &Project){
|
|||||||
let mknote_folder_res = fs::create_dir_all(¬es_path);
|
let mknote_folder_res = fs::create_dir_all(¬es_path);
|
||||||
if mknote_folder_res.is_err(){
|
if mknote_folder_res.is_err(){
|
||||||
let error = mknote_folder_res.err().unwrap();
|
let error = mknote_folder_res.err().unwrap();
|
||||||
println!("Error creating notes folder!");
|
println!("{}","Error creating notes folder!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
notes_path.push("general.md");
|
notes_path.push("general.md");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use std::{env::set_current_dir, path::PathBuf};
|
use std::{env::set_current_dir, path::PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use colored::Colorize;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
|
|
||||||
@@ -16,8 +17,8 @@ pub fn update_git_tools(tools_dir: &PathBuf){
|
|||||||
let cd_res = set_current_dir(&folder);
|
let cd_res = set_current_dir(&folder);
|
||||||
if cd_res.is_err(){
|
if cd_res.is_err(){
|
||||||
let error = cd_res.err().unwrap();
|
let error = cd_res.err().unwrap();
|
||||||
println!("error changing directory!");
|
println!("{}","error changing directory!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
let _cd = cd_res.unwrap();
|
let _cd = cd_res.unwrap();
|
||||||
@@ -27,8 +28,8 @@ pub fn update_git_tools(tools_dir: &PathBuf){
|
|||||||
.status();
|
.status();
|
||||||
if git_command_res.is_err(){
|
if git_command_res.is_err(){
|
||||||
let error = git_command_res.err().unwrap();
|
let error = git_command_res.err().unwrap();
|
||||||
println!("error running git pull command!");
|
println!("{}","error running git pull command!".red());
|
||||||
println!("{}", error);
|
println!("{}", error.to_string().red());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
let git_command = git_command_res.unwrap();
|
let git_command = git_command_res.unwrap();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
use crate::{get_user_input, Project};
|
use crate::get_user_input;
|
||||||
|
|
||||||
pub fn sharp_persist_command(tools_dir: &PathBuf){
|
pub fn sharp_persist_command(tools_dir: &PathBuf){
|
||||||
let filename = "SharPersist.exe";
|
let filename = "SharPersist.exe";
|
||||||
|
|||||||
Reference in New Issue
Block a user