Skip to content

Commit

Permalink
readme and ip check update (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
EphemeralSapient authored Dec 2, 2024
1 parent f1e355e commit 49abdeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ apk add netscanner --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testin
```
cargo install netscanner
```

## Windows Installation

To use `netscanner` on Windows, you need to install [Npcap](https://npcap.com/dist/npcap-1.80.exe), otherwise you may encounter packet.dll error. Npcap is a packet capture library required for network scanning and packet analysis.

## Appreciation
`netscanner` has been made thanks to some awesome libraries that can be found in [Cargo.toml](./Cargo.toml) file.
But mostly I would like to link these two libraries that help me the most:
Expand Down
7 changes: 3 additions & 4 deletions src/components/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ impl Interfaces {
let interfaces = datalink::interfaces();
for intf in &interfaces {
// -- get active interface with non-local IP
if cfg!(windows) || (intf.is_up() && !intf.ips.is_empty()) {
if (cfg!(windows) || intf.is_up()) && !intf.ips.is_empty() {
// Windows doesn't have the is_up() method
for ip in &intf.ips {
// -- set active interface that's not localhost and starts with 192 [for windows compatibility]
if let IpAddr::V4(ipv4) = ip.ip() {
if ipv4.octets()[0] == 192 && ip.ip().to_string().ne("127.0.0.1") {
if let IpAddr::V4(ipv4) = ip.ip() {
if ipv4.is_private() && !ipv4.is_loopback() && !ipv4.is_unspecified() {
self.active_interfaces.push(intf.clone());
break;
}
Expand Down

0 comments on commit 49abdeb

Please sign in to comment.