added a function to parse your host notes and
generate the attack notes based off of them.
This commit is contained in:
@@ -97,6 +97,7 @@ pub fn run_initial_enum(project: &Project){
|
|||||||
for port in target.ports{
|
for port in target.ports{
|
||||||
output.push_str(format!("| {} | | [[attacks]]\n", port).as_str());
|
output.push_str(format!("| {} | | [[attacks]]\n", port).as_str());
|
||||||
}
|
}
|
||||||
|
output.push_str("\n---\n");
|
||||||
output.push_str("\n");
|
output.push_str("\n");
|
||||||
write!(&host_notes, "{}", output).expect("error writing host_notes");
|
write!(&host_notes, "{}", output).expect("error writing host_notes");
|
||||||
println!("{} notes written!", target.address);
|
println!("{} notes written!", target.address);
|
||||||
@@ -105,71 +106,80 @@ 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{
|
||||||
number: String,
|
service: String,
|
||||||
hosts: Vec<String>,
|
hosts: Vec<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut ports: Vec<Port> = Vec::new();
|
let mut ports: Vec<Port> = Vec::new();
|
||||||
let mut host_notes_path = project.notes_folder.clone();
|
let mut host_notes_path = project.notes_folder.clone();
|
||||||
let mut attack_notes_path = host_notes_path.clone();
|
|
||||||
host_notes_path.push("host_notes.md");
|
host_notes_path.push("host_notes.md");
|
||||||
|
let mut attack_notes_path = project.notes_folder.clone();
|
||||||
attack_notes_path.push("attacks.md");
|
attack_notes_path.push("attacks.md");
|
||||||
let host_notes_read_res = fs::read_to_string(host_notes_path);
|
let host_notes_read_res = fs::read_to_string(host_notes_path);
|
||||||
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);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let host_notes = host_notes_read_res.unwrap();
|
let host_notes_string = host_notes_read_res.unwrap();
|
||||||
let attack_open_res = fs::OpenOptions::new().append(true).create(true).open(attack_notes_path);
|
let host_parts: Vec<&str> = host_notes_string.split("---").collect();
|
||||||
if attack_open_res.is_err(){
|
let mut host = String::new();
|
||||||
let error = attack_open_res.err().unwrap();
|
for part in host_parts{
|
||||||
println!("error opening attack notes!");
|
let lines: Vec<&str> = part.split("\n").collect();
|
||||||
println!("{}", error);
|
for line in lines{
|
||||||
return;
|
|
||||||
}
|
|
||||||
let attack_notes = attack_open_res.unwrap();
|
|
||||||
for line in host_notes.split("\n").collect::<Vec<&str>>(){
|
|
||||||
let mut current_host = String::new();
|
|
||||||
if line.len() > 1{
|
|
||||||
if line.contains("# "){
|
if line.contains("# "){
|
||||||
if !line.contains("## "){
|
if !line.contains("## "){
|
||||||
current_host = line.split_whitespace().collect::<Vec<&str>>()[1].trim().to_owned();
|
host = line.split("# ").collect::<Vec<&str>>()[1].to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if line.contains("|"){
|
if line.contains("|"){
|
||||||
let table_data:Vec <&str> = line.split("|").collect();
|
if line.contains(":"){
|
||||||
for item in table_data{
|
let entries: Vec<&str> = line.split("|").collect();
|
||||||
let mut is_new = true;
|
let service = entries[2].trim().to_owned();
|
||||||
if item.contains(":"){
|
for entry in entries{
|
||||||
|
if entry.contains(":"){
|
||||||
|
let port_number = entry.trim().to_owned();
|
||||||
|
let mut new = true;
|
||||||
for port in &mut ports{
|
for port in &mut ports{
|
||||||
if port.number == item.trim(){
|
if port.service == service{
|
||||||
if port.hosts.contains(¤t_host){
|
new = false;
|
||||||
port.hosts.push(current_host.clone());
|
let host_entry = format!("{} {}", host.clone(), port_number.clone());
|
||||||
}
|
port.hosts.push(host_entry);
|
||||||
is_new = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if is_new{
|
match new{
|
||||||
let new_port = Port{number: line.trim().to_owned(), hosts:vec![current_host.clone()]};
|
true => {let new_port = Port{service: service.clone(), hosts: vec![format!("{} {}", host.clone(), port_number.clone())]}; ports.push(new_port);},
|
||||||
|
false => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for port in ports{
|
println!("{} parsed!", host);
|
||||||
let output = format!("# {}\nHOSTS:\n", port.number);
|
}
|
||||||
|
println!("parsed host_notes.md, writing to attacks.md...");
|
||||||
|
let attack_open_res = open_append(&attack_notes_path);
|
||||||
|
if attack_open_res.is_none(){
|
||||||
|
println!("ooof error opening attack notes, returning...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let mut attack_file = attack_open_res.unwrap();
|
||||||
|
write!(attack_file, "\n---\n").expect("since we used the open options already this should never fail.");
|
||||||
|
for port in ports.clone(){
|
||||||
|
write!(attack_file, "# {}\n", port.service).expect("since we used the open options already this should never fail.");
|
||||||
|
write!(attack_file, "HOSTS:\n").expect("since we used the open options already this should never fail.");
|
||||||
for host in port.hosts{
|
for host in port.hosts{
|
||||||
// output.push_str("## {}");
|
write!(attack_file, "## {}\n\n", host).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 build_cmd_for_host_discovery(project: &Project){
|
pub fn build_cmd_for_host_discovery(project: &Project){
|
||||||
let mut cobalt_strike_response = String::new();
|
let mut cobalt_strike_response = String::new();
|
||||||
let mut need_shell = false;
|
let mut need_shell = false;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ pub fn main_menu(mut projects: Vec<Project>, config_path: PathBuf, base_files: &
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
NOTE OPTION 28 WILL SAVE YOUR PROJECTS BEFORE QUITTING
|
NOTE OPTION 29 WILL SAVE YOUR PROJECTS BEFORE QUITTING
|
||||||
|
|
||||||
base prject folder: {}
|
base prject folder: {}
|
||||||
upcoming project folder: {}
|
upcoming project folder: {}
|
||||||
@@ -144,17 +144,18 @@ General Notes: {}
|
|||||||
15.) Open Project Notes Folder In Dolphin
|
15.) Open Project Notes Folder In Dolphin
|
||||||
16.) generate userpass file from your obsidian notes
|
16.) generate userpass file from your obsidian notes
|
||||||
17.) run pyro's initail enum script on a nessus csv for the current project
|
17.) run pyro's initail enum script on a nessus csv for the current project
|
||||||
18.) Print Project Info For Report
|
18.) build external attack notes from host_notes
|
||||||
19.) Build host discovery cmd command from scope in notes
|
19.) Print Project Info For Report
|
||||||
20.) build portscan command from scope in notes
|
20.) Build host discovery cmd command from scope in notes
|
||||||
21.) parse a cs portscan services.tsv file
|
21.) build portscan command from scope in notes
|
||||||
22.) Stop All Distroboxes
|
22.) parse a cs portscan services.tsv file
|
||||||
23.) Password Spray (will print password to spray, and wait the obervation window time)
|
23.) Stop All Distroboxes
|
||||||
24.) crack password hashes on your cracking rig
|
24.) Password Spray (will print password to spray, and wait the obervation window time)
|
||||||
25.) Launch bloodhound with the current project's distrobox
|
25.) crack password hashes on your cracking rig
|
||||||
26.) Parse GatherContacts output file
|
26.) Launch bloodhound with the current project's distrobox
|
||||||
27.) prune unused distroboxes (free up system storage)
|
27.) Parse GatherContacts output file
|
||||||
28.) Quit Application
|
28.) prune unused distroboxes (free up system storage)
|
||||||
|
29.) 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, &obsidian_uri);
|
\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, &obsidian_uri);
|
||||||
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");
|
||||||
@@ -179,17 +180,18 @@ General Notes: {}
|
|||||||
"15" => info_controls::open_in_dolphin("notes", active_project.clone()),
|
"15" => info_controls::open_in_dolphin("notes", active_project.clone()),
|
||||||
"16" => info_controls::generate_userpass(&active_project),
|
"16" => info_controls::generate_userpass(&active_project),
|
||||||
"17" => info_controls::run_initial_enum(&active_project),
|
"17" => info_controls::run_initial_enum(&active_project),
|
||||||
"18" => info_controls::print_report_information(active_project.clone()),
|
"18" => info_controls::build_external_attack_notes(&active_project),
|
||||||
"19" => info_controls::build_cmd_for_host_discovery(&active_project),
|
"19" => info_controls::print_report_information(active_project.clone()),
|
||||||
"20" => info_controls::build_cs_portscan_cmd(&active_project),
|
"20" => info_controls::build_cmd_for_host_discovery(&active_project),
|
||||||
"21" => info_controls::parse_csportscan(&active_project),
|
"21" => info_controls::build_cs_portscan_cmd(&active_project),
|
||||||
"22" => box_controls::stop_all_boxes(&projects),
|
"22" => info_controls::parse_csportscan(&active_project),
|
||||||
"23" => info_controls::password_spray_help(&active_project, season, lseason, year, &tools_dir, &config_path),
|
"23" => box_controls::stop_all_boxes(&projects),
|
||||||
"24" => info_controls::crack_hashes(&cracking_rig, &active_project, &terminal, &rockyou, &rule),
|
"24" => info_controls::password_spray_help(&active_project, season, lseason, year, &tools_dir, &config_path),
|
||||||
"25" => {let bloodhound_handle = box_controls::launch_bloodhound_gui(active_project.clone()).unwrap(); threads.push(bloodhound_handle);},
|
"25" => info_controls::crack_hashes(&cracking_rig, &active_project, &terminal, &rockyou, &rule),
|
||||||
"26" => info_controls::partse_gathercontacts(&active_project),
|
"26" => {let bloodhound_handle = box_controls::launch_bloodhound_gui(active_project.clone()).unwrap(); threads.push(bloodhound_handle);},
|
||||||
"27" => {let prune_thread = box_controls::clean_unused_boxes(&projects, &boxtemplate); if prune_thread.is_some(){threads.push(prune_thread.unwrap());}},
|
"27" => info_controls::partse_gathercontacts(&active_project),
|
||||||
"28" => {project_controls::save_projects(&projects, &config_path);
|
"28" => {let prune_thread = box_controls::clean_unused_boxes(&projects, &boxtemplate); if prune_thread.is_some(){threads.push(prune_thread.unwrap());}},
|
||||||
|
"29" => {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();
|
||||||
|
|||||||
Reference in New Issue
Block a user