Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2346988e23 | ||
|
|
5bfa645b3d | ||
|
|
012ba517ab | ||
|
|
649dad5e79 | ||
|
|
2e839adccf |
@@ -43,6 +43,10 @@ pub fn project_standalone_terminal(project: Project, mut terminal: String){
|
||||
if terminal.contains("profile"){
|
||||
profile = true;
|
||||
}
|
||||
if terminal.contains("!!!"){
|
||||
let terminal_launch_cmd = format!("distrobox enter --root {}", &project.boxname);
|
||||
terminal = terminal.replace("!!!", &terminal_launch_cmd);
|
||||
}
|
||||
let terminal_vec:Vec<&str> = terminal.split(" ").collect();
|
||||
let mut terminal_start = process::Command::new(terminal_vec[0]);
|
||||
let mut first = true;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::write;
|
||||
use std::fs;
|
||||
use std::fs::create_dir_all;
|
||||
use std::fs::read_to_string;
|
||||
use std::fs::OpenOptions;
|
||||
use std::hash::Hash;
|
||||
use std::io::BufReader;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
@@ -10,11 +14,16 @@ use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::io::stdin;
|
||||
use std::thread::JoinHandle;
|
||||
use chrono::format;
|
||||
use fs_extra::file;
|
||||
use reqwest::dns::Name;
|
||||
use walkdir::WalkDir;
|
||||
use clearscreen::clear;
|
||||
use clearscreen;
|
||||
use rodio::{Decoder, OutputStream, Sink};
|
||||
use crate::get_user_input;
|
||||
use crate::open_overwrite;
|
||||
use crate::open_append;
|
||||
use crate::Project;
|
||||
|
||||
pub fn run_initial_enum(project: &Project){
|
||||
@@ -776,3 +785,375 @@ pub fn get_mssql_column_names(project: &Project) -> Option<JoinHandle<()>>{
|
||||
});
|
||||
return Some(db_handle);
|
||||
}
|
||||
|
||||
pub fn partse_gathercontacts(project: &Project){
|
||||
fn format_names(names: Vec<&str>) -> HashMap<&str, Vec<String>>{
|
||||
let mut formated_data = HashMap::new();
|
||||
let mut flast = Vec::new();
|
||||
let mut fdotlast = Vec::new();
|
||||
let mut fdashlast = Vec::new();
|
||||
let mut firstl = Vec::new();
|
||||
let mut firstdotlast = Vec::new();
|
||||
let mut firstlast = Vec::new();
|
||||
let mut last_vec = Vec::new();
|
||||
let mut first_vec = Vec::new();
|
||||
for name in names{
|
||||
let name_vec: Vec<&str> = name.split("|").collect();
|
||||
if name_vec.len() == 2{
|
||||
let first = name_vec[0];
|
||||
let last = name_vec[1];
|
||||
let first_chars: Vec<char> = first.chars().collect();
|
||||
let last_chars: Vec<char> = last.chars().collect();
|
||||
flast.push(format!("{}{}", &first_chars[0], &last));
|
||||
fdotlast.push(format!("{}.{}", &first_chars[0], &last));
|
||||
fdashlast.push(format!("{}-{}", &first, &last));
|
||||
firstl.push(format!("{}{}", &first, &last_chars[0]));
|
||||
firstdotlast.push(format!("{}.{}", &first, &last));
|
||||
firstlast.push(format!("{}{}", &first, &last));
|
||||
last_vec.push(format!("{}", &last));
|
||||
first_vec.push(format!("{}", &first));
|
||||
}
|
||||
}
|
||||
formated_data.insert("flast", flast);
|
||||
formated_data.insert("fdotlast", fdotlast);
|
||||
formated_data.insert("fdashlast", fdashlast);
|
||||
formated_data.insert("firstl", firstl);
|
||||
formated_data.insert("firstdotlast", firstdotlast);
|
||||
formated_data.insert("firstlast", firstlast);
|
||||
formated_data.insert("last", last_vec);
|
||||
formated_data.insert("fisrt", first_vec);
|
||||
return formated_data;
|
||||
}
|
||||
|
||||
let gather_file = get_user_input("path to your gather contacts output?");
|
||||
print!("
|
||||
supported formats:
|
||||
flast
|
||||
f.last
|
||||
f-last
|
||||
firstl
|
||||
first.last
|
||||
firstlast
|
||||
last
|
||||
\n");
|
||||
let format = get_user_input("format of usernames?");
|
||||
let domain = get_user_input("domain name?");
|
||||
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);
|
||||
return;
|
||||
}
|
||||
let gather_source_string = gather_source.unwrap();
|
||||
let gather_source_lines: Vec<&str> = gather_source_string.split("\n").collect();
|
||||
let mut names = String::new();
|
||||
for line in gather_source_lines{
|
||||
if line.len() > 2{
|
||||
let line_vec: Vec<&str> = line.split("\t").collect();
|
||||
let first = line_vec[1].trim();
|
||||
let last = line_vec[2].trim();
|
||||
if first.len() > 1 && last.len() >1 {
|
||||
let name = format!("{}|{}",first, last);
|
||||
names = format!("{} {}", names, name.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
let users: Vec<&str> = names.split(" ").collect();
|
||||
let data = format_names(users);
|
||||
let mut email_text_path = project.files_folder.clone();
|
||||
let mut email_note_path = project.notes_folder.clone();
|
||||
email_text_path.push("working/extrapolated_emails.txt");
|
||||
email_note_path.push("email_enum.md");
|
||||
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);
|
||||
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);
|
||||
return;
|
||||
}
|
||||
let mut email_text_file = email_text_res.unwrap();
|
||||
let mut email_note_file = email_notes_res.unwrap();
|
||||
let note_wriet_res = write!(email_note_file, "# Extrapolated Emails: \n");
|
||||
if note_wriet_res.is_err(){
|
||||
let error = note_wriet_res.err().unwrap();
|
||||
println!("error writing to email notes file!");
|
||||
println!("{}", error);
|
||||
}
|
||||
println!("data gathered, printing emails and saving files...\n\n");
|
||||
for email in &data[&format.to_lowercase().trim()]{
|
||||
let outline = format!("{}@{}", email, domain);
|
||||
println!("{}", &outline);
|
||||
write!(email_note_file, "{}\n", outline).expect("error writing email notes file!");
|
||||
write!(email_text_file, "{}\n", outline).expect("error writing email text file!");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_csportscan(project: &Project){
|
||||
let mut tsv_path = project.files_folder.clone();
|
||||
tsv_path.push("working/tsvs/services.tsv");
|
||||
let mut outfile = tsv_path.clone();
|
||||
outfile.pop();
|
||||
outfile.pop();
|
||||
let mut windows_hosts = Vec::new();
|
||||
let mut ssh_hosts = Vec::new();
|
||||
let mut ftp_hosts = Vec::new();
|
||||
let mut rdp_hosts = Vec::new();
|
||||
let mut dns_hosts = Vec::new();
|
||||
let mut snmp_hosts = Vec::new();
|
||||
let mut web_hosts = Vec::new();
|
||||
let mut telnet_hosts = Vec::new();
|
||||
let mut unknown_ports = Vec::new();
|
||||
|
||||
if !get_user_input("do you have the tsv saved in the project folder under working/tsvs/services.tsv?").to_lowercase().contains("y"){
|
||||
tsv_path.clear();
|
||||
tsv_path.push(get_user_input("ooof ok, please enter the full path to your tsv file."));
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
println!("tsv read, parsing lines...");
|
||||
let tsv_string = tsv_read_res.unwrap();
|
||||
let lines: Vec<&str> = tsv_string.split("\n").collect();
|
||||
for line in lines{
|
||||
let words: Vec<&str> = line.split("\t").collect();
|
||||
if words.len() > 1{
|
||||
let host = words[0].to_lowercase().to_owned();
|
||||
let port = words[1].to_lowercase().to_owned();
|
||||
let host_entry = format!("{}:{}", &host, &port);
|
||||
match words[1]{
|
||||
"135" => {if !windows_hosts.contains(&host){windows_hosts.push(host)}},
|
||||
"445" => {if !windows_hosts.contains(&host){windows_hosts.push(host)}},
|
||||
"22" => {if !ssh_hosts.contains(&host){ssh_hosts.push(host);}},
|
||||
"21" => {if !ftp_hosts.contains(&host){ftp_hosts.push(host);}},
|
||||
"23" => {if !telnet_hosts.contains(&host){telnet_hosts.push(host)}},
|
||||
"3389" => {if !rdp_hosts.contains(&host){rdp_hosts.push(host);}},
|
||||
"80" | "443" | "8080" | "8443" | "4433" | "8000" => {if !web_hosts.contains(&host_entry){web_hosts.push(host_entry);}},
|
||||
"53" => {if !dns_hosts.contains(&host){dns_hosts.push(host);}},
|
||||
"161" => {if !snmp_hosts.contains(&host){snmp_hosts.push(host);}},
|
||||
_ => {
|
||||
if words.len() == 3{
|
||||
let banner = words[2].to_lowercase().to_owned();
|
||||
if words[2].to_lowercase().contains("ssh"){
|
||||
if !ssh_hosts.contains(&host_entry){
|
||||
ssh_hosts.push(host_entry);
|
||||
}
|
||||
}
|
||||
else if banner.contains("ftp"){
|
||||
if !ftp_hosts.contains(&host_entry){
|
||||
ftp_hosts.push(host_entry);
|
||||
}
|
||||
}
|
||||
else if banner.contains("nginx") || banner.contains("apache"){
|
||||
if !web_hosts.contains(&host_entry){
|
||||
web_hosts.push(host_entry);
|
||||
}
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if words.len() == 2{
|
||||
unknown_ports.push(host_entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("is {} where you want to save your files?", outfile.display());
|
||||
if get_user_input("").to_lowercase().contains("n"){
|
||||
outfile.clear();
|
||||
outfile.push(get_user_input("ok, please enter the full path to the folder you want to save them to."));
|
||||
}
|
||||
print!("
|
||||
{} Windows hosts found!
|
||||
{} SSH hosts found!
|
||||
{} FTP hosts found!
|
||||
{} Telnet hosts found!
|
||||
{} SNMP hosts found!
|
||||
{} DNS hosts found!
|
||||
{} RDP hosts found!
|
||||
{} untagged hosts found!
|
||||
", windows_hosts.len(), ssh_hosts.len(), ftp_hosts.len(), telnet_hosts.len(), snmp_hosts.len(), dns_hosts.len(), rdp_hosts.len(), unknown_ports.len());
|
||||
println!("lines parsed! creating output files...");
|
||||
outfile.push("windows_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut windows_file = file_option.unwrap();
|
||||
for host in windows_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
outfile.push("ssh_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut ssh_file = file_option.unwrap();
|
||||
for host in ssh_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
outfile.push("telnet_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut telnet_file = file_option.unwrap();
|
||||
for host in telnet_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
outfile.push("ftp_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut ftp_file = file_option.unwrap();
|
||||
for host in ftp_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
outfile.push("snmp_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut snmp_file = file_option.unwrap();
|
||||
for host in snmp_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
outfile.push("dns_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut dns_file = file_option.unwrap();
|
||||
for host in dns_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
outfile.push("rdp_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut rdp_file = file_option.unwrap();
|
||||
for host in rdp_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
outfile.push("web_hosts.txt");
|
||||
let file_option = open_overwrite(&outfile);
|
||||
if file_option.is_some(){
|
||||
let mut web_file = file_option.unwrap();
|
||||
for host in web_hosts{
|
||||
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);
|
||||
}
|
||||
else{
|
||||
write_res.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("interesting ports have been written to... writing untagged port files...");
|
||||
outfile.pop();
|
||||
outfile.push("untagged ports");
|
||||
if !outfile.exists(){
|
||||
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);
|
||||
}
|
||||
else{
|
||||
untagged_res.unwrap();
|
||||
}
|
||||
}
|
||||
for line in unknown_ports{
|
||||
let line_vec:Vec<&str> = line.split(":").collect();
|
||||
let host = line_vec[0].to_owned();
|
||||
let port = line_vec[1].to_owned();
|
||||
let file_name = format!("{}_hosts.txt", port);
|
||||
outfile.push(file_name);
|
||||
let write_file_opt = open_append(&outfile);
|
||||
if write_file_opt.is_some(){
|
||||
let mut write_file = write_file_opt.unwrap();
|
||||
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);
|
||||
}
|
||||
}
|
||||
outfile.pop();
|
||||
}
|
||||
println!("DONE all files saved to {}", outfile.display());
|
||||
println!("note if no hosts were found for a protocol their files will be empty.");
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
use std::collections::HashMap;
|
||||
use std::env::home_dir;
|
||||
use std::fs::{File, create_dir_all, remove_dir_all};
|
||||
use std::io::Read;
|
||||
use std::io::{read_to_string, Read};
|
||||
use std::io::Write;
|
||||
use std::io::stdin;
|
||||
use std::io::copy;
|
||||
use std::process::Command;
|
||||
use std::time::Duration;
|
||||
use reqwest::blocking::get;
|
||||
use std::{path::Path, path::PathBuf};
|
||||
use std::process;
|
||||
use std::{process, thread};
|
||||
use std::process::exit;
|
||||
use directories::UserDirs;
|
||||
|
||||
@@ -29,13 +30,13 @@ pub fn install(config_path: &PathBuf){
|
||||
let upcoming_projects = PathBuf::from(get_user_input("path to store your upcomming projects?"));
|
||||
let upcoming_notes = PathBuf::from(get_user_input("path to store your upcomming project notes?"));
|
||||
let tools = PathBuf::from(get_user_input("path where you store your custom tools (like from github and places)?"));
|
||||
let mut vault_name = String::new();
|
||||
let folders = vec![¤t_projects, ¤t_notes, &upcoming_projects, &upcoming_notes, &tools];
|
||||
let mut config_folder_path: PathBuf = config_path.clone();
|
||||
config_folder_path.pop();
|
||||
let mut password_path = config_folder_path.clone();
|
||||
password_path.push("password_spray.md");
|
||||
let mut projects_conf_path = config_folder_path.clone();
|
||||
projects_conf_path.push("projects.");
|
||||
let mut bell_file_path = config_folder_path.clone();
|
||||
let del_on_fail = config_folder_path.clone();
|
||||
projects_conf_path.push("projects.conf");
|
||||
@@ -94,7 +95,7 @@ pub fn install(config_path: &PathBuf){
|
||||
for name in distrobox_names{
|
||||
if !name.contains("NAME"){
|
||||
have_box = true;
|
||||
println!("name")
|
||||
println!("{}", name);
|
||||
}
|
||||
}
|
||||
let mut template_box_name = String::new();
|
||||
@@ -144,15 +145,16 @@ pub fn install(config_path: &PathBuf){
|
||||
println!("ok free loader");
|
||||
}
|
||||
let fingerprint = get_user_input("will you be using fingerprint authentication for your distroboxes?").to_lowercase();
|
||||
let terminal = String::new();
|
||||
let mut terminal = String::new();
|
||||
for desktop in _terminal_commands.keys(){
|
||||
println!("{}", desktop);
|
||||
}
|
||||
let desktop_response = get_user_input("do you use any of these desktops?").to_lowercase();
|
||||
if desktop_response.contains("y"){
|
||||
let default_response = get_user_input("do you use the default terminal for your desktop?").to_lowercase();
|
||||
if default_response.contains("y"){
|
||||
let de = get_user_input("which desktop do you use?");
|
||||
terminal = _terminal_commands[&de];
|
||||
terminal = _terminal_commands[&de.as_str()].to_owned();
|
||||
}
|
||||
}
|
||||
else{
|
||||
@@ -161,7 +163,6 @@ pub fn install(config_path: &PathBuf){
|
||||
println!("konsole -e !!!");
|
||||
terminal = get_user_input("");
|
||||
}
|
||||
}
|
||||
if terminal.contains("konsole"){
|
||||
println!("do you use a specific profile for your attack boxes?");
|
||||
println!("this is pretty specific to Pyro's setup, so you probably don't");
|
||||
@@ -170,6 +171,11 @@ pub fn install(config_path: &PathBuf){
|
||||
terminal = format!("konsole --profile {}", profile_name);
|
||||
}
|
||||
}
|
||||
println!("many of the fuctions of this tool assume you're using obsidian or some other markdown editor for note taking");
|
||||
let obsidian_used = get_user_input("do you use obsidian for your notes?");
|
||||
if obsidian_used.to_lowercase().contains("y"){
|
||||
vault_name = get_user_input("the name of the vault you're going to use?");
|
||||
}
|
||||
let configuration_string = format!("
|
||||
Project_files:{}
|
||||
Project_notes:{}
|
||||
@@ -182,9 +188,11 @@ cracking_rig:{}
|
||||
rockyou_location:{}
|
||||
rule_location:{}
|
||||
pass_file:{}
|
||||
fingerprint:{}"
|
||||
, ¤t_projects.display(), ¤t_notes.display(), &tools.display(), &upcoming_projects.display(), &upcoming_notes.display(), &template_box_name, &terminal, cracking_rig, rockyou, rule, &password_path.display(), fingerprint);
|
||||
fingerprint:{}
|
||||
vault_name:{}"
|
||||
, ¤t_projects.display(), ¤t_notes.display(), &tools.display(), &upcoming_projects.display(), &upcoming_notes.display(), &template_box_name, &terminal, cracking_rig, rockyou, rule, &password_path.display(), fingerprint, &vault_name);
|
||||
println!("cool everything, all folders and settings have been entered, now let's save this to a config file...");
|
||||
thread::sleep(Duration::from_secs(3));
|
||||
let mut config_file_res = File::create_new(config_path);
|
||||
if config_file_res.is_err(){
|
||||
println!("ooof error creating configuration file...");
|
||||
@@ -206,6 +214,7 @@ fingerprint:{}"
|
||||
println!("creating project configuration file, and poplulating it with the default project...");
|
||||
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!("copy the following configuration and save it to {}", &projects_conf_path.display());
|
||||
@@ -225,7 +234,7 @@ fingerprint:{}"
|
||||
println!("error creating password spray file");
|
||||
exit(1);
|
||||
}
|
||||
let password_file = password_file_res.unwrap();
|
||||
let mut password_file = password_file_res.unwrap();
|
||||
let password_write_res = write!(password_file, "
|
||||
- [ ] useraspass
|
||||
- [ ] Seasonyear!
|
||||
@@ -258,10 +267,11 @@ fingerprint:{}"
|
||||
- [ ] Service!
|
||||
- [ ] Serviceyear!
|
||||
");
|
||||
if password_file_res.is_err(){
|
||||
if password_write_res.is_err(){
|
||||
println!("error writing password file");
|
||||
exit(1);
|
||||
}
|
||||
password_write_res.unwrap();
|
||||
println!("install completed successfully!");
|
||||
println!("re-run this to launch!");
|
||||
}
|
||||
@@ -2,7 +2,7 @@ use std::{io::stdin, path::PathBuf, process::Command};
|
||||
use directories::UserDirs;
|
||||
use reqwest::Response;
|
||||
use std::process::exit;
|
||||
use std::fs;
|
||||
use std::fs::{self, File};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Project{
|
||||
@@ -23,6 +23,34 @@ mod box_controls;
|
||||
mod info_controls;
|
||||
mod start_pentest;
|
||||
|
||||
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);
|
||||
return None;
|
||||
}
|
||||
else {
|
||||
let file = file_create_res.unwrap();
|
||||
return Some(file);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
return None;
|
||||
}
|
||||
else {
|
||||
let file = file_create_res.unwrap();
|
||||
return Some(file);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_user_input(prompt: &str) -> String{
|
||||
let mut response = String::new();
|
||||
loop{
|
||||
@@ -94,6 +122,7 @@ fn main() {
|
||||
let mut upcoming_notes = PathBuf::new();
|
||||
let mut pass_spray_file = PathBuf::new();
|
||||
let mut fingerprint = false;
|
||||
let mut vault_name = String::new();
|
||||
println!("\nconfig already generated\nloading config file...\n");
|
||||
let settings_string = fs::read_to_string(&config_path).expect("error reading config file");
|
||||
let settings: Vec<&str> = settings_string.split("\n").collect();
|
||||
@@ -113,6 +142,7 @@ fn main() {
|
||||
"rule_location" => rule = setting_vec[1].trim_end().to_owned(),
|
||||
"pass_file"=> pass_spray_file.push(setting_vec[1]),
|
||||
"fingerprint" => {if setting_vec[1].contains("y"){fingerprint = true}},
|
||||
"vault_name" => vault_name = setting_vec[1].trim_end().to_owned(),
|
||||
_ => println!("error unknown setting: {}", setting_vec[0])
|
||||
}
|
||||
}
|
||||
@@ -132,5 +162,5 @@ fn main() {
|
||||
println!("Enter to start main menu");
|
||||
let mut enter = String::new();
|
||||
std::io::stdin().read_line(&mut enter).unwrap();
|
||||
menu::main_menu(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);
|
||||
menu::main_menu(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);
|
||||
}
|
||||
|
||||
@@ -31,12 +31,27 @@ fn get_active_project(projects: &Vec<Project>) -> &Project{
|
||||
return active_project
|
||||
}
|
||||
|
||||
pub fn main_menu(mut projects: Vec<Project>, config_path: PathBuf, base_files: &PathBuf, base_notes: &PathBuf, tools_dir: &PathBuf, boxtemplate: String, terminal: String, cracking_rig: String, rockyou: String, rule: String, upcoming_files: &PathBuf, upcoming_notes: &PathBuf, password_spray_file: &PathBuf, fingerprint: bool){
|
||||
pub fn main_menu(mut projects: Vec<Project>, config_path: PathBuf, base_files: &PathBuf, base_notes: &PathBuf, tools_dir: &PathBuf, boxtemplate: String, terminal: String, cracking_rig: String, rockyou: String, rule: String, upcoming_files: &PathBuf, upcoming_notes: &PathBuf, password_spray_file: &PathBuf, fingerprint: bool, vault_name: String){
|
||||
let mut loopize = true;
|
||||
let mut new_id = next_project_id(&config_path);
|
||||
let mut threads = Vec::new();
|
||||
loop {
|
||||
let active_project = get_active_project(&projects);
|
||||
let mut notes_folder_string = format!("{}", &active_project.notes_folder.display());
|
||||
let mut obsidian_folder_vec = PathBuf::new();
|
||||
let mut reached_vault_folder = false;
|
||||
for folder in notes_folder_string.split("/").collect::<Vec<&str>>(){
|
||||
if !folder.contains(&vault_name){
|
||||
reached_vault_folder = true;
|
||||
obsidian_folder_vec.push(folder);
|
||||
}
|
||||
else{
|
||||
if reached_vault_folder{
|
||||
obsidian_folder_vec.push(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
let obsidian_uri = format!("obsidian://open?vault={}&file={}", vault_name, obsidian_folder_vec.display().to_string().replace("/", "%2F"));
|
||||
let mut response = String::new();
|
||||
let now = Local::now();
|
||||
let month = now.month();
|
||||
@@ -98,25 +113,26 @@ pub fn main_menu(mut projects: Vec<Project>, config_path: PathBuf, base_files: &
|
||||
|
||||
|
||||
|
||||
NOTE OPTION 18 WILL SAVE YOUR PROJECTS BEFORE QUITTING
|
||||
NOTE OPTION 28 WILL SAVE YOUR PROJECTS BEFORE QUITTING
|
||||
|
||||
base prject folder: {}
|
||||
upcoming project folder: {}
|
||||
Current Project: {} {}
|
||||
Working Folder: {}
|
||||
Notes Folder: {}
|
||||
Obsidian_uri: {}
|
||||
Box Name: {}
|
||||
Terminal Command: {}
|
||||
Current Season: {}
|
||||
Year: {}
|
||||
General Notes: {}
|
||||
|
||||
Main Menu:
|
||||
1 .) Show Active Project
|
||||
2 .) List Projects
|
||||
3 .) Switch Active Project
|
||||
4 .) create new project with Pyro's default tool
|
||||
4 .) create new project with Pyro's default layout
|
||||
5 .) Save Project Information
|
||||
6 .) Import New Project - and setup new Distrobox
|
||||
6 .) Import New Project to Current projects list - and setup new Distrobox
|
||||
7 .) Remove Project
|
||||
8 .) Print upcoming projects
|
||||
9. ) promote project from upcoming to current
|
||||
@@ -131,13 +147,15 @@ Year: {}
|
||||
18.) Print Project Info For Report
|
||||
19.) Build host discovery cmd command from scope in notes
|
||||
20.) build portscan command from scope in notes
|
||||
21.) Stop All Distroboxes
|
||||
22.) Password Spray (will print password to spray, and wait the obervation window time)
|
||||
23.) crack password hashes on your cracking rig
|
||||
24.) Launch bloodhound with the current project's distrobox
|
||||
25.) prune unused distroboxes (free up system storage)
|
||||
26.) 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);
|
||||
21.) parse a cs portscan services.tsv file
|
||||
22.) Stop All Distroboxes
|
||||
23.) Password Spray (will print password to spray, and wait the obervation window time)
|
||||
24.) crack password hashes on your cracking rig
|
||||
25.) Launch bloodhound with the current project's distrobox
|
||||
26.) Parse GatherContacts output file
|
||||
27.) prune unused distroboxes (free up system storage)
|
||||
28.) 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);
|
||||
std::io::stdin().read_line(&mut response).expect("error getting menu input");
|
||||
clear().expect("error clearing screen");
|
||||
match response.as_str().trim_end(){
|
||||
@@ -164,12 +182,14 @@ Year: {}
|
||||
"18" => info_controls::print_report_information(active_project.clone()),
|
||||
"19" => info_controls::build_cmd_for_host_discovery(&active_project),
|
||||
"20" => info_controls::build_cs_portscan_cmd(&active_project),
|
||||
"21" => box_controls::stop_all_boxes(&projects),
|
||||
"22" => info_controls::password_spray_help(&active_project, season, lseason, year, &tools_dir, &config_path),
|
||||
"23" => info_controls::crack_hashes(&cracking_rig, &active_project, &terminal, &rockyou, &rule),
|
||||
"24" => {let bloodhound_handle = box_controls::launch_bloodhound_gui(active_project.clone()).unwrap(); threads.push(bloodhound_handle);},
|
||||
"25" => {let prune_thread = box_controls::clean_unused_boxes(&projects, &boxtemplate); if prune_thread.is_some(){threads.push(prune_thread.unwrap());}},
|
||||
"26" => {project_controls::save_projects(&projects, &config_path);
|
||||
"21" => info_controls::parse_csportscan(&active_project),
|
||||
"22" => box_controls::stop_all_boxes(&projects),
|
||||
"23" => info_controls::password_spray_help(&active_project, season, lseason, year, &tools_dir, &config_path),
|
||||
"24" => info_controls::crack_hashes(&cracking_rig, &active_project, &terminal, &rockyou, &rule),
|
||||
"25" => {let bloodhound_handle = box_controls::launch_bloodhound_gui(active_project.clone()).unwrap(); threads.push(bloodhound_handle);},
|
||||
"26" => info_controls::partse_gathercontacts(&active_project),
|
||||
"27" => {let prune_thread = box_controls::clean_unused_boxes(&projects, &boxtemplate); if prune_thread.is_some(){threads.push(prune_thread.unwrap());}},
|
||||
"28" => {project_controls::save_projects(&projects, &config_path);
|
||||
let mut stop = String::new();
|
||||
println!("stop all boxes?\ny/n");
|
||||
std::io::stdin().read_line(&mut stop).unwrap();
|
||||
|
||||
@@ -9,7 +9,6 @@ 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user