Giter VIP home page Giter VIP logo

bandwhich's Introduction

bandwhich

demo

This is a CLI utility for displaying current network utilization by process, connection and remote IP/hostname

Table of contents

Project status

This project is in passive maintenance. Critical issues will be addressed, but no new features are being worked on. However, this is due to a lack of funding and/or manpower more than anything else, so pull requests are more than welcome. In addition, if you are able and willing to contribute to this project long-term, we would like to invite you to apply for co-maintainership.

For more details, see The Future of Bandwhich #275.

How does it work?

bandwhich sniffs a given network interface and records IP packet size, cross referencing it with the /proc filesystem on linux, lsof on macOS, or using WinApi on windows. It is responsive to the terminal window size, displaying less info if there is no room for it. It will also attempt to resolve ips to their host name in the background using reverse DNS on a best effort basis.

Installation

Downstream packaging status

For detailed instructions for each platform, see INSTALL.md.

Packaging status

Download a prebuilt binary

We offer several generic binaries in releases for various OSes.

OSArchitectureSupportUsage
Androidaarch64Best effort

All modern Android devices.

Note that this is a pure binary file, not an APK suitable for general usage.

Linuxaarch64Full 64-bit ARMv8+ (servers, some modern routers, RPi-4+).
armv7hfBest effort32-bit ARMv7 (older routers, pre-RPi-4).
x64Full Most Linux desktops & servers.
MacOSaarch64Full Apple silicon Macs (2021+).
x64 Intel Macs (pre-2021).
Windowsx64Full Most Windows desktops & servers.

Building from source

git clone https://github.com/imsnif/bandwhich.git
cd bandwhich
cargo build --release

For the up-to-date minimum supported Rust version, please refer to the rust-version field in Cargo.toml.

Cross-compiling

Cross-compiling for alternate targets is supported via cross. Here's the rough procedure:

  1. Check the target architecture. If on Linux, you can use uname -m.
  2. Lookup rustc platform support for the corresponding target triple.
  3. Install cross.
  4. Run cross build --release --target <TARGET_TRIPLE>.

Android

Until cross-rs/cross#1222 is solved, use the latest HEAD:

cargo install --git https://github.com/cross-rs/cross.git cross
cross build --release --target aarch64-linux-android

Post install (Linux)

Since bandwhich sniffs network packets, it requires elevated privileges. On Linux, there are two main ways to accomplish this:

1. setcap

  • Permanently allow the bandwhich binary its required privileges (called "capabilities" in Linux).
  • Do this if you want to give all unprivileged users full access to bandwhich's monitoring capabilities.
    • This is the recommended setup for single user machines, or if all users are trusted.
    • This is not recommended if you want to ensure users cannot see others' traffic.
# assign capabilities
sudo setcap cap_sys_ptrace,cap_dac_read_search,cap_net_raw,cap_net_admin+ep $(command -v bandwhich)
# run as unprivileged user
bandwhich

Capabilities explained

  • cap_sys_ptrace,cap_dac_read_search: allow access to /proc/<pid>/fd/, so that bandwhich can determine which open port belongs to which process.
  • cap_net_raw,cap_net_admin: allow capturing packets on your system.

2. sudo (or alternative)

  • Require privilege escalation every time.
  • Do this if you are an administrator of a multi-user environment.
sudo bandwhich

Note that if your installation method installed bandwhich to somewhere in your home directory (you can check with command -v bandwhich), you may get a command not found error. This is because in many distributions, sudo by default does not keep your user's $PATH for safety concerns.

To overcome this, you can do any one of the following:

  1. make sudo preserve your $PATH environment variable;
  2. explicitly set $PATH while running bandwhich: sudo env "PATH=$PATH" bandwhich;
  3. pass the full path to sudo: sudo $(command -v bandwhich).

Post install (Windows)

You might need to first install npcap for capturing packets on Windows.

Usage

Usage: bandwhich [OPTIONS]

Options:
  -i, --interface <INTERFACE>      The network interface to listen on, eg. eth0
  -r, --raw                        Machine friendlier output
  -n, --no-resolve                 Do not attempt to resolve IPs to their hostnames
  -s, --show-dns                   Show DNS queries
  -d, --dns-server <DNS_SERVER>    A dns server ip to use instead of the system default
      --log-to <LOG_TO>            Enable debug logging to a file
  -v, --verbose...                 Increase logging verbosity
  -q, --quiet...                   Decrease logging verbosity
  -p, --processes                  Show processes table only
  -c, --connections                Show connections table only
  -a, --addresses                  Show remote addresses table only
  -u, --unit-family <UNIT_FAMILY>  Choose a specific family of units [default: bin-bytes] [possible values: bin-bytes, bin-bits, si-bytes, si-bits]
  -t, --total-utilization          Show total (cumulative) usages
  -h, --help                       Print help (see more with '--help')
  -V, --version                    Print version

Contributing

Contributions of any kind are very welcome. If you'd like a new feature (or found a bug), please open an issue or a PR.

To set up your development environment:

  1. Clone the project
  2. cargo run, or if you prefer cargo run -- -i <network interface name> (you can often find out the name with ifconfig or iwconfig). You might need root privileges to run this application, so be sure to use (for example) sudo.

To run tests: cargo test

Note that at the moment the tests do not test the os layer (anything in the os folder).

If you are stuck, unsure about how to approach an issue or would like some guidance, you are welcome to contact: [email protected]

License

MIT

bandwhich's People

Contributors

axelsimon avatar bigtoast avatar br1ght0ne avatar calinou avatar captain-yossarian avatar chobeat avatar cyqsimon avatar dependabot[bot] avatar ebroto avatar eminence avatar erk- avatar etoledom avatar freddii avatar grishy avatar ilyes-ced avatar imsnif avatar kpcyrd avatar liyixin95 avatar ma27 avatar mphschmitt avatar olehs0 avatar pvalkone avatar remgodow avatar rtulip avatar sigmasd avatar teohhanhui avatar thedrow avatar thelostlambda avatar wezm avatar zhangxp1998 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bandwhich's Issues

