diff --git a/Cargo.toml b/Cargo.toml index 7901893..d97ffd6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "netscanner" -version = "0.2.0" +version = "0.2.1" edition = "2021" -description = "WiFi Scanner of Networks signal" +description = "Network Scanner" license = "MIT" authors = ["Chleba "] diff --git a/README.md b/README.md index 3dc41db..3844af8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,13 @@ # netscanner -[![CI](https://github.com//netscanner/workflows/CI/badge.svg)](https://github.com//netscanner/actions) WiFi Networks Scanner +must be run with sudo priviliges + +## Install +``` +cargo install netscanner +``` + ![netscanner screenshot](./netscanner.png?raw=true) diff --git a/src/components/interfaces.rs b/src/components/interfaces.rs index b5d58c0..16c7bc6 100644 --- a/src/components/interfaces.rs +++ b/src/components/interfaces.rs @@ -52,12 +52,15 @@ impl Interfaces { for w in &self.interfaces { let name = w.name.clone(); let mac = w.mac.unwrap().to_string(); - let ipv4: Vec = w + let ipv4: Vec = w .ips .iter() .filter(|f| f.is_ipv4()) .cloned() - .map(|ip| Span::from(ip.ip().to_string())) + .map(|ip| { + let ip_str = ip.ip().to_string(); + Line::from(vec![Span::styled(format!("{ip_str:<2}"), Style::default().fg(Color::Blue))]) + }) .collect(); let ipv6: Vec = w .ips @@ -67,12 +70,22 @@ impl Interfaces { .map(|ip| Span::from(ip.ip().to_string())) .collect(); - rows.push(Row::new(vec![ - Cell::from(name), - Cell::from(mac), - Cell::from(vec![Line::from(ipv4)]), - Cell::from(vec![Line::from(ipv6)]), - ])); + let mut row_height = 1; + if ipv4.len() > 1 { + row_height = ipv4.clone().len() as u16; + } + rows.push( + Row::new(vec![ + Cell::from(Span::styled( + format!("{name:<2}"), + Style::default().fg(Color::Green), + )), + Cell::from(mac), + Cell::from(ipv4.clone()), + Cell::from(vec![Line::from(ipv6)]), + ]) + .height(row_height), // .bottom_margin((ipv4.len()) as u16) + ); } let table = Table::new(rows)