added the command to build the nmap portscan
command instead of just running it. I think running it is broken atm.
This commit is contained in:
@@ -54,6 +54,7 @@ fn help(command: Option<String>){
|
||||
"sharpersist command" | "spc" | "sharp scheduled task" | "sst" => {println!("Command: sharpersist command\nAliases: spc, sharp scheduled task, sst\n\nThis comand prints the commands to run to use sharpersist.exe to create a scheduled task that runs hourly called FRPersist.")},
|
||||
"port scan" | "ps" | "nmap" | "nmap scan" | "ns" | "nm" => {println!("Command: port scan\nAliases: ps, nmap, nmap scan, ns, nm\n\nThis command runs an nmap scan against the scope in the active projects notes, and saves the output.")},
|
||||
"show scope" | "ss" | "show s" | "s s" | "scope" => {println!("Command:show scope\nAliases:ss, show s, s s, scope\n\nThis command displays the current project's scope as just the hosts in the scope table in your notes.")},
|
||||
"port scan command" | "psc" | "nmap command" | "nmc" => {println!("command:port scan command\nAliases:psc,nmap command, nmc\n\nThis command will print the nmap command to manually run a scan to the terminal so you can copy paste it.")},
|
||||
"update git tools" | "ugt" | "update git" | "ug" => {println!("Command: update git tools\nAliases: update git, ugt, ug\n\nThis command attempts to update the git tools in your tools directory, it will attempt to update every directory as a git project. If the directory is not a git project it should just error out and continue to the next one.")},
|
||||
_ => ()
|
||||
}
|
||||
@@ -92,6 +93,7 @@ parse nomral nmap file | pnnf | parse nmap | pn
|
||||
show scope | ss | show s | s s | scope
|
||||
sharpersist command | spc | sharp scheduled task
|
||||
port scan | ps | nmap | nmap scan | ns | nm
|
||||
port scan command | psc | nmap command | nmc
|
||||
update git tools | ugt | update git | ug
|
||||
help | ? | -h
|
||||
")
|
||||
@@ -203,6 +205,7 @@ pub fn run_command(cmd: String,
|
||||
"show scope" | "ss" | "show s" | "s s" | "scope" => {let scope_res = info_controls::get_scope_entries(&active_project); if scope_res.is_some(){for host in scope_res.unwrap(){println!("{}", host)}}return None},
|
||||
"update git tools" | "ugt" | "update git" | "ug" => {tool_controls::update_git_tools(tools_dir); return None},
|
||||
"port scan" | "ps" | "nmap" | "nmap scan" | "ns" | "nm" => {portscan_controls::run_nmap_portscan(&active_project); return None;},
|
||||
"port scan command" | "psc" | "nmap command" | "nmc" => {portscan_controls::build_nmap_command(&active_project); return None;}
|
||||
"sharpersist command" | "spc" | "sharp scheduled task" | "sst" => {victim_commands::sharp_persist_command(&tools_dir); return None;},
|
||||
_ => {help(None); println!("\n\n unknown command."); return None;}
|
||||
}
|
||||
@@ -283,7 +286,7 @@ pub fn cli(interactive: bool,
|
||||
while loopize{
|
||||
project_controls::save_projects(&projects, &config_path);
|
||||
let active_project = get_active_project(&projects);
|
||||
print!("
|
||||
let current_information = format!("
|
||||
Active Project: {}, {}
|
||||
Project Status: {}
|
||||
Files Folder: {}
|
||||
@@ -295,12 +298,15 @@ for help enter help or ?. for information about a specific command enter help (c
|
||||
|
||||
|
||||
", active_project.customer, active_project.project_name, active_project.stage, active_project.files_folder.display(), active_project.notes_folder.display(), active_project.boxname, "coming soon");
|
||||
let command = get_user_input("command?");
|
||||
let prompt = format!("\n{}:{}\nCommand?", active_project.customer, active_project.project_name);
|
||||
let command = get_user_input(&prompt);
|
||||
match command.as_str(){
|
||||
"exit" => loopize = false,
|
||||
"menu" | "main menu" | "mm" => {let menu_thread_option = menu::main_menu(&mut projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.clone(), cracking_rig.clone(), rockyou.clone(), rule.clone(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.clone()); if menu_thread_option.is_some(){for thread in menu_thread_option.unwrap(){threads.push(thread);}}},
|
||||
"print banner" | "banner" => print_banner(banner),
|
||||
"clear" | "clear screen" | "cls" => {clear().unwrap(); print_banner(banner);}
|
||||
"clear" | "clear screen" | "cls" => {clear().unwrap(); print_banner(banner);},
|
||||
"list threads" | "threads" | "lst" => println!("There are {} threads still running.", threads.len()),
|
||||
"info" => println!("{}", current_information),
|
||||
_ => {let thread_option = run_command(command, &mut projects, config_path.clone(), base_files, base_notes, tools_dir, boxtemplate.clone(), terminal.clone(), cracking_rig.clone(), rockyou.clone(), rule.clone(), upcoming_files, upcoming_notes, password_spray_file, fingerprint, vault_name.clone()); if thread_option.is_some(){threads.push(thread_option.unwrap())}},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use core::error;
|
||||
use std::process::Command;
|
||||
use std::thread::JoinHandle;
|
||||
use std::thread::Thread;
|
||||
@@ -26,7 +27,54 @@ pub fn run_dns_enumeration(project: &Project) -> Option<JoinHandle<()>>{
|
||||
}
|
||||
/*let dns_handle = Thread::spawn(move || {
|
||||
for domain in domaind{
|
||||
let outp
|
||||
let output_res = Command::new("distrobox")
|
||||
.arg("--root")
|
||||
.arg(project.boxname)
|
||||
.arg("--")
|
||||
.arg("dnsrecon")
|
||||
.arg("-d")
|
||||
.arg(domain)
|
||||
.output();
|
||||
if output_res.is_err(){
|
||||
let error = output_res.err().unwrap();
|
||||
println!("error running dnsrecon in the project's distrobox!");
|
||||
println!("{}", error);
|
||||
return;
|
||||
}
|
||||
let output = output_res.unwrap().stdout;
|
||||
let output_string = String::from_utf8_lossy(&output);
|
||||
let mut recon_data = String::new();
|
||||
if output_string.contains("Container Setup Complete"){
|
||||
let parts: Vec<&str> = output_string.split("Container Setup Complete!").collect();
|
||||
recon_data = parts[1].to_owned();
|
||||
}
|
||||
else{
|
||||
recon_data = output_string.to_string();
|
||||
}
|
||||
let lines: Vec<&str> = recon_data.split("\n").collect();
|
||||
let mut out_data = String::new();
|
||||
out_data.push_str("#DNS Enumeration\n");
|
||||
out_data.push_str("## DNS Recon\n");
|
||||
let mut error_vec = Vec::new();
|
||||
for line in lines{
|
||||
if line.len() > 2{
|
||||
let words: Vec<&str> = line.split_whitespace().collect();
|
||||
if words.len() > 2{
|
||||
if words[1].contains("ERROR"){
|
||||
let error_slice = &&words[2..];
|
||||
for item in error_slice{
|
||||
error_vec.push(item.to_owned());
|
||||
}
|
||||
out_data.push_str("\n\n");
|
||||
}
|
||||
else if words[1].contains("INFO"){
|
||||
if !words.contains(&"Starting enumeration for") || !words.contains(&"Performing General Enumeration"){
|
||||
let record_type =
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});*/
|
||||
return None;
|
||||
|
||||
@@ -654,4 +654,92 @@ pub fn run_nmap_portscan(project: &Project){
|
||||
println!("{}", scan_results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_nmap_command(project: &Project){
|
||||
fn get_targets() -> Vec<String>{
|
||||
let mut targets = Vec::new();
|
||||
println!("please enter the ranges/ips to scan one per line, and enter END all caps when done.");
|
||||
loop {
|
||||
let response = get_user_input("ip or range to add?");
|
||||
if response == "END".to_owned(){
|
||||
break;
|
||||
}
|
||||
else{
|
||||
targets.push(response);
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
let targets_res = info_controls::get_scope_entries(project);
|
||||
let mut targets = Vec::new();
|
||||
let mut ports_to_scan = vec![String::from("80"), String::from("443"),
|
||||
String::from("161"),
|
||||
String::from("22"),
|
||||
String::from("21"),
|
||||
String::from("23"),
|
||||
String::from("8080"),
|
||||
String::from("8443"),
|
||||
String::from("4433"),
|
||||
String::from("135"),
|
||||
String::from("445"),
|
||||
String::from("3389"),
|
||||
String::from("5985"),
|
||||
String::from("1433"),
|
||||
String::from("3306"),
|
||||
String::from("2222"),];
|
||||
let mut save_path = project.files_folder.clone();
|
||||
if targets_res.is_none(){
|
||||
println!("couldn't get target list from your notes!");
|
||||
targets = get_targets();
|
||||
}
|
||||
else{
|
||||
println!("got targets from the cope in notes!");
|
||||
for target in targets_res.unwrap(){
|
||||
targets.push(target);
|
||||
}
|
||||
}
|
||||
for target in &targets{
|
||||
println!("{}", target);
|
||||
}
|
||||
if get_user_input("is this ok?").to_lowercase().contains("n"){
|
||||
println!("oooof ok, we'll have you recreate it manually.");
|
||||
targets = get_targets();
|
||||
}
|
||||
println!("These are the ports we're going to scan.");
|
||||
for port in &ports_to_scan{
|
||||
println!("{}", port);
|
||||
}
|
||||
if get_user_input("is this ok?").to_lowercase().contains("n"){
|
||||
println!("oof ok, rebuild it manually.");
|
||||
println!("please enter the ports you want to scan, one per line, enter END in all caps when you're finished.");
|
||||
ports_to_scan.clear();
|
||||
loop{
|
||||
let port = get_user_input("port to add?");
|
||||
if port.contains("END"){
|
||||
break;
|
||||
}
|
||||
else{
|
||||
ports_to_scan.push(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("we are going to save the output to {}/working/nmap_output.txt", save_path.display());
|
||||
if get_user_input("is this ok").to_lowercase().contains("n"){
|
||||
println!("oof ok.");
|
||||
save_path.clear();
|
||||
save_path.push(get_user_input("full path to where you want to save it then?"));
|
||||
}
|
||||
else{
|
||||
save_path.push("working/nmap_output.txt");
|
||||
}
|
||||
let ports_string = ports_to_scan.join(",");
|
||||
let targets_string = targets.join(" ");
|
||||
println!("\nYour portscan command is:");
|
||||
if get_user_input("will you be using proxychains for this scan?").to_lowercase().contains("y"){
|
||||
println!("\n\nproxychains nmap -sT -p {} {} -Pn | tee {}", ports_string, targets_string, save_path.display());
|
||||
}
|
||||
else{
|
||||
println!("nmap -p {} {} -Pn | tee {}", ports_string, targets_string, save_path.display());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user