added logic to copy the cobaltstrike

folder into your project directory
and an option to launch that cobaltstrike
instance within the distrobox of your project
this should help keep cobalt strike data separate
also took a stab at cleaning up the left over
folders in the upcomming files and notes directories
the files folder cleans up now, but the notes folder
still needs work.
This commit is contained in:
pyro57000
2025-03-12 12:48:21 -05:00
parent 854feb2e2a
commit 8a1dca30e1
3 changed files with 95 additions and 30 deletions

View File

@@ -183,3 +183,27 @@ pub fn clean_unused_boxes(projects: &Vec<Project>, boxtemplate: &String) -> Opti
println!("this will take some time, but its running on a different thread so you can continue working!"); println!("this will take some time, but its running on a different thread so you can continue working!");
return Some(handle); return Some(handle);
} }
pub fn launch_cobalt_strike(project: Project) -> Option<JoinHandle<()>>{
let sh_cmd = format!("sh -c \"cd /pentest/cobaltstrike/client && ./cobaltstrike\"");
let handle = thread::spawn(move ||{
let mut cs_dir = PathBuf::new();
cs_dir.push(project.files_folder);
cs_dir.push("cobaltstrike/client");
let cd_res = env::set_current_dir(&cs_dir);
if cd_res.is_ok(){
let cobalt_strike_launch_result = Command::new("distrobox")
.arg("enter")
.arg("--root").arg(project.boxname)
.arg("--")
.arg("./cobaltstrike")
.status();
if cobalt_strike_launch_result.is_err(){
let error = cobalt_strike_launch_result.err().unwrap();
println!("error launching cobalt strike!");
println!("{}", error);
}
}
});
return Some(handle);
}

View File

