https://github.com/theyhaveice/network
A lightweight macOS command-line tool for resolving and scanning network devices.
https://github.com/theyhaveice/network
arp cli dns json macos mdns network networking objective-cpp xml
Last synced: 3 days ago
JSON representation
A lightweight macOS command-line tool for resolving and scanning network devices.
- Host: GitHub
- URL: https://github.com/theyhaveice/network
- Owner: theyhaveice
- License: mit
- Created: 2026-04-05T17:36:51.000Z (3 days ago)
- Default Branch: main
- Last Pushed: 2026-04-05T18:42:14.000Z (3 days ago)
- Last Synced: 2026-04-05T19:22:10.372Z (3 days ago)
- Topics: arp, cli, dns, json, macos, mdns, network, networking, objective-cpp, xml
- Language: C++
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# network
A lightweight macOS command-line tool for resolving and scanning network devices. Query a single IP, sweep a subnet, or inspect your own machine — with output in plain text, JSON, or XML.
---
## Table of Contents
- [About](#about)
- [Installation](#installation)
- [Usage](#usage)
- [Commands](#commands)
- [Flags](#flags)
- [Examples](#examples)
- [License](#license)
---
## About
`network` is a C++ command-line utility for macOS that resolves detailed information about devices on your local network. Given one or more IP addresses, a CIDR subnet, or an IP range, it probes each host and returns:
- **Hostname** — resolved via mDNS, ARP, NSHost, and `getnameinfo` (tried in order)
- **IPv4 / IPv6** addresses
- **MAC address** — from the ARP table
- **Vendor** — looked up against a local OUI database (`arp-scan`) with a fallback to the [macvendors.com](https://macvendors.com) API
- **TTL** — ARP expiry time
Results are cached to `/tmp/network_tool_cache.tsv` for one hour to keep repeated queries fast. Non-responding devices are never written to cache.
The scanner uses a concurrent thread pool (default 64 threads) to sweep subnets quickly.
> **Platform:** macOS only. The tool depends on `Foundation.framework`, `dns_sd`, and macOS-specific ARP/interface APIs.
---
## Installation
to install `network`. run this in `Terminal`
```bash
curl -fsSL "https://raw.githubusercontent.com/theyhaveice/network/main/install.sh" | sudo sh
# Downloading network v0.1.0...
# network v0.1.0 installed successfully!
# You can run it using: network
```
## Usage
```
network [command] [flags]
```
### Commands
| Command | Description |
|---|---|
| `get` | Resolve and display info for one or more IP addresses |
| `current` | Show network info for this device |
| `clear-cache` | Delete all cached device results |
| `help` | Show help |
Run `network [command] --help` for command-specific details.
---
### Flags
#### `get` — Input flags
| Flag | Description |
|---|---|
| `-ip [,...]` | One or more individual IP addresses |
| `-subnet ` | All host IPs in a CIDR subnet (e.g. `192.168.1.0/24`) |
| `-range ,` | Inclusive IP range (e.g. `192.168.1.1,192.168.1.64`) |
#### Output flags (all commands)
| Flag | Description |
|---|---|
| `-o [,...]` | Fields to display: `hostname`, `ipv4`, `ipv6`, `macaddress`, `vendor`, `ttl` |
| `--xml` | Output as XML |
| `--json` | Output as JSON |
#### Filter flags
| Flag | Description |
|---|---|
| `--R` | Include all responding devices |
| `--A` | Include every IP in the range, responding or not |
#### Cache flags
| Flag | Description |
|---|---|
| `--nocache` | Skip cache read/write for this run (always re-probe) |
---
## Examples
```bash
# Look up a single IP
network get -ip 192.168.1.1
# Look up multiple IPs, showing only hostname and IPv4 as JSON
network get -ip 192.168.1.1,192.168.1.2 -o hostname,ipv4 --json
# Scan a full subnet, showing all responding devices
network get -subnet 192.168.1.0/24 --R
# Scan an IP range and output as XML
network get -range 192.168.1.1,192.168.1.50 --xml
# Show info for the current machine
network current
# Show only the current machine's MAC address and vendor
network current -o macaddress,vendor
# Clear the on-disk cache
network clear-cache
```
---
## License
MIT License — [LICENSE](LICENSE)