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:
@@ -4,12 +4,12 @@ use std::io::stdin;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
use std::process::Command;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::get_user_input;
|
||||
use fs_extra::file;
|
||||
|
||||
use crate::Project;
|
||||
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_notes_dir = notes_dir.clone();
|
||||
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.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")
|
||||
.arg("-i")
|
||||
.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");
|
||||
if folder_move_success.success(){
|
||||
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{
|
||||
println!("failed to copy the project folder, try to move it manually!");
|
||||
}
|
||||
if note_move_success.success(){
|
||||
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{
|
||||
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.notes_folder = new_notes_dir;
|
||||
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));
|
||||
make_box(&promoted_project, tools_dir, boxtemplate, true);
|
||||
projects_to_save.push(promoted_project);
|
||||
|
||||
Reference in New Issue
Block a user