Skip to content

Commit

Permalink
spinner, layout & scanning flag
Browse files Browse the repository at this point in the history
- add throbber widget for scanning visualize
- add is_scanning flag for scanning state + prepared for stop scanning
- add cidr ip count into a discovery table title
  • Loading branch information
Chleba committed Mar 10, 2024
1 parent c7edd04 commit 8349b8a
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 79 deletions.
1 change: 1 addition & 0 deletions .config/config.json5
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"<g>": "Graph",
"<p>": "Packets",
"<f>": "Interface",
"<s>": "Scan",
"<up>": "Up",
"<down>": "Down",
"<left>": "Left",
Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ signal-hook = "0.3.17"
strip-ansi-escapes = "0.2.0"
strum = "0.26.1"
surge-ping = "0.8.0"
throbber-widgets-tui = "0.4.1"
tokio = { version = "1.32.0", features = ["full"] }
tokio-util = "0.7.9"
tokio-wifiscanner = "0.2.1"
Expand Down
2 changes: 2 additions & 0 deletions src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub enum Action {
GraphToggle,
PacketToggle,
InterfaceSwitch,
ScanCidr,
ActiveInterface(NetworkInterface),
ArpRecieve(ArpPacketData),
Scan(Vec<WifiInfo>),
Expand Down Expand Up @@ -71,6 +72,7 @@ impl<'de> Deserialize<'de> for Action {
"Graph" => Ok(Action::GraphToggle),
"Packets" => Ok(Action::PacketToggle),
"Interface" => Ok(Action::InterfaceSwitch),
"Scan" => Ok(Action::ScanCidr),
"Up" => Ok(Action::Up),
"Down" => Ok(Action::Down),
"Left" => Ok(Action::Left),
Expand Down
6 changes: 2 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl App {
let (action_tx, action_rx) = mpsc::unbounded_channel();

Ok(Self {
tick_rate: 1.0,
tick_rate: 10.0,
frame_rate,
components: vec![
Box::new(home),
Expand Down Expand Up @@ -133,8 +133,6 @@ impl App {
}

Action::Error(ref err_msg) => {
// println!("--------------------------------");
// println!("ERROR: {}", err_msg);
self.post_exist_msg = Some(err_msg.to_string());
self.should_quit = true;
}
Expand Down Expand Up @@ -193,8 +191,8 @@ impl App {
}
tui.exit()?;

println!("`netscanner` failed with Error:");
if let Some(ref s) = self.post_exist_msg {
println!("`netscanner` failed with Error:");
println!("{}", s);
}

Expand Down
Loading

0 comments on commit 8349b8a

Please sign in to comment.