Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fa1800337 | ||
|
|
e211433772 |
@@ -11,6 +11,7 @@ use chrono::Local;
|
||||
use colored::Colorize;
|
||||
use crate::print_error;
|
||||
use crate::print_informational;
|
||||
use crate::print_success;
|
||||
use crate::Project;
|
||||
use crate::project_controls;
|
||||
use crate::box_controls;
|
||||
@@ -265,6 +266,7 @@ fn print_banner(banner: &str){
|
||||
print!("{}", banner.custom_color((255,165,0)));
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn cli(interactive: bool,
|
||||
mut projects: Vec<Project>,
|
||||
config_path: PathBuf,
|
||||
@@ -376,31 +378,40 @@ for help enter help or ?. for information about a specific command enter help (c
|
||||
let mut workspace_config_path = config_path.clone();
|
||||
workspace_config_path.pop();
|
||||
let mut project_conf_path = config_path.clone();
|
||||
let mut success_message = String::new();
|
||||
project_conf_path.pop();
|
||||
project_conf_path.push("projects.conf");
|
||||
if get_user_input("are your work projects currently loaded? (not yoru personal projects...)").to_lowercase().contains("y"){
|
||||
workspace_config_path.push("projects.work");
|
||||
}
|
||||
else{
|
||||
workspace_config_path.push("projects.personal");
|
||||
}
|
||||
let open_res = OpenOptions::new().create(true).write(true).open(workspace_config_path);
|
||||
if open_res.is_err(){
|
||||
print_error("error opeing workspace config file!", open_res.err().unwrap().to_string());
|
||||
}
|
||||
else{
|
||||
let mut workspace_config_file = open_res.unwrap();
|
||||
let projects_read_res = read_to_string(project_conf_path);
|
||||
if projects_read_res.is_ok(){
|
||||
let project_string = projects_read_res.unwrap();
|
||||
let write_res = write!(workspace_config_file, "{}", project_string);
|
||||
if write_res.is_err(){
|
||||
print_error("error writing workspace config file!", write_res.err().unwrap().to_string());
|
||||
}
|
||||
project_conf_path.push("projects.work");
|
||||
let worksapces_in_use = project_conf_path.exists();
|
||||
if worksapces_in_use{
|
||||
if get_user_input("are your work projects currently loaded? (not yoru personal projects...)").to_lowercase().contains("y"){
|
||||
workspace_config_path.push("projects.work");
|
||||
success_message = String::from("projects.conf saved to projects.work");
|
||||
}
|
||||
else{
|
||||
print_error("error reading projects config file!", projects_read_res.err().unwrap().to_string());
|
||||
workspace_config_path.push("projects.personal");
|
||||
success_message = String::from("projects.conf saved to projects.personal");
|
||||
}
|
||||
let open_res = OpenOptions::new().create(true).write(true).open(workspace_config_path);
|
||||
if open_res.is_err(){
|
||||
print_error("error opeing workspace config file!", open_res.err().unwrap().to_string());
|
||||
}
|
||||
else{
|
||||
project_conf_path.pop();
|
||||
project_conf_path.push("projects.conf");
|
||||
let mut workspace_config_file = open_res.unwrap();
|
||||
let projects_read_res = read_to_string(project_conf_path);
|
||||
if projects_read_res.is_ok(){
|
||||
let project_string = projects_read_res.unwrap();
|
||||
let write_res = write!(workspace_config_file, "{}", project_string);
|
||||
if write_res.is_err(){
|
||||
print_error("error writing workspace config file!", write_res.err().unwrap().to_string());
|
||||
}
|
||||
}
|
||||
else{
|
||||
print_error("error reading projects config file!", projects_read_res.err().unwrap().to_string());
|
||||
}
|
||||
}
|
||||
print_success(success_message);
|
||||
}
|
||||
if threads.len() > 0{
|
||||
println!("closing threads...");
|
||||
@@ -410,4 +421,10 @@ for help enter help or ?. for information about a specific command enter help (c
|
||||
let _ = thread.join();
|
||||
}
|
||||
}
|
||||
if worksapces_in_use{
|
||||
print_success("projects saved to projects.conf, workspace project updated, threads finished. pentest_tool OUT!");
|
||||
}
|
||||
else{
|
||||
print_success("projects saved to projects.conf, threads finished. pentest_tool OUT!");
|
||||
}
|
||||
}
|
||||
@@ -193,10 +193,38 @@ pub fn bruteforce_subs(project: &Project, given_domains: Option<&Vec<String>>, g
|
||||
print_informational("sleeping for 10 seconds to allow for sudo password input.");
|
||||
sleep(Duration::from_secs(10));
|
||||
let gobuser_output = gobuster_cmd_res.unwrap().stdout;
|
||||
print_success("Gobuster enumeration Done!");
|
||||
let gobuster_string = String::from_utf8_lossy(&gobuser_output);
|
||||
let mut final_string = String::new();
|
||||
if gobuster_string.contains("specify the '--wildcard' switch"){
|
||||
let gobuster_cmd_res = Command::new("distrobox")
|
||||
.arg("enter")
|
||||
.arg("--root")
|
||||
.arg(working_project.boxname.to_owned())
|
||||
.arg("--")
|
||||
.arg("gobuster")
|
||||
.arg("dns")
|
||||
.arg("-d")
|
||||
.arg(&domain)
|
||||
.arg("-w")
|
||||
.arg(wordlist.to_owned())
|
||||
.arg("--wildcard")
|
||||
.output();
|
||||
if gobuster_cmd_res.is_err(){
|
||||
let error = gobuster_cmd_res.err().unwrap();
|
||||
println!("{}","From gobuster thread: Error running gobuster command!".red());
|
||||
println!("{}", error.to_string().red());
|
||||
return;
|
||||
}
|
||||
let new_gobuser_output = gobuster_cmd_res.unwrap().stdout;
|
||||
let new_gobuser_string = String::from_utf8_lossy(&new_gobuser_output);
|
||||
final_string = new_gobuser_string.to_string();
|
||||
}
|
||||
else{
|
||||
final_string = gobuster_string.to_string();
|
||||
}
|
||||
print_success("Gobuster enumeration Done!");
|
||||
let mut domain_names = Vec::new();
|
||||
let lines: Vec<&str> = gobuster_string.split("\n").collect();
|
||||
let lines: Vec<&str> = final_string.split("\n").collect();
|
||||
for line in lines{
|
||||
if line.contains("Found:"){
|
||||
let domain = line.split_whitespace().collect::<Vec<&str>>()[1];
|
||||
|
||||
Reference in New Issue
Block a user