Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/picatz/iface

🕶 Cross-platform network interface command-line utility.
https://github.com/picatz/iface

command-line cross-platform linux macos network windows

Last synced: 5 days ago
JSON representation

🕶 Cross-platform network interface command-line utility.

Awesome Lists containing this project

README

        

# iface
> Network interface command-line utility.

Tools like `ifconfig`, `ip` and `ipconfig` are awesome! But, sometimes they're just a little too much to parse -- or you just don't want to fuss with all of that. With `iface`, you get a clean, scriptable command-line utility that's lightweight, cross-platform, and easy to learn. Learn once, use everywhere!

## Supported Platforms

> Thanks to [`VBaczynski`](https://github.com/VBaczynski) for helping test FreeBSD!

* macOS
* Linux
* Windows
* FreeBSD

## Install

```
$ go get github.com/picatz/iface
```

## Build from Source

Until I've figured out a better solution:

```
$ go get github.com/urfave/cli
$ git clone https://github.com/picatz/iface.git
$ cd iface
$ go build iface.go
```

Build `iface.exe` on macOS or Linux to run on a Windows box:

```
$ GOOS=windows GOARCH=386 go build iface.go
```

## Example Usage

Get the first `default` ( non-[loopback](https://en.wikipedia.org/wiki/Loopback#Virtual_network_interface) ) network [interface](https://en.wikipedia.org/wiki/Network_interface):
> This sort of simulates the LibPcap [`lookupdev`](https://linux.die.net/man/3/pcap_lookupdev) function to get the default interface to capture packets on.

```
$ iface default
```

Get all of the network interface names available on the system:

```
$ iface names
```

Get network interface names with thier [mac addresses](https://en.wikipedia.org/wiki/MAC_address):

```
$ iface macs
```

Get network interface names with their [IP addresses](https://en.wikipedia.org/wiki/IP_address):

```
$ iface ips
```

## Command-line Interface

```
NAME:
iface - network interface command-line utility

USAGE:
iface [global options] command [command options] [arguments...]

VERSION:
1.0.1

COMMANDS:
names all network interface names
macs network interfaces with their mac addresses
mtus network interfaces with their maximum transmission unit (mtu)s
ips network interfaces with their (local) ip addresses
default the first non-loopback network interface
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
```