invaentory

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2022 License: AGPL-3.0

README

invaentory

Quickly find all IPv6 and IPv4 hosts in a LAN.

hydrun CI Go Reference Matrix Binary Downloads

Overview

invaentory is a very fast IPv6 and IPv4 LAN scanner, with the intention of allowing the user to quickly take inventory of hosts on their network.

Installation

Static binaries are available on GitHub releases.

On Linux, you can install them like so:

$ curl -L -o /tmp/invaentory "https://github.com/pojntfx/invaentory/releases/latest/download/invaentory.linux-$(uname -m)"
$ sudo install /tmp/invaentory /usr/local/bin
$ sudo setcap cap_net_raw+ep /usr/local/bin/invaentory # This allows rootless execution

On macOS, you can use the following:

$ curl -L -o /tmp/invaentory "https://github.com/pojntfx/invaentory/releases/latest/download/invaentory.darwin-$(uname -m)"
$ sudo install /tmp/invaentory /usr/local/bin

On Windows, the following should work (using PowerShell as administrator):

PS> Invoke-WebRequest https://github.com/pojntfx/invaentory/releases/latest/download/invaentory.windows-x86_64.exe -OutFile \Windows\System32\invaentory.exe

You can find binaries for more operating systems and architectures on GitHub releases.

Usage

To take inventory of all the IPv6 and IPv4 hosts in your LAN, simply run invaentory. Note that while Linux allows for rootless execution, macOS requires the use of sudo and Windows the use of PowerShell as administrator:

$ invaentory
172.17.0.1
Pinging   7% [>                           ] (4612/65553, 200 host/s) [23s:5m4s]

Once the scan is finished, all found hosts will be listed:

$ invaentory
172.17.0.1
100.64.154.241
2001:7c7:2121:8d00:40e3:c0ea:d71c:db75
100.64.154.242
2001:7c7:2121:8d00:da47:32ff:fec9:62a0
100.64.154.244
2001:7c7:2121:8d00::3
100.64.154.243
fe80::b2a8:6eff:fe0c:ed1a%enp0s13f0u1u2u2
100.64.154.254
100.64.154.246
100.64.154.250
2001:7c7:2121:8d00:8c77:a50a:e3a9:d284
100.64.154.250
2001:7c7:2121:8d00:d125:4d82:b9f7:5a00
100.64.154.247

It is also possible to exclude certain IPs by supplying a regular expression to --exclude:

$ invaentory --exclude '100..*'
172.17.0.1
2001:7c7:2121:8d00:40e3:c0ea:d71c:db75
2001:7c7:2121:8d00:da47:32ff:fec9:62a0
2001:7c7:2121:8d00::3
fe80::b2a8:6eff:fe0c:ed1a%enp0s13f0u1u2u2
2001:7c7:2121:8d00:8c77:a50a:e3a9:d284
2001:7c7:2121:8d00:d125:4d82:b9f7:5a00

The progress bar and logging output is written to STDERR, so you can further process just the IP addresses as usual, for example to scan all the IPv6 nodes using IPv6:

$ for host in $(invaentory -4=false); do nmap -6 ${host}; done
Starting Nmap 7.91 ( https://nmap.org ) at 2022-01-15 02:42 CET
Nmap scan report for felicias-xps13 (2001:7c7:2121:8d00:40e3:c0ea:d71c:db75)
Host is up (0.000089s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds
Starting Nmap 7.91 ( https://nmap.org ) at 2022-01-15 02:42 CET
Nmap scan report for felixs-proton.user.selfnet.de (2001:7c7:2121:8d00:da47:32ff:fec9:62a0)
Host is up (0.00027s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
443/tcp  open  https
9090/tcp open  zeus-admin

Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds
Starting Nmap 7.91 ( https://nmap.org ) at 2022-01-15 02:42 CET
# ...

🚀 That's it! You can now take inventory of your network.

Be sure to check out the reference for more information.

Reference

$ invaentory --help
Usage of invaentory:
  -4    Ping using ICMPv4 (default true)
  -6    Ping using ICMPv6 (default true)
  -exclude string
        Regex of addresses to exclude
  -multicast-timeout int
        Time in milliseconds to wait for responses for multicast (IPv6) pings (default 2000)
  -parallel int
        Amount of pings to run in parallel (default 100)
  -progress
        Show progress bar on STDERR (default true)
  -unicast-timeout int
        Time in milliseconds to wait for responses for unicast (IPv4) pings (default 500)
  -verbose
        Enable verbose logging to STDERR

Acknowledgements

  • This project would not have been possible were it not for @digineo's go-ping package; be sure to check it out too!
  • All the rest of the authors who worked on the dependencies used! Thanks a lot!

Contributing

To contribute, please use the GitHub flow and follow our Code of Conduct.

To build invaentory locally, run:

$ git clone https://github.com/pojntfx/invaentory.git
$ cd invaentory
$ make depend
$ make
$ sudo setcap cap_net_raw+ep out/invaentory
$ out/invaentory

Have any questions or need help? Chat with us on Matrix!

License

invaentory (c) 2022 Felix Pojtinger and contributors

SPDX-License-Identifier: AGPL-3.0

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL