fixed note folder creation with new pentest option
This commit is contained in:
@@ -34,12 +34,18 @@ fn create_note_file(path: &PathBuf) -> Option<File>{
|
|||||||
fn external(passtemp: &PathBuf, project: &Project){
|
fn external(passtemp: &PathBuf, project: &Project){
|
||||||
// using a pathbuf to create files.
|
// using a pathbuf to create files.
|
||||||
let mut notes_path = project.notes_folder.clone();
|
let mut notes_path = project.notes_folder.clone();
|
||||||
notes_path.push("general.md");
|
let mut notes_path = project.notes_folder.clone();
|
||||||
let general_notes_result = fs::File::create(¬es_path);
|
let file_creation_res = fs::create_dir_all(¬es_path);
|
||||||
if general_notes_result.is_err(){
|
if file_creation_res.is_err(){
|
||||||
println!("oof we ran into issues making the general notes! try to creat manually!");
|
let error = file_creation_res.err().unwrap();
|
||||||
|
println!("error creating notes folder! {}", error);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
file_creation_res.unwrap();
|
||||||
|
}
|
||||||
|
notes_path.push("general.md");
|
||||||
|
let general_notes_result = create_note_file(¬es_path);
|
||||||
|
if general_notes_result.is_some(){
|
||||||
let mut general_notes = general_notes_result.unwrap();
|
let mut general_notes = general_notes_result.unwrap();
|
||||||
// for tagging
|
// for tagging
|
||||||
let project_type = "External";
|
let project_type = "External";
|
||||||
@@ -86,11 +92,8 @@ Planning call notes:
|
|||||||
}
|
}
|
||||||
notes_path.pop();
|
notes_path.pop();
|
||||||
notes_path.push("attacks.md");
|
notes_path.push("attacks.md");
|
||||||
let attack_notes_result = fs::File::create(¬es_path);
|
let attack_notes_result = create_note_file(¬es_path);
|
||||||
if attack_notes_result.is_err(){
|
if attack_notes_result.is_some(){
|
||||||
println!("oof we ran into issues making the general notes! try to creat manually!");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let mut attack_notes = attack_notes_result.unwrap();
|
let mut attack_notes = attack_notes_result.unwrap();
|
||||||
writeln!(&mut attack_notes, "#{} #{} #attack", project.customer, "external").expect("error writing tags on attack notes");
|
writeln!(&mut attack_notes, "#{} #{} #attack", project.customer, "external").expect("error writing tags on attack notes");
|
||||||
write!(&mut attack_notes,"
|
write!(&mut attack_notes,"
|
||||||
@@ -124,21 +127,15 @@ passwords tried:
|
|||||||
}
|
}
|
||||||
notes_path.pop();
|
notes_path.pop();
|
||||||
notes_path.push("host_notes.md");
|
notes_path.push("host_notes.md");
|
||||||
let host_notes_result = fs::File::create(¬es_path);
|
let host_notes_result = create_note_file(¬es_path);
|
||||||
if host_notes_result.is_err(){
|
if host_notes_result.is_some(){
|
||||||
println!("error creating host notes, try manually!");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
let mut host_notes = host_notes_result.unwrap();
|
let mut host_notes = host_notes_result.unwrap();
|
||||||
writeln!(&mut host_notes, "##{} #{} #host_notes", project.customer, "external").expect("error writing tag lin in host notes");
|
writeln!(&mut host_notes, "##{} #{} #host_notes", project.customer, "external").expect("error writing tag lin in host notes");
|
||||||
}
|
}
|
||||||
notes_path.pop();
|
notes_path.pop();
|
||||||
notes_path.push("findings.md");
|
notes_path.push("findings.md");
|
||||||
let findings_notes_result = fs::File::create(notes_path);
|
let findings_notes_result = create_note_file(¬es_path);
|
||||||
if findings_notes_result.is_err(){
|
if findings_notes_result.is_some(){
|
||||||
println!("error creating host findings file, try manually!");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
let mut finding_notes = findings_notes_result.unwrap();
|
let mut finding_notes = findings_notes_result.unwrap();
|
||||||
writeln!(&mut finding_notes, "#{} #{} #findings", project.customer, "external").expect("error writing tag line on findings");
|
writeln!(&mut finding_notes, "#{} #{} #findings", project.customer, "external").expect("error writing tag line on findings");
|
||||||
}
|
}
|
||||||
@@ -335,6 +332,12 @@ pub fn start_pentest(config_path: &PathBuf, projects: &mut Vec<Project>, id: i32
|
|||||||
project_files.push(&project_name);
|
project_files.push(&project_name);
|
||||||
project_notes.push(&customer_name);
|
project_notes.push(&customer_name);
|
||||||
project_notes.push(&project_name);
|
project_notes.push(&project_name);
|
||||||
|
println!("Files: {}\nNotes: {}\n\n", project_files.display(), project_notes.display());
|
||||||
|
let confirm_response = get_user_input("does this look ok?");
|
||||||
|
if confirm_response.to_lowercase().contains("n"){
|
||||||
|
println!("oof sorry");
|
||||||
|
return;
|
||||||
|
}
|
||||||
let mut working = project_files.clone();
|
let mut working = project_files.clone();
|
||||||
create_project_folder(&mut working, "working");
|
create_project_folder(&mut working, "working");
|
||||||
create_project_folder(&mut working, "writing");
|
create_project_folder(&mut working, "writing");
|
||||||
|
|||||||
Reference in New Issue
Block a user