Failing to report unbound UDP traffic

I'm not seeing much traffic (basically just ssh and sshd) despite knowing there's a ton of traffic.

iftop shows me over 20x streams open, but they are all UDP -- freeswitch VoIP streams.

They are listed in lsof -i

Is this a bug or by design? I saw no mention in the docs or issues of tcp vs udp.

Thanks!

UDP Support?

I've downloaded the generic Linux build and ran it on a server running Asterisk. For the most part it looks great! But I did notice that the Asterisk bandwidth was not present (it uses UDP).

So am I being dumb or does this tool not support UDP measurements right now?

Other tools like iftop are able to capture the Asterisk / UDP traffic

Thanks!

Refactor tests

Right now there's a lot of repetition going on there - they could definitely benefit from some shared functionality (maybe a utilities.rs file?)

Separate network sniffer to different process to reduce sudo exposure

Right now bandwhich is built from 153 packages (from the cargo install count). That's a really large attack surface for an app that's going to run under sudo.
Could the app be split into two processes? one of which runs as the user and handles the display, the other (with a smaller number of dependencies) as root to access just the network traffic and pass it to the user process.

I'd really like to be able to run the process as me. Then that process tries to sudo the network grabbing process with the required password if sudo requires it.

Master fails to build on MacOS

Building master branch on Mac failed with

   Compiling pnet_datalink_bandwhich_fork v0.23.0
error[E0432]: unresolved import `pnet_sys`
  --> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/pnet_datalink_bandwhich_fork-0.23.0/src/bpf.rs:17:5
   |
17 | use pnet_sys;
   |     ^^^^^^^^ no `pnet_sys` in the root

error[E0433]: failed to resolve: use of undeclared type or module `pnet_sys`
  --> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/pnet_datalink_bandwhich_fork-0.23.0/src/bindings/bpf.rs:69:20
   |
69 |     pub ifru_addr: pnet_sys::SockAddr, // NOTE Should be a union
   |                    ^^^^^^^^ use of undeclared type or module `pnet_sys`

error[E0599]: no method named `clone` found for type `std::sync::Arc<_>` in the current scope
   --> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/pnet_datalink_bandwhich_fork-0.23.0/src/bpf.rs:211:16
    |
211 |         fd: fd.clone(),
    |                ^^^^^ method not found in `std::sync::Arc<_>`
    |
    = note: fd is a function, perhaps you wish to call it

error[E0609]: no field `fd` on type `std::sync::Arc<_>`
   --> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/pnet_datalink_bandwhich_fork-0.23.0/src/bpf.rs:219:25
    |
219 |         libc::FD_SET(fd.fd, &mut sender.fd_set as *mut libc::fd_set);
    |                         ^^ unknown field

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0432, E0433, E0599, E0609.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `pnet_datalink_bandwhich_fork`.

To learn more, run the command again with --verbose.

This is possibly a rename problem with the fork?

Does not install on Ubuntu 19.10

I'm not sure what dependency might be missing.

rotten@rick-laptop /home/rotten $  sudo apt install cargo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libhttp-parser2.9 libssh2-1 libstd-rust-1.37 libstd-rust-dev rust-gdb rustc
Suggested packages:
  cargo-doc gdb-doc rust-doc rust-src
