1 Commits
Author SHA1 Message Date
pyro 7247e85762 added a step to make sure state infomration is saved before exit, and
updated the parse_scope command to work better.
2026-09-23 11:14:28 -05:00
2 changed files with 46 additions and 14 deletions

No files matched your search

+43 -14
View File
@@ -865,23 +865,52 @@ impl AppState {
}
"parse_scope" => {
let mut general_path = self.projects[self.selected_project].notes.clone();
let mut scope_path = self.projects[self.selected_project].notes.clone();
scope_path.push("scope.md");
general_path.push("general.md");
let general_string = read_to_string(general_path)?;
if let Some((_, scope_section)) = general_string.split_once("# Scope") {
if let Some((scope_section, _)) = scope_section.split_once("#") {
scope_section.lines().into_iter().for_each(|line| {
if line.contains("|") {
if !line.contains("Subnet") {
if !line.contains("--") {
let host =
line.split("|").collect::<Vec<&str>>()[1].to_string();
self.projects[self.selected_project].add_scope(host);
}
}
let mut scope_file = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(scope_path)?;
general_string
.split_whitespace()
.into_iter()
.for_each(|word| {
if let Ok(_) = word.trim().parse::<IpNet>() {
if let Err(e) = write!(scope_file, "{}\n", word) {
let _ = self.main_tx.send(ToolMessage::Output((
rid,
format!("Error writing scope file! {e}"),
)));
}
});
}
}
} else if let Ok(_) = word.trim().parse::<IpAddr>() {
if let Err(e) = write!(scope_file, "{}\n", word) {
let _ = self.main_tx.send(ToolMessage::Output((
rid,
format!("Error writing scope file! {e}"),
)));
}
} else if word.contains(".com")
|| word.contains(".org")
|| word.contains(".gov")
|| word.contains(".site")
|| word.contains(".local")
|| word.contains(".ad")
{
if let Err(e) = write!(scope_file, "{}\n", word) {
let _ = self.main_tx.send(ToolMessage::Output((
rid,
format!("Error writing scope file! {e}"),
)));
}
}
});
let _ = self.main_tx.send(ToolMessage::Output((
rid,
"[success] scope parsed and scope.md written!".to_string(),
)));
}
"show_config" | "sc" => {
let _ = self
+3
View File
@@ -1086,6 +1086,9 @@ pub fn run_tui(
server_lock.action_que.push("disconnect".to_string());
}
});
println!("saving state information");
let _ = state.save_all();
println!("SAVED!");
for handle in handles {
handle.join().unwrap();
}