Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7247e85762 |
No files matched your search
+43
-14
@@ -865,23 +865,52 @@ impl AppState {
|
|||||||
}
|
}
|
||||||
"parse_scope" => {
|
"parse_scope" => {
|
||||||
let mut general_path = self.projects[self.selected_project].notes.clone();
|
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");
|
general_path.push("general.md");
|
||||||
let general_string = read_to_string(general_path)?;
|
let general_string = read_to_string(general_path)?;
|
||||||
if let Some((_, scope_section)) = general_string.split_once("# Scope") {
|
let mut scope_file = OpenOptions::new()
|
||||||
if let Some((scope_section, _)) = scope_section.split_once("#") {
|
.create(true)
|
||||||
scope_section.lines().into_iter().for_each(|line| {
|
.truncate(true)
|
||||||
if line.contains("|") {
|
.write(true)
|
||||||
if !line.contains("Subnet") {
|
.open(scope_path)?;
|
||||||
if !line.contains("--") {
|
general_string
|
||||||
let host =
|
.split_whitespace()
|
||||||
line.split("|").collect::<Vec<&str>>()[1].to_string();
|
.into_iter()
|
||||||
self.projects[self.selected_project].add_scope(host);
|
.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" => {
|
"show_config" | "sc" => {
|
||||||
let _ = self
|
let _ = self
|
||||||
|
|||||||
@@ -1086,6 +1086,9 @@ pub fn run_tui(
|
|||||||
server_lock.action_que.push("disconnect".to_string());
|
server_lock.action_que.push("disconnect".to_string());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
println!("saving state information");
|
||||||
|
let _ = state.save_all();
|
||||||
|
println!("SAVED!");
|
||||||
for handle in handles {
|
for handle in handles {
|
||||||
handle.join().unwrap();
|
handle.join().unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user