The following NEW packages will be installed:
  cargo libhttp-parser2.9 libssh2-1 libstd-rust-1.37 libstd-rust-dev rust-gdb rustc
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 100 MB of archives.
After this operation, 312 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libhttp-parser2.9 amd64 2.9.2-2 [21.8 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libssh2-1 amd64 1.8.0-2.1build1 [75.4 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libstd-rust-1.37 amd64 1.37.0+dfsg1+llvm-1ubuntu1 [49.2 MB]
Get:4 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libstd-rust-dev amd64 1.37.0+dfsg1+llvm-1ubuntu1 [30.3 MB]                                   
Get:5 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 rustc amd64 1.37.0+dfsg1+llvm-1ubuntu1 [17.7 MB]                                             
Get:6 http://us.archive.ubuntu.com/ubuntu eoan-updates/universe amd64 cargo amd64 0.38.0-0ubuntu1~19.10.1 [3,089 kB]                                       
Get:7 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 rust-gdb all 1.37.0+dfsg1+llvm-1ubuntu1 [25.5 kB]                                            
Fetched 100 MB in 23s (4,316 kB/s)                                                                                                                         
Selecting previously unselected package libhttp-parser2.9:amd64.
(Reading database ... 287797 files and directories currently installed.)
Preparing to unpack .../0-libhttp-parser2.9_2.9.2-2_amd64.deb ...
Unpacking libhttp-parser2.9:amd64 (2.9.2-2) ...
Selecting previously unselected package libssh2-1:amd64.
Preparing to unpack .../1-libssh2-1_1.8.0-2.1build1_amd64.deb ...
Unpacking libssh2-1:amd64 (1.8.0-2.1build1) ...
Selecting previously unselected package libstd-rust-1.37:amd64.
Preparing to unpack .../2-libstd-rust-1.37_1.37.0+dfsg1+llvm-1ubuntu1_amd64.deb ...
Unpacking libstd-rust-1.37:amd64 (1.37.0+dfsg1+llvm-1ubuntu1) ...
Selecting previously unselected package libstd-rust-dev:amd64.
Preparing to unpack .../3-libstd-rust-dev_1.37.0+dfsg1+llvm-1ubuntu1_amd64.deb ...
Unpacking libstd-rust-dev:amd64 (1.37.0+dfsg1+llvm-1ubuntu1) ...
Selecting previously unselected package rustc.
Preparing to unpack .../4-rustc_1.37.0+dfsg1+llvm-1ubuntu1_amd64.deb ...
Unpacking rustc (1.37.0+dfsg1+llvm-1ubuntu1) ...
Selecting previously unselected package cargo.
Preparing to unpack .../5-cargo_0.38.0-0ubuntu1~19.10.1_amd64.deb ...
Unpacking cargo (0.38.0-0ubuntu1~19.10.1) ...
Selecting previously unselected package rust-gdb.
Preparing to unpack .../6-rust-gdb_1.37.0+dfsg1+llvm-1ubuntu1_all.deb ...
Unpacking rust-gdb (1.37.0+dfsg1+llvm-1ubuntu1) ...
Setting up rust-gdb (1.37.0+dfsg1+llvm-1ubuntu1) ...
Setting up libssh2-1:amd64 (1.8.0-2.1build1) ...
Setting up libstd-rust-1.37:amd64 (1.37.0+dfsg1+llvm-1ubuntu1) ...
Setting up libhttp-parser2.9:amd64 (2.9.2-2) ...
Setting up libstd-rust-dev:amd64 (1.37.0+dfsg1+llvm-1ubuntu1) ...
Setting up rustc (1.37.0+dfsg1+llvm-1ubuntu1) ...
Setting up cargo (0.38.0-0ubuntu1~19.10.1) ...
Processing triggers for man-db (2.8.7-3) ...
Processing triggers for libc-bin (2.30-0ubuntu2) ...
rotten@rick-laptop /home/rotten $  cargo install what
    Updating crates.io index
  Downloaded what v0.5.1
  Downloaded 1 crate (31.5 KB) in 1.91s
  Installing what v0.5.1
  Downloaded chrono v0.4.10
  Downloaded pnet v0.23.0
  Downloaded async-trait v0.1.22
  Downloaded ipnetwork v0.15.1
  Downloaded lazy_static v1.4.0
  Downloaded tui v0.5.1
  Downloaded trust-dns-resolver v0.18.0-alpha.2
  Downloaded tokio v0.2.6
  Downloaded structopt v0.3.7
  Downloaded regex v1.3.1
  Downloaded procfs v0.7.7
  Downloaded failure v0.1.6
  Downloaded signal-hook v0.1.12
  Downloaded termion v1.5.4
  Downloaded fnv v1.0.6
  Downloaded quote v1.0.2
  Downloaded bytes v0.5.3
  Downloaded proc-macro2 v1.0.6
  Downloaded serde v1.0.104
  Downloaded syn v1.0.11
  Downloaded pnet_transport v0.23.0
  Downloaded pnet_base v0.23.0
  Downloaded aho-corasick v0.7.6
  Downloaded mio v0.6.21
  Downloaded either v1.5.3
  Downloaded unicode-width v0.1.7
  Downloaded lru-cache v0.1.2
  Downloaded num-integer v0.1.41
  Downloaded resolv-conf v0.6.2
  Downloaded memchr v2.2.1
  Downloaded pin-project-lite v0.1.1
  Downloaded structopt-derive v0.4.0
  Downloaded iovec v0.1.4
  Downloaded regex-syntax v0.6.12
  Downloaded num-traits v0.2.10
  Downloaded itertools v0.8.2
  Downloaded smallvec v1.1.0
  Downloaded pnet_packet v0.23.0
  Downloaded unicode-segmentation v1.6.0
  Downloaded bitflags v1.2.1
  Downloaded time v0.1.42
  Downloaded cfg-if v0.1.10
  Downloaded slab v0.4.2
  Downloaded trust-dns-proto v0.18.0-alpha.2
  Downloaded log v0.4.8
  Downloaded futures v0.3.1
  Downloaded pnet_datalink v0.23.0
  Downloaded clap v2.33.0
  Downloaded cassowary v0.3.0
  Downloaded numtoa v0.1.0
  Downloaded pnet_macros v0.21.0
  Downloaded autocfg v0.1.7
  Downloaded futures-channel v0.3.1
  Downloaded thread_local v0.3.6
  Downloaded pnet_sys v0.23.0
  Downloaded futures-executor v0.3.1
  Downloaded net2 v0.2.33
  Downloaded futures-core v0.3.1
  Downloaded enum-as-inner v0.3.0
  Downloaded syntex v0.42.2
  Downloaded signal-hook-registry v1.2.0
  Downloaded backtrace v0.3.40
  Downloaded futures-task v0.3.1
  Downloaded unicode-xid v0.2.0
  Downloaded rand v0.7.2
  Downloaded futures-sink v0.3.1
  Downloaded proc-macro-error v0.4.4
  Downloaded url v2.1.0
  Downloaded pnet_macros_support v0.23.0
  Downloaded failure_derive v0.1.6
  Downloaded linked-hash-map v0.5.2
  Downloaded glob v0.2.11
  Downloaded futures-util v0.3.1
  Downloaded heck v0.3.1
  Downloaded futures-io v0.3.1
  Downloaded libc v0.2.66
  Downloaded idna v0.2.0
  Downloaded socket2 v0.3.11
  Downloaded hostname v0.1.5
  Downloaded byteorder v1.3.2
  Downloaded backtrace-sys v0.1.32
  Downloaded rustc-demangle v0.1.16
  Downloaded synstructure v0.12.3
  Downloaded hex v0.4.0
  Downloaded proc-macro-error-attr v0.4.3
  Downloaded futures-macro v0.3.1
  Downloaded pin-utils v0.1.0-alpha.4
  Downloaded quick-error v1.2.2
  Downloaded atty v0.2.13
  Downloaded arc-swap v0.4.4
  Downloaded textwrap v0.11.0
  Downloaded syntex_syntax v0.42.0
  Downloaded proc-macro-nested v0.1.3
  Downloaded proc-macro-hack v0.5.11
  Downloaded rustversion v1.0.0
  Downloaded percent-encoding v2.1.0
  Downloaded strsim v0.8.0
  Downloaded matches v0.1.8
  Downloaded syntex_errors v0.42.0
  Downloaded unicode-normalization v0.1.11
  Downloaded rand_core v0.5.1
  Downloaded unicode-bidi v0.3.4
  Downloaded regex v0.2.11
  Downloaded rand_chacha v0.2.1
  Downloaded libflate v0.1.27
  Downloaded vec_map v0.8.1
  Downloaded ansi_term v0.11.0
  Downloaded getrandom v0.1.13
  Downloaded log v0.3.9
  Downloaded rustc-serialize v0.3.24
  Downloaded c2-chacha v0.2.3
  Downloaded unicode-xid v0.0.3
  Downloaded syn-mid v0.4.0
  Downloaded term v0.4.6
  Downloaded bitflags v0.5.0
  Downloaded utf8-ranges v1.0.4
  Downloaded aho-corasick v0.6.10
  Downloaded syntex_pos v0.42.0
  Downloaded cc v1.0.48
  Downloaded regex-syntax v0.5.6
  Downloaded crc32fast v1.2.0
  Downloaded ppv-lite86 v0.2.6
  Downloaded adler32 v1.0.4
  Downloaded ucd-util v0.1.5
  Downloaded take_mut v0.2.2
  Downloaded rle-decode-fast v1.0.1
   Compiling log v0.4.8
   Compiling libc v0.2.66
   Compiling cfg-if v0.1.10
   Compiling proc-macro2 v1.0.6
   Compiling unicode-xid v0.2.0
   Compiling memchr v2.2.1
   Compiling rustc-serialize v0.3.24
   Compiling term v0.4.6
   Compiling syn v1.0.11
   Compiling unicode-xid v0.0.3
   Compiling regex v0.2.11
   Compiling bitflags v0.5.0
   Compiling ucd-util v0.1.5
   Compiling lazy_static v1.4.0
   Compiling utf8-ranges v1.0.4
   Compiling getrandom v0.1.13
   Compiling cc v1.0.48
   Compiling proc-macro-nested v0.1.3
   Compiling autocfg v0.1.7
   Compiling futures-sink v0.3.1
   Compiling futures-core v0.3.1
   Compiling slab v0.4.2
   Compiling smallvec v1.1.0
   Compiling matches v0.1.8
   Compiling futures-task v0.3.1
   Compiling futures-io v0.3.1
   Compiling serde v1.0.104
   Compiling pin-utils v0.1.0-alpha.4
   Compiling ppv-lite86 v0.2.6
   Compiling failure_derive v0.1.6
   Compiling glob v0.2.11
   Compiling pnet_base v0.23.0
   Compiling bitflags v1.2.1
   Compiling crc32fast v1.2.0
   Compiling unicode-segmentation v1.6.0
   Compiling rustc-demangle v0.1.16
   Compiling byteorder v1.3.2
   Compiling fnv v1.0.6
   Compiling percent-encoding v2.1.0
   Compiling pin-project-lite v0.1.1
   Compiling bytes v0.5.3
   Compiling unicode-width v0.1.7
   Compiling either v1.5.3
   Compiling ansi_term v0.11.0
   Compiling take_mut v0.2.2
   Compiling quick-error v1.2.2
   Compiling arc-swap v0.4.4
   Compiling adler32 v1.0.4
error: `core::slice::<impl [T]>::len` is not yet stable as a const fn
   --> /home/rotten/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.3/src/bytes.rs:121:18
    |
121 |             len: bytes.len(),
    |                  ^^^^^^^^^^^

   Compiling strsim v0.8.0
error: aborting due to previous error

error: Could not compile `bytes`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `what v0.5.1`, intermediate artifacts can be found at `/tmp/cargo-installmWGjX6`

Caused by:
  build failed

Add switch for persistence

The information displayed disappears too quickly. Can you please add a switch to add some persistence? For example:

sudo what --persistence 2

For a 2 second delay before the information disappears, etc.

Thank you.

Raw mode

It would be nice if the utility would allow for a --raw flag. Instead of displaying the UI, it would output a stream of easily parsable state (essentially what we see in the UI every second).

Compiler error on Linux

When installing with cargo install what with Rust 1.39.0.

error[E0107]: wrong number of type arguments: expected 2, found 0
  --> /home/mmstick/.cargo/registry/src/github.com-1ecc6299db9ec823/what-0.4.0/src/network/dns/resolver.rs:10:21
   |
10 | pub struct Resolver(AsyncResolver);
   |                     ^^^^^^^^^^^^^ expected 2 type arguments

error: aborting due to previous error

For more information about this error, try `rustc --explain E0107`.
error: failed to compile `what v0.4.0`, intermediate artifacts can be found at `/tmp/cargo-install5fzOgK`

Caused by:
  could not compile `what`.

Fix sudo error on mac

When running without sudo and getting a permission error, bandwhich should alert the user and offer the possibility of using sudo. As discussed here: #31 (comment) this does not happen on macOS.

@virtualritz found a workaround by listening for the NotFound ErrorKind (see thread). This might not be a good long-term solution though, seeing as that specific error might mean other things (eg. the interface not being found :) ). Would love to have a proper solution for this so that mac users get the 'sudo' suggestion as well.

cargo install failed on MacOS

install finish with error. is there anything I can do to fix it?

cargo install bandwhich
    Updating crates.io index
  Downloaded bandwhich v0.6.0
  Downloaded 1 crates (31.6 KB) in 0.91s
  Installing bandwhich v0.6.0
  Downloaded termion v1.5.3
  Downloaded ipnetwork v0.15.0
  Downloaded failure v0.1.6
  Downloaded pnet v0.23.0
  Downloaded tui v0.5.1
  Downloaded structopt v0.3.4
  Downloaded async-trait v0.1.21
  Downloaded chrono v0.4.9
  Downloaded tokio v0.2.2
  Downloaded trust-dns-resolver v0.18.0-alpha.2
  Downloaded signal-hook v0.1.11
  Downloaded pnet_base v0.23.0
  Downloaded failure_derive v0.1.6
  Downloaded proc-macro2 v1.0.6
  Downloaded pnet_packet v0.23.0
  Downloaded numtoa v0.1.0
  Downloaded structopt-derive v0.3.4
  Downloaded pnet_sys v0.23.0
  Downloaded cassowary v0.3.0
  Downloaded clap v2.33.0
  Downloaded unicode-width v0.1.6
  Downloaded syn v1.0.8
  Downloaded libc v0.2.65
  Downloaded pnet_transport v0.23.0
  Downloaded pnet_datalink v0.23.0
  Downloaded backtrace v0.3.40
  Downloaded bitflags v1.2.1
  Downloaded serde v1.0.102
  Downloaded unicode-segmentation v1.6.0
  Downloaded itertools v0.8.1
  Downloaded atty v0.2.13
  Downloaded syntex v0.42.2
  Downloaded synstructure v0.12.3
  Downloaded signal-hook-registry v1.1.1
  Downloaded textwrap v0.11.0
  Downloaded pnet_macros_support v0.23.0
  Downloaded num-integer v0.1.41
  Downloaded num-traits v0.2.8
  Downloaded vec_map v0.8.1
  Downloaded strsim v0.8.0
  Downloaded mio v0.6.21
  Downloaded smallvec v1.0.0
  Downloaded proc-macro-error v0.2.6
  Downloaded pnet_macros v0.21.0
  Downloaded pin-project-lite v0.1.1
  Downloaded backtrace-sys v0.1.32
  Downloaded heck v0.3.1
  Downloaded ansi_term v0.11.0
  Downloaded lru-cache v0.1.2
  Downloaded futures v0.3.1
  Downloaded resolv-conf v0.6.2
  Downloaded bytes v0.5.0
  Downloaded trust-dns-proto v0.18.0-alpha.2
  Downloaded linked-hash-map v0.5.2
  Downloaded autocfg v0.1.7
  Downloaded syntex_syntax v0.42.0
  Downloaded syntex_errors v0.42.0
  Downloaded iovec v0.1.4
  Downloaded cc v1.0.47
  Downloaded regex v0.2.11
  Downloaded arc-swap v0.4.3
  Downloaded syntex_pos v0.42.0
  Downloaded unicode-xid v0.0.3
  Downloaded futures-io v0.3.1
  Downloaded rustc-serialize v0.3.24
  Downloaded futures-sink v0.3.1
  Downloaded bitflags v0.5.0
  Downloaded futures-channel v0.3.1
  Downloaded term v0.4.6
  Downloaded futures-util v0.3.1
  Downloaded futures-task v0.3.1
  Downloaded socket2 v0.3.11
  Downloaded unicode-normalization v0.1.9
  Downloaded quick-error v1.2.2
  Downloaded enum-as-inner v0.3.0
  Downloaded hostname v0.1.5
  Downloaded futures-executor v0.3.1
  Downloaded futures-core v0.3.1
  Downloaded rand v0.7.2
  Downloaded smallvec v0.6.13
  Downloaded aho-corasick v0.6.10
  Downloaded proc-macro-nested v0.1.3
  Downloaded utf8-ranges v1.0.4
  Downloaded proc-macro-hack v0.5.11
  Downloaded regex-syntax v0.5.6
  Downloaded futures-macro v0.3.1
  Downloaded pin-utils v0.1.0-alpha.4
  Downloaded maybe-uninit v2.0.0
  Downloaded getrandom v0.1.13
  Downloaded c2-chacha v0.2.3
  Downloaded ucd-util v0.1.5
  Downloaded ppv-lite86 v0.2.6
   Compiling log v0.4.8
   Compiling cfg-if v0.1.9
   Compiling libc v0.2.65
   Compiling proc-macro2 v1.0.6
   Compiling memchr v2.2.1
   Compiling rustc-serialize v0.3.24
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.8
   Compiling unicode-xid v0.0.3
   Compiling term v0.4.6
   Compiling lazy_static v1.4.0
   Compiling regex v0.2.11
   Compiling maybe-uninit v2.0.0
   Compiling bitflags v0.5.0
   Compiling ucd-util v0.1.5
   Compiling cc v1.0.47
   Compiling proc-macro-nested v0.1.3
   Compiling utf8-ranges v1.0.4
   Compiling getrandom v0.1.13
   Compiling futures-core v0.3.1
error[E0658]: use of unstable library feature 'alloc': this library is unlikely to be stabilized in its current form or name (see issue #27783)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/lib.rs:20:1
   |
20 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/lib.rs:23:39
   |
23 | #[doc(hidden)] pub use self::future::{Future, FusedFuture, TryFuture};
   |                                       ^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:5:18
  |
5 | use core::task::{Context, Poll};
  |                  ^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:5:27
  |
5 | use core::task::{Context, Poll};
  |                           ^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:7:9
  |
7 | pub use core::future::Future;
  |         ^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:12:55
   |
12 | pub type BoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + Send + 'a>>;
   |                                                       ^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:16:60
   |
16 | pub type LocalBoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + 'a>>;
   |                                                            ^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:26:24
   |
26 | pub trait FusedFuture: Future {
   |                        ^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:57:22
   |
57 | pub trait TryFuture: Future + private_try_future::Sealed {
   |                      ^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:76:23
   |
76 |     where F: ?Sized + Future<Output = Result<T, E>>
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:71:18
   |
71 |         cx: &mut Context<'_>,
   |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:72:10
   |
72 |     ) -> Poll<Result<Self::Ok, Self::Error>>;
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:82:48
   |
82 |     fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> {
   |                                                ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:82:64
   |
82 |     fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> {
   |                                                                ^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:48:9
   |
48 |     use super::Future;
   |         ^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:52:50
   |
52 |     impl<F, T, E> Sealed for F where F: ?Sized + Future<Output = Result<T, E>> {}
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:5:18
  |
5 | use core::task::{Context, Poll};
  |                  ^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:5:27
  |
5 | use core::task::{Context, Poll};
  |                           ^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:60:18
   |
60 |         cx: &mut Context<'_>,
   |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:61:10
   |
61 |     ) -> Poll<Option<Self::Item>>;
   |          ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:180:53
    |
180 |     fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>)
    |                                                     ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:181:12
    |
181 |         -> Poll<Option<Result<Self::Ok, Self::Error>>>;
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:100:18
    |
100 |         cx: &mut Context<'_>,
    |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:101:10
    |
101 |     ) -> Poll<Option<Self::Item>> {
    |          ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:119:18
    |
119 |         cx: &mut Context<'_>,
    |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:120:10
    |
120 |     ) -> Poll<Option<Self::Item>> {
    |          ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:190:53
    |
190 |     fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>)
    |                                                     ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:191:12
    |
191 |         -> Poll<Option<Result<Self::Ok, Self::Error>>>
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:207:22
    |
207 |             cx: &mut Context<'_>,
    |                      ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:208:14
    |
208 |         ) -> Poll<Option<Self::Item>> {
    |              ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:223:22
    |
223 |             cx: &mut Context<'_>,
    |                      ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:224:14
    |
224 |         ) -> Poll<Option<S::Item>> {
    |              ^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:22
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                      ^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:31
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                               ^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:37
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                                     ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:44
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                                            ^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:54
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                                                      ^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:5:5
  |
5 | use core::task::Waker;
  |     ^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:91:30
   |
91 |     waker: UnsafeCell<Option<Waker>>,
   |                              ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:203:29
    |
203 |         impl AssertSync for Waker {}
    |                             ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:261:36
    |
261 |     pub fn register(&self, waker: &Waker) {
    |                                    ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:367:34
    |
367 |     pub fn take(&self) -> Option<Waker> {
    |                                  ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:12:62
   |
12 | pub type BoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + Send + 'a>>;
   |                                                              ^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:16:67
   |
16 | pub type LocalBoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + 'a>>;
   |                                                                   ^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:76:30
   |
76 |     where F: ?Sized + Future<Output = Result<T, E>>
   |                              ^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:82:69
   |
82 |     fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> {
   |                                                                     ^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:52:57
   |
52 |     impl<F, T, E> Sealed for F where F: ?Sized + Future<Output = Result<T, E>> {}
   |                                                         ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 47 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `futures-core`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `bandwhich v0.6.0`, intermediate artifacts can be found at `/var/folders/c3/_vqf4nt528j4c1f51y9bzgbh0000gn/T/cargo-installMsowo9`

Caused by:
  build failed
 x202436  MRKMLT-G1ENHV2H  ⎈ gke_silver-rain-172214_us-east4-a_echemcloud-webapp01-ue4a  5.92  ~  repos  1m 37s 
$ cargo install bandwhich
    Updating crates.io index
  Installing bandwhich v0.6.0
   Compiling log v0.4.8
   Compiling libc v0.2.65
   Compiling proc-macro2 v1.0.6
   Compiling cfg-if v0.1.9
   Compiling memchr v2.2.1
   Compiling unicode-xid v0.2.0
   Compiling rustc-serialize v0.3.24
   Compiling syn v1.0.8
   Compiling unicode-xid v0.0.3
   Compiling term v0.4.6
   Compiling bitflags v0.5.0
   Compiling maybe-uninit v2.0.0
   Compiling lazy_static v1.4.0
   Compiling regex v0.2.11
   Compiling ucd-util v0.1.5
   Compiling cc v1.0.47
   Compiling proc-macro-nested v0.1.3
   Compiling utf8-ranges v1.0.4
   Compiling getrandom v0.1.13
   Compiling futures-core v0.3.1
error[E0658]: use of unstable library feature 'alloc': this library is unlikely to be stabilized in its current form or name (see issue #27783)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/lib.rs:20:1
   |
20 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/lib.rs:23:39
   |
23 | #[doc(hidden)] pub use self::future::{Future, FusedFuture, TryFuture};
   |                                       ^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:5:18
  |
5 | use core::task::{Context, Poll};
  |                  ^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:5:27
  |
5 | use core::task::{Context, Poll};
  |                           ^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:7:9
  |
7 | pub use core::future::Future;
  |         ^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:12:55
   |
12 | pub type BoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + Send + 'a>>;
   |                                                       ^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:16:60
   |
16 | pub type LocalBoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + 'a>>;
   |                                                            ^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:26:24
   |
26 | pub trait FusedFuture: Future {
   |                        ^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:57:22
   |
57 | pub trait TryFuture: Future + private_try_future::Sealed {
   |                      ^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:76:23
   |
76 |     where F: ?Sized + Future<Output = Result<T, E>>
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:71:18
   |
71 |         cx: &mut Context<'_>,
   |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:72:10
   |
72 |     ) -> Poll<Result<Self::Ok, Self::Error>>;
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:82:48
   |
82 |     fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> {
   |                                                ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:82:64
   |
82 |     fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> {
   |                                                                ^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:48:9
   |
48 |     use super::Future;
   |         ^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:52:50
   |
52 |     impl<F, T, E> Sealed for F where F: ?Sized + Future<Output = Result<T, E>> {}
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:5:18
  |
5 | use core::task::{Context, Poll};
  |                  ^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:5:27
  |
5 | use core::task::{Context, Poll};
  |                           ^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:60:18
   |
60 |         cx: &mut Context<'_>,
   |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:61:10
   |
61 |     ) -> Poll<Option<Self::Item>>;
   |          ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:180:53
    |
180 |     fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>)
    |                                                     ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:181:12
    |
181 |         -> Poll<Option<Result<Self::Ok, Self::Error>>>;
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:100:18
    |
100 |         cx: &mut Context<'_>,
    |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:101:10
    |
101 |     ) -> Poll<Option<Self::Item>> {
    |          ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:119:18
    |
119 |         cx: &mut Context<'_>,
    |                  ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:120:10
    |
120 |     ) -> Poll<Option<Self::Item>> {
    |          ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:190:53
    |
190 |     fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>)
    |                                                     ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:191:12
    |
191 |         -> Poll<Option<Result<Self::Ok, Self::Error>>>
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:207:22
    |
207 |             cx: &mut Context<'_>,
    |                      ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:208:14
    |
208 |         ) -> Poll<Option<Self::Item>> {
    |              ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:223:22
    |
223 |             cx: &mut Context<'_>,
    |                      ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/stream.rs:224:14
    |
224 |         ) -> Poll<Option<S::Item>> {
    |              ^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:22
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                      ^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:31
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                               ^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:37
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                                     ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:44
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                                            ^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/mod.rs:9:54
  |
9 | pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
  |                                                      ^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
 --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:5:5
  |
5 | use core::task::Waker;
  |     ^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:91:30
   |
91 |     waker: UnsafeCell<Option<Waker>>,
   |                              ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:203:29
    |
203 |         impl AssertSync for Waker {}
    |                             ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:261:36
    |
261 |     pub fn register(&self, waker: &Waker) {
    |                                    ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
   --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/task/__internal/atomic_waker.rs:367:34
    |
367 |     pub fn take(&self) -> Option<Waker> {
    |                                  ^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:12:62
   |
12 | pub type BoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + Send + 'a>>;
   |                                                              ^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:16:67
   |
16 | pub type LocalBoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + 'a>>;
   |                                                                   ^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:76:30
   |
76 |     where F: ?Sized + Future<Output = Result<T, E>>
   |                              ^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:82:69
   |
82 |     fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<F::Output> {
   |                                                                     ^^^^^^^^^

error[E0658]: use of unstable library feature 'futures_api': futures in libcore are unstable (see issue #50547)
  --> /Users/x202436/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.1/src/future.rs:52:57
   |
52 |     impl<F, T, E> Sealed for F where F: ?Sized + Future<Output = Result<T, E>> {}
   |                                                         ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 47 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `futures-core`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `bandwhich v0.6.0`, intermediate artifacts can be found at `/var/folders/c3/_vqf4nt528j4c1f51y9bzgbh0000gn/T/cargo-installu6IuXi`

Caused by:
  build failed

failed to build on macos 10.12

Some errors occurred: E0432, E0658.
For more information about an error, try `rustc --explain E0432`.
error: Could not compile `futures-core`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `bandwhich v0.6.0`, intermediate artifacts can be found at `/var/folders/37/jbt828fj49932z8nspl09nc00000gn/T/cargo-installz0gwr1`

crate compile error linux

TL;DR: Updating rust compiler/cargo solves this

Hi,

when I do cargo install what --locked I get the following build error:

error: `core::slice::<impl [T]>::len` is not yet stable as a const fn
   --> /home/clem/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.0/src/bytes.rs:121:18
    |
121 |             len: bytes.len(),
    |                  ^^^^^^^^^^^

   Compiling adler32 v1.0.4
error: aborting due to previous error

error: Could not compile `bytes`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `what v0.5.1`, intermediate artifacts can be found at `/tmp/cargo-installtgWeyI`

Caused by:
  build failed

I guess this is not a problem on your end, but since 1. I'm a rust noob and 2. this is the suggested way of installing what I raise this issue here.

I'm on Ubuntu 18.04.3 with cargo 1.37.0.

[Feature] Pause display with space

When the user presses space, we will pause the application - leaving what's on the screen so that they can read it with ease. Pressing space again should resume bandwhich.

While bandwhich is paused, it would be nice to have a visual indication for this: bonus points if it's noticeable but not annoying. :)

macOS: Failed to listen on network interface

Hi,

~ /Users/grishy/.cargo/bin/what
Error: Failed to listen on network interface: Device not configured (os error 6)

it works, but nothing happens

~ /Users/grishy/.cargo/bin/what -i en0

image

what v0.5.1

Bandwhich does not compile on Ubuntu 18.04

Bandwhich does not compile on Ubuntu 18.04. There is a problem in a library.

$ git clone https://github.com/imsnif/bandwhich.git
$ cd bandwich
$ sudo cargo run
...
Compiling linked-hash-map v0.5.2
error: ``core::slice::<impl [T]>::len`` is not yet stable as a const fn
--> $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.0/src/bytes.rs:121:18
|
121 | len: bytes.len(),
| ^^^^^^^^^^^

Installation to `~/.cargo/bin/what` prevents `sudo` usage

what should be run with root privileges on my Ubuntu 16.04 box.
But, cargo install what, as stated in the README installs to ~/.cargo/bin/what by default.
That means sudo what comes back with sudo: what: command not found.

Easily fixed with a symlink or by passing cargo some extra args maybe, but good to put in the README if that is the best solution.

FreeBSD port

Building on FreeBSD results in this error as there is no os module implementation for it.

error[E0432]: unresolved import `os::get_input`
  --> src/main.rs:55:9
   |
55 |     use os::get_input;
   |         ^^^^^^^^^^^^^ no `get_input` in `os`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `what`.

E2E tests

At the moment, the tests run separately from the OS implementation. It would be nice to find a way to test the OS implementation as well.

Wrong bandwidth calculation when listening on all interfaces

When using the -i flag, the bandwidth is calculated correctly, however when listening on all interfaces (current default behaviour) it seems like a lot of packets are lost and not counted.

To reproduce: download something large (eg. a linux distribution) and look at the bandwidth indication. Start what while listening on all interfaces - forme, the bandwidth indication on the download reads ~5MBps and in what it reads as ~100KBps. When using the -i flag, this doesn't happen.

@ebroto - do you feel like taking a look, or shall I? My suspicion is that this has to do with the for loop listening to interfaces, but it's just a guess. :)

Faster DNS resolution

Right now we use just 1 background thread to resolve IPs into their hostnames with reverse dns. We could benefit from using a thread pool and doing this much quicker.

In the UI, calculate bandwidth for the past N seconds rather than just 1

Right now, the UI works by looping every second, displaying the bandwidth utilization and then clearing it. This gives us an accurate and no-fuss bandwidth-per-second display, but also provides for a less-than-ideal user experience, since utilization information can flicker in and out if it is short lived.

A possible solution would be to log the bandwidth utilization for the past N seconds* and then average it out in each display loop iteration.

Note that raw_mode should still work the same (displaying just what happened in the past 1 second).

*I wouldn't want N to be configurable, but I'm not sure what it should be - my gut says 10 but I think it should be tested to see what looks best

Feature: Integrate with Trust to supply prebuilt binaries

Using Trust or Github Actions to do some of the 'chores' would be nice and help streamline the process. It seems they are discussing a Github Actions port which would make integration even simpler.

Doing this or something hacky like this with GoReleaser can automate all of the Homebrew/Snapcraft/Docker stuff.

Windows port

This would involve creating an os/windows.rs file that would provide a similar interface to the ones provided by os/linux.rs and os/macos.rs. I'd be happy to provide guidance if needed.

No traffic shown on some macs

This is 9d93d34 on macOS 10.14.6
bandwhich starts but shows no traffic.
sudo /Users/diver/.cargo/bin/bandwhich

Screenshot 2019-12-31 at 13 07 14

sudo /Users/diver/.cargo/bin/bandwhich -i en0 shows the same.

List of interfaces:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
EHC26: flags=0<> mtu 0
XHC20: flags=0<> mtu 0
EHC29: flags=0<> mtu 0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
vmnet8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

Fix clippy warnings

As discussed in #12, there are some clippy warnings that need fixing.

Maybe a clippy pass could be added in the CI to avoid this popping up again?

Support IPv6

Great tool! Noticed ipv6 traffic is not being reported by the tool

Using the compiled binary release 0.6.0

# uname -a
Linux docker-compose 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 30 14:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)

# ./bandwhich --version
bandwhich 0.6.0

Test/reproduce issue
wget -6 http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso
wget -4 http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso

error: Utf8Error

[os] mac os x catalina 10.15.1
[terminal] iTerm2
[shell] zsh
[bandwhich version] 0.6.0

when I run
$sudo bandwhich -i en0
get this error

error: Utf8Error { valid_up_to: 94056, error_len: Some(2) } }', src/libcore/result.rs:1165:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace.

Add to Homebrew

Now that what supports MacOS, it would be nice to add it to brew for an easier installation.

Panic with error: IoErrorWrapper { path: "/proc/net/udp", inner: None }

I'm getting an error a few second after startup:

'display_handler' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Custom { kind: Other, error: IoErrorWrapper { path: "/proc/net/udp", inner: None } }, Some("/proc/net/udp"))', src/libcore/result.rs:1165:5

Full log with RUST_BACKTRACE=full (indentation is messed up): https://pastebin.com/raw/qGVpSjG0

Environment: Ubuntu 18.04 AMD64, up to date, with the 0.7.0 musl binary.

EDIT: /proc/net/udp exists and is readable.

Listen on all interfaces

what now listens on the interface given by the -i flag. The default behaviour should probably be "listen on all interfaces", with the -i flag being an optional override.

Things that are needed to do this:

  1. The OS layer (eg. os/linux.rs) needs to be adjusted.
  2. The OsInputOutput struct needs to be adjusted to get multiple network interfaces.
  3. The UI needs to be adjusted to display the name of the local interface where relevant (mostly in the connections table). Maybe something like <eth0>:12345 => 1.1.1.1:54321 shrug emoji

error: display_handler panic on launch

Immediately after launching, the following error shows up.

thread 'display_handler' panicked at 'overflow when subtracting durations', src/libcore/option.rs:1185:5

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any', src/libcore/result.rs:1165:5

Display the monitored interface and (if available) name [enhancement]

It would be helpful if the UI showed the interface that's being monitored, and if possible, the name. This is especially useful when monitoring multiple interfaces at the same time.

e.g. on macOS I have these:

❯ networksetup -listallhardwareports

Hardware Port: Wi-Fi
Device: en0

Hardware Port: USB 10/100/1000 LAN
Device: en7

Maybe add it before the "Total Rate Up/Down" on the first line?

image

I would think that it would be preferred to be shown by default and not displayed through a command line switch.

If I had any experience with Rust I'd give it a go myself, but I unfortunately don't. I suspect that with the cross-platform nature of what it would require platform-specific processes to retrieve the interface name. However, given that the monitored interface (e.g. en0) is known, that could be displayed fairly easily?

Thanks!

Package and distribute for Ubuntu

I'd be very interested if someone would be willing to take this up. The current path of building through cargo is not a very friendly one.

Not showing all traffic (only ipv4)

I tried generating a lot of network traffic with wget https://speed.hetzner.de/10GB.bin -O /dev/null and to my surprise sudo ./what -i eth0 does not show any traffic. I double checked the interface with sudo \nethogs eth0 and the traffic is displayed there. Is this by design? Am I doing something wrong?

Better error handling when accessing network interface

Right now this function:

fn get_datalink_channel(

Uses std::io::Error, probably not as it was intended, in order to differentiate between a permission error, a general network error and an unknown interface type (one that libpnet does not support).

It would be nice if we had our own error type for this, that would allow us to have the same functionality we have now (alerting the user that they need more permissions, recommending they run with sudo, or indicating that it could not find any interfaces to listen on).

This pattern might be a good option, though I'm not 100% sure it will fit in this case: https://rust-lang-nursery.github.io/failure/error-errorkind.html

Show the traffic history (bytes), do not clear UI

I'd like to start bandwhich in a special mode that keeps past connections in the UI and lists the bytes up/down by Remote address and Process name. Something closer to the wireshark UI or this iftop cli but for bytes transferred.

I want to see everything scroll past and get bumped out of the UI panel(s) as it reaches the bottom of the panel. So I could look and see the number of bytes uploaded/downloaded by process and remote address.

Or see the traffic sorted by bytes received and only show the top 10 or some reasonable default.

I.g. on linux

$ sudo bandwhich --bytemode

Remote Address
remote | bytes rec | bytes sent
----------------------------------------
some-ec2      123             100
some-host    1204           190

Process Name
process | bytes rec | bytes sent
----------------------------------------
firefox      123             100
chrome    1204           190

In a similar vein to this issue, but introducing an entirely new use: #14

Shared os behaviour

There are some functions in os/linux.rs and os/macos.rs that are identical. It would be great if we could have a shared.rs file that exposes them and then use them from there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.