@@ -125,19 +125,20 @@ Year: {}
9. ) promote project from upcoming to current 9. ) promote project from upcoming to current
10.) Open A New Terminal in Current Active Project 10.) Open A New Terminal in Current Active Project
11.) Open A Terminal In this windows for the current active project 11.) Open A Terminal In this windows for the current active project
12.) re-create the distrobox for the current active project 12.) open current project's cobalt strike
13.) Open Project Files Folder In Dolphin 13.) re-create the distrobox for the current active project
14.) Open Project Notes Folder In Dolphin 14.) Open Project Files Folder In Dolphin
15.) generate userpass file from your obsidian notes 15.) Open Project Notes Folder In Dolphin
16.) run pyro's initail enum script on a nessus csv for the current project 16.) generate userpass file from your obsidian notes
17.) Print Project Info For Report 17.) run pyro's initail enum script on a nessus csv for the current project
18.) Build host discovery cmd command from scope in notes 18.) Print Project Info For Report
19.) build portscan command from scope in notes 19.) Build host discovery cmd command from scope in notes
20.) Stop All Distroboxes 20.) build portscan command from scope in notes
21.) Password Spray (will print password to spray, and wait the obervation window time) 21.) Stop All Distroboxes
22.) crack password hashes on your cracking rig 22.) Password Spray (will print password to spray, and wait the obervation window time)
23.) prune unused distroboxes (free up system storage) 23.) crack password hashes on your cracking rig
24.) Quit Application 24.) prune unused distroboxes (free up system storage)
25.) Quit Application
\n",&base_files.display(), &upcoming_files.display(), active_project.customer, active_project.project_name, active_project.files_folder.display(), active_project.notes_folder.display(), active_project.boxname, terminal, season, year); \n",&base_files.display(), &upcoming_files.display(), active_project.customer, active_project.project_name, active_project.files_folder.display(), active_project.notes_folder.display(), active_project.boxname, terminal, season, year);
std::io::stdin().read_line(&mut response).expect("error getting menu input"); std::io::stdin().read_line(&mut response).expect("error getting menu input");
clear().expect("error clearing screen"); clear().expect("error clearing screen");
@@ -156,19 +157,20 @@ Year: {}
"9" => project_controls::promote_project(&mut projects, &config_path, base_files, base_notes, tools_dir, &boxtemplate), "9" => project_controls::promote_project(&mut projects, &config_path, base_files, base_notes, tools_dir, &boxtemplate),
"10" => box_controls::project_standalone_terminal(active_project.clone(), terminal.clone()), "10" => box_controls::project_standalone_terminal(active_project.clone(), terminal.clone()),
"11" => box_controls::project_inline_terminal(active_project.clone()), "11" => box_controls::project_inline_terminal(active_project.clone()),
"12" => box_controls::make_box(&active_project, &tools_dir, &boxtemplate, false), "12" => {let cs_thread = box_controls::launch_cobalt_strike(active_project.clone()); if cs_thread.is_some(){threads.push(cs_thread.unwrap());}},
"13" => info_controls::open_in_dolphin("files", active_project.clone()), "13" => box_controls::make_box(&active_project, &tools_dir, &boxtemplate, false),
"14" => info_controls::open_in_dolphin("notes", active_project.clone()), "14" => info_controls::open_in_dolphin("files", active_project.clone()),
"15" => info_controls::generate_userpass(&active_project), "15" => info_controls::open_in_dolphin("notes", active_project.clone()),
"16" => info_controls::run_initial_enum(&active_project), "16" => info_controls::generate_userpass(&active_project),
"17" => info_controls::print_report_information(active_project.clone()), "17" => info_controls::run_initial_enum(&active_project),
"18" => info_controls::build_cmd_for_host_discovery(&active_project), "18" => info_controls::print_report_information(active_project.clone()),
"19" => info_controls::build_cs_portscan_cmd(&active_project), "19" => info_controls::build_cmd_for_host_discovery(&active_project),
"20" => box_controls::stop_all_boxes(&projects), "20" => info_controls::build_cs_portscan_cmd(&active_project),
"21" => info_controls::password_spray_help(&active_project, season, lseason, year, &tools_dir, &config_path), "21" => box_controls::stop_all_boxes(&projects),
"22" => info_controls::crack_hashes(&cracking_rig, &active_project, &terminal, &rockyou, &rule), "22" => info_controls::password_spray_help(&active_project, season, lseason, year, &tools_dir, &config_path),
"23" => {let prune_thread = box_controls::clean_unused_boxes(&projects, &boxtemplate); if prune_thread.is_some(){threads.push(prune_thread.unwrap());}}, "23" => info_controls::crack_hashes(&cracking_rig, &active_project, &terminal, &rockyou, &rule),
"24" => {project_controls::save_projects(&projects, &config_path); "24" => {let prune_thread = box_controls::clean_unused_boxes(&projects, &boxtemplate); if prune_thread.is_some(){threads.push(prune_thread.unwrap());}},
"25" => {project_controls::save_projects(&projects, &config_path);
let mut stop = String::new(); let mut stop = String::new();
println!("stop all boxes?\ny/n"); println!("stop all boxes?\ny/n");
std::io::stdin().read_line(&mut stop).unwrap(); std::io::stdin().read_line(&mut stop).unwrap();

View File

@@ -4,12 +4,12 @@ use std::io::stdin;
use std::io::Write; use std::io::Write;
use std::path::PathBuf; use std::path::PathBuf;
use std::process; use std::process;
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 crate::get_user_input;
use fs_extra::file; use fs_extra::file;
use crate::Project; use crate::Project;
use crate::box_controls::make_box; use crate::box_controls::make_box;
@@ -366,9 +366,9 @@ pub fn promote_project(projects: &mut Vec<Project>, config_path: &PathBuf, proje
let mut new_files_dir = project_dir.clone(); let mut new_files_dir = project_dir.clone();
let mut new_notes_dir = notes_dir.clone(); let mut new_notes_dir = notes_dir.clone();
new_files_dir.push(&promoted_project.customer); new_files_dir.push(&promoted_project.customer);
new_files_dir.push(&promoted_project.project_name);
new_notes_dir.push(&promoted_project.customer); new_notes_dir.push(&promoted_project.customer);
new_notes_dir.push(&promoted_project.project_name); fs::create_dir_all(&new_files_dir).unwrap();
fs::create_dir_all(&new_notes_dir).unwrap();
let folder_move_success = process::Command::new("mv") let folder_move_success = process::Command::new("mv")
.arg("-i") .arg("-i")
.arg(&project.files_folder) .arg(&project.files_folder)
@@ -381,19 +381,58 @@ pub fn promote_project(projects: &mut Vec<Project>, config_path: &PathBuf, proje
.status().expect("unable to call the system mv command"); .status().expect("unable to call the system mv command");
if folder_move_success.success(){ if folder_move_success.success(){
println!("we copied the project folder correctly!!"); println!("we copied the project folder correctly!!");
let mut remove_folder = PathBuf::new();
remove_folder.push(&project.files_folder);
remove_folder.pop();
let remove_files_res = fs::remove_dir_all(remove_folder);
if remove_files_res.is_err(){
println!("error removing the original files folder form the upcomming folder, manual cleanup required");
}
else{
remove_files_res.unwrap();
println!("upcoming files folder cleanup successful!");
}
} }
else{ else{
println!("failed to copy the project folder, try to move it manually!"); println!("failed to copy the project folder, try to move it manually!");
} }
if note_move_success.success(){ if note_move_success.success(){
println!("we copied the notes folder correctly!!"); println!("we copied the notes folder correctly!!");
let mut remove_folder = PathBuf::new();
remove_folder.push(&project.files_folder);
remove_folder.pop();
let remove_notes_res = fs::remove_dir_all(remove_folder);
if remove_notes_res.is_err(){
println!("error removing the original notes folder form the upcomming folder, manual cleanup required");
}
else{
remove_notes_res.unwrap();
println!("upcoming notes folder cleanup successful!");
}
} }
else{ else{
println!("failed to copy the notes folder, try to move it manually!"); println!("failed to copy the notes folder, try to move it manually!");
} }
new_files_dir.push(&promoted_project.project_name);
new_notes_dir.push(&promoted_project.project_name);
promoted_project.files_folder = new_files_dir; promoted_project.files_folder = new_files_dir;
promoted_project.notes_folder = new_notes_dir; promoted_project.notes_folder = new_notes_dir;
promoted_project.stage = "current".to_owned(); promoted_project.stage = "current".to_owned();
let cs_response = get_user_input("will you need to be using cobalt strike for this project?");
if cs_response.to_lowercase().contains("y"){
let cs_path = get_user_input("path to your current cobalt strike directory?");
let copy_result = Command::new("cp").arg("-R").arg(&cs_path).arg(&promoted_project.files_folder).status();
if copy_result.is_err(){
println!("oof we had an error copying... you'll have to copy this manually");
}
else{
let copy_exit = copy_result.unwrap();
if copy_exit.success() == false{
println!("oof we had an error copying... you'll have to copy this manually");
println!("run cp -R {} {}", &cs_path, &promoted_project.files_folder.display());
}
}
}
thread::sleep(Duration::from_secs(3)); thread::sleep(Duration::from_secs(3));
make_box(&promoted_project, tools_dir, boxtemplate, true); make_box(&promoted_project, tools_dir, boxtemplate, true);
projects_to_save.push(promoted_project); projects_to_save.push(promoted_project);