changed the portscanning function to make it faster. It's using a

combination of multithreading and async now, each host or target for the
scan runs on its own thread, then each port check is run asynchronously.
This commit is contained in:
2026-09-04 17:46:20 -05:00
parent 5eece1b4bf
commit aff72fc275
3 changed files with 202 additions and 48 deletions
+44 -9
View File
@@ -341,10 +341,7 @@ pub fn run_tui(
Style::default().fg(Color::Green),
)));
progress_lines.push(Line::from(Span::styled(
format!(
" {}/{} ({}%)",
status.complete, status.total, percentage
),
format!(" {}/{} complete", status.complete, status.total),
Style::default().fg(Color::Green),
)));
} else {
@@ -356,8 +353,8 @@ pub fn run_tui(
)));
progress_lines.push(Line::from(Span::styled(
format!(
" {}/{} ({}%)",
status.complete, status.total, percentage
" {}/{} complete",
status.complete, status.total
),
Style::default().fg(Color::Cyan),
)));
@@ -370,8 +367,8 @@ pub fn run_tui(
)));
progress_lines.push(Line::from(Span::styled(
format!(
" {}/{} ({}%)",
status.complete, status.total, percentage
" {}/{} complete",
status.complete, status.total
),
Style::default().fg(Color::Magenta),
)));
@@ -479,6 +476,7 @@ pub fn run_tui(
ToolMessage::UpdateProject(index, project) => {
if index < state.projects.len() {
state.projects[index] = project;
let _ = state.save_all();
}
}
ToolMessage::RebuildDB => {
@@ -894,9 +892,46 @@ pub fn run_tui(
history_index = state.history.len();
}
}
KeyCode::Char(c) => {
KeyCode::Char(c)
if !key
.modifiers
.contains(crossterm::event::KeyModifiers::CONTROL) =>
{
state.curent_intput.push(c);
}
KeyCode::Char(c)
if key
.modifiers
.contains(crossterm::event::KeyModifiers::CONTROL) =>
{
match c {
'p' => {
state.curent_intput.push_str("new_project ");
let _ = state.main_tx.send(ToolMessage::Output((
0,
"type organization name and project name.".to_string(),
)));
}
's' => match state.save_all() {
Ok(_) => {
let _ = state.main_tx.send(ToolMessage::Output((
0,
format!("[success] Saved!"),
)));
}
Err(e) => {
let _ = state.main_tx.send(ToolMessage::Output((
0,
format!("[error] saving: {e}"),
)));
}
},
'h' => {
state.selecting_host = true;
}
_ => {}
}
}
KeyCode::Backspace => {
state.curent_intput.pop();
}