Skip to content

Commit 0e31b84

Browse files
committed
v0.4.3 - hotfix
- parsing bug when interface have no IPv4 address - disable auto-scan on start press `s` to start scanning
1 parent 6089d59 commit 0e31b84

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "netscanner"
3-
version = "0.4.2"
3+
version = "0.4.3"
44
edition = "2021"
55
description = "Network Scanner"
66
license = "MIT"

src/components/discovery.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,17 @@ impl Discovery {
269269
self.set_scrollbar_height();
270270
}
271271

272+
fn set_active_subnet(&mut self, intf: &NetworkInterface) {
273+
let a_ip = intf.ips[0].ip().to_string();
274+
let ip: Vec<&str> = a_ip.split('.').collect();
275+
if ip.len() > 1 {
276+
let new_a_ip = format!("{}.{}.{}.0/24", ip[0], ip[1], ip[2]);
277+
self.input = Input::default().with_value(new_a_ip);
278+
279+
self.set_cidr(self.input.value().to_string(), false);
280+
}
281+
}
282+
272283
fn set_scrollbar_height(&mut self) {
273284
self.scrollbar_state = self
274285
.scrollbar_state
@@ -548,12 +559,8 @@ impl Component for Discovery {
548559
let intf = interface.clone();
549560
// -- first time scan after setting of interface
550561
if self.active_interface.is_none() {
551-
let a_ip = intf.ips[0].ip().to_string();
552-
let ip: Vec<&str> = a_ip.split('.').collect();
553-
let new_a_ip = format!("{}.{}.{}.0/24", ip[0], ip[1], ip[2]);
554-
self.input = Input::default().with_value(new_a_ip);
562+
self.set_active_subnet(&intf);
555563

556-
self.set_cidr(self.input.value().to_string(), true);
557564
}
558565
self.active_interface = Some(intf);
559566
}

0 commit comments

Comments
 (0)