From 2e839adccff86000694fbf256d34de4ae3c298e8 Mon Sep 17 00:00:00 2001 From: pyro57000 Date: Sat, 5 Apr 2025 17:49:16 -0500 Subject: [PATCH] Fixed the installer on Kali linux --- pentest_tool/src/box_controls.rs | 4 ++++ pentest_tool/src/install.rs | 41 +++++++++++++++++--------------- pentest_tool/src/menu.rs | 2 +- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/pentest_tool/src/box_controls.rs b/pentest_tool/src/box_controls.rs index 9e2de06..df0701f 100644 --- a/pentest_tool/src/box_controls.rs +++ b/pentest_tool/src/box_controls.rs @@ -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; diff --git a/pentest_tool/src/install.rs b/pentest_tool/src/install.rs index 57ce53c..bd07026 100644 --- a/pentest_tool/src/install.rs +++ b/pentest_tool/src/install.rs @@ -6,9 +6,10 @@ 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; @@ -35,7 +36,6 @@ pub fn install(config_path: &PathBuf){ 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 +94,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,24 +144,24 @@ 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]; - } - } - else{ - println!("OK, then please enter the command you'd use to launch a new terminal and run a command inside of it, replacing the command with three !s"); - println!("for example for konsole you'd enter"); - println!("konsole -e !!!"); - terminal = get_user_input(""); + } + 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.as_str()].to_owned(); } } + else{ + println!("OK, then please enter the command you'd use to launch a new terminal and run a command inside of it, replacing the command with three !s"); + println!("for example for konsole you'd enter"); + 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"); @@ -185,6 +185,7 @@ 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); 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 +207,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 +227,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 +260,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!"); } \ No newline at end of file diff --git a/pentest_tool/src/menu.rs b/pentest_tool/src/menu.rs index de23ab7..8c39828 100644 --- a/pentest_tool/src/menu.rs +++ b/pentest_tool/src/menu.rs @@ -98,7 +98,7 @@ pub fn main_menu(mut projects: Vec, config_path: PathBuf, base_files: & -NOTE OPTION 18 WILL SAVE YOUR PROJECTS BEFORE QUITTING +NOTE OPTION 26 WILL SAVE YOUR PROJECTS BEFORE QUITTING base prject folder: {} upcoming project folder: {}