added fun colors!

currently added some green for the initialization
and red for errors, output color will be added
soon!
This commit is contained in:
Pyro57000
2025-05-28 12:59:39 -05:00
parent 6959e77d57
commit 249ecc786d
13 changed files with 190 additions and 129 deletions

View File

@@ -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",

View File

@@ -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"

View File

@@ -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>){
@@ -222,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());
}
}
});
@@ -259,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;
@@ -280,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);

View File

@@ -5,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;
@@ -107,25 +108,30 @@ 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,
@@ -144,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;
@@ -226,7 +242,7 @@ pub fn run_command(cmd: String,
}
fn print_banner(banner: &str){
print!("{}", banner);
print!("{}", banner.custom_color((255,165,0)));
}
pub fn cli(interactive: bool,
@@ -299,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: {}
@@ -311,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,

View File

@@ -1,6 +1,7 @@
use std::path::PathBuf;
use std::fs::read_to_string;
use std::io::Write;
use colored::Colorize;
use crate::{get_user_input, open_overwrite};
@@ -138,8 +139,8 @@ vault_name:{}
let write_res= write!(config_file, "{}", new_config);
if write_res.is_err(){
let error = write_res.err().unwrap();
println!("error writing config file!");
println!("{}", error);
println!("{}","error writing config file!".red());
println!("{}", error.to_string().red());
println!("nothing was saved...");
return;
}

View File

@@ -4,6 +4,7 @@ use std::thread::JoinHandle;
use std::thread::{spawn, sleep};
use std::io::Write;
use std::time::Duration;
use colored::Colorize;
use dns_lookup::lookup_host;
use crate::get_user_input;
use crate::Project;
@@ -52,8 +53,8 @@ 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;
}
println!("sleping for 10 seconds to allow for sudo password input.");
@@ -62,7 +63,7 @@ pub fn run_dns_enumeration(project: &Project, given_domains: Option<&Vec<String>
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();
@@ -128,8 +129,8 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
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,8 +183,8 @@ 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.");
@@ -218,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();
@@ -233,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);
if open_enumeration_notes_res.is_err(){
let error = open_enumeration_notes_res.err().unwrap();
println!("Error opening enumeration notes");
println!("{}", error);
println!("{}","Error opening enumeration notes".red());
println!("{}", error.to_string().red());
return None;
}
let mut enumeration_file = open_enumeration_notes_res.unwrap();
@@ -258,8 +259,8 @@ pub fn dns_squatting(project: &Project, given_domains: Option<&Vec<String>>, sta
let write_res = write!(enumeration_file, "### Domain Squatting\n");
if write_res.is_err(){
let error = write_res.err().unwrap();
println!("error writing to enumeration notes file!");
println!("{}", error);
println!("{}","error writing to enumeration notes file!".red());
println!("{}", error.to_string().red());
return;
}
write_res.unwrap();
@@ -280,8 +281,8 @@ pub fn dns_squatting(project: &Project, given_domains: Option<&Vec<String>>, sta
.output();
if twist_output.is_err(){
let error = twist_output.err().unwrap();
println!("From DNSTwist thread: Error running dnstwist command!");
println!("{}", error);
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.");
@@ -309,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);
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();
@@ -331,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{

View File

@@ -8,6 +8,7 @@ use std::path::PathBuf;
use std::thread;
use std::time::Duration;
use std::io::stdin;
use colored::Colorize;
use walkdir::WalkDir;
use clearscreen::clear;
use clearscreen;
@@ -33,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();
@@ -70,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(){
@@ -110,7 +111,7 @@ pub fn run_initial_enum(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();
@@ -221,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();
@@ -752,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();
@@ -827,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();
@@ -854,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();
@@ -871,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{
@@ -901,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();

View File

@@ -9,6 +9,7 @@ use reqwest::blocking::get;
use std::{path::Path, path::PathBuf};
use std::thread;
use std::process::exit;
use colored::Colorize;
use crate::get_user_input;
@@ -51,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;
}
@@ -63,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!");
@@ -118,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{
@@ -212,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", &current_notes.display(), &current_projects.display(), &template_box_name);

View File

@@ -2,6 +2,7 @@ use std::{io::stdin, path::PathBuf, process::Command};
use directories::UserDirs;
use std::process::exit;
use std::fs::{self, File};
use colored::Colorize;
#[derive(Clone)]
pub struct Project{
@@ -32,8 +33,8 @@ 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);
}

View File

@@ -6,6 +6,7 @@ use std::path::PathBuf;
use std::process::Command;
use std::thread::{sleep, spawn, JoinHandle};
use std::time::Duration;
use colored::Colorize;
use walkdir::WalkDir;
use crate::get_user_input;
use crate::Project;
@@ -55,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();
@@ -97,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);
@@ -112,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);
@@ -260,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...");
@@ -336,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();
@@ -353,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();
@@ -370,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();
@@ -387,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();
@@ -404,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();
@@ -421,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();
@@ -438,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();
@@ -455,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();
@@ -470,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();
@@ -489,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();
@@ -608,8 +609,8 @@ pub fn run_nmap_portscan(project: &Project) -> Option<JoinHandle<()>>{
.output();
if port_scancmd_res.is_err(){
let error = port_scancmd_res.err().unwrap();
println!("FROM NMAP THREAD: error running portscan!");
println!("{}", error);
println!("{}","FROM NMAP THREAD: error running portscan!".red());
println!("{}", error.to_string().red());
return;
}
nmap_output = port_scancmd_res.unwrap().stdout;
@@ -628,8 +629,8 @@ pub fn run_nmap_portscan(project: &Project) -> Option<JoinHandle<()>>{
.output();
if port_scancmd_res.is_err(){
let error = port_scancmd_res.err().unwrap();
println!("FROM NMAP THREAD: error running portscan!");
println!("{}", error);
println!("{}","FROM NMAP THREAD: error running portscan!".red());
println!("{}", error.to_string().red());
return;
}
nmap_output = port_scancmd_res.unwrap().stdout;
@@ -695,8 +696,8 @@ pub fn run_nmap_portscan(project: &Project) -> Option<JoinHandle<()>>{
let services_write_res = write!(services_file, "host\tport\tbanner\tnotes\n");
if services_write_res.is_err(){
let error = services_write_res.err().unwrap();
println!("FROM NMAP THREAD: error writing to the services.tsv file!");
println!("{}", error);
println!("{}","FROM NMAP THREAD: error writing to the services.tsv file!".red());
println!("{}", error.to_string().red());
return;
}
let mut enumeration_write = false;

View File

@@ -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;
@@ -291,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");
@@ -301,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;
@@ -338,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>){

View File

@@ -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(&notes_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();
@@ -135,7 +138,8 @@ fn internal(passtemp: &PathBuf, project: &Project){
let file_creation_res = fs::create_dir_all(&notes_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();
@@ -145,7 +149,8 @@ fn internal(passtemp: &PathBuf, project: &Project){
let pass_result = fs::copy(&passtemp, &notes_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();
@@ -316,8 +321,8 @@ fn vishing(project: &Project){
let mknote_folder_res = fs::create_dir_all(&notes_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");

View File

@@ -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();