Skip to main content

Layer 2 Network Neighbourhood Discovery Tool

Checks Python 3.12+ License: GPL v2

Easily detect hosts on your local network by sending ARP pings. For additional information, see this Stack Overflow question.

Dependencies

  • Python 3.12+ (development uses Python 3.14)
  • scapy for networking functions like arping

Installation and Usage

Install from PyPI into a virtual environment:

python3 -m venv .venv
.venv/bin/python -m pip install neighbourhood
sudo .venv/bin/neighbourhood --no-resolve

On Windows, use .venv\Scripts\python.exe and .venv\Scripts\neighbourhood.exe instead, from an Administrator terminal (see below for Npcap).

When scapy is installed as system library, simply run:

$ sudo ./neighbourhood.py [-i <interface>]

Alternatively, you can use uv:

$ uv sync
$ sudo .venv/bin/python neighbourhood.py [-i <interface>]

Only directly connected IPv4 networks are scanned; routes through gateways are skipped. Each network is scanned once per interface. By default, Docker, bridge (br-), and tunnel (tun) interfaces are skipped; select one explicitly with -i to include it. Unknown interfaces produce an error with exit code 2. On Linux, interfaces without Ethernet framing or with the NOARP flag are skipped even when explicitly selected, since they cannot perform this ARP scan. Routes whose source IPv4 address is outside the destination subnet are skipped with a warning. For example, a 169.254.0.0/16 route with source address 192.168.1.10 is not scanned. Valid link-local networks are still scanned when the source address belongs to them; subnet sizes are taken from the routing table.

Use --timeout SECONDS to set the ARP response timeout (default: 5 seconds) and --no-resolve to skip reverse-DNS hostname lookups:

sudo .venv/bin/python neighbourhood.py -i eth0 --timeout 2 --no-resolve

The timeout applies to ARP responses, not DNS lookups or the total runtime. Run uv run neighbourhood.py --help to see all options without root privileges.

Failed scans are reported while remaining targets are still attempted; the program exits with status 1 if any scan fails.

Windows

Install Npcap for Scapy's packet capture and transmission support. In PowerShell, install dependencies with uv sync, then run the script from a PowerShell window opened as Administrator:

uv run neighbourhood.py [-i <interface>]

The permission check supports Windows, but a complete ARP scan on Windows has not yet been verified on a real network.

Development

Install development dependencies with uv sync --locked, then run:

uv run --locked ruff check .
uv run --locked ruff format --check .
uv run --locked ty check --error-on-warning
uv run --locked python -m pytest
uv run --locked python neighbourhood.py --help

GitHub Actions runs these checks on Linux and Windows with Python 3.12, 3.13, and 3.14 for pushes and pull requests. pytest covers both permission-check branches with simulated identities, verifies rejection before scanning, and calls the real permission API of the runner's OS. Routing tests use simulated tables to check network selection, duplicate targets, and interface validation. The smoke test only displays help.

CI does not perform ARP scans or validate Npcap installation. A complete Windows scan needs a separate integration test on a machine with Npcap and a known peer on the same local network.

TODO

  • IPv6 support

Metadata

Release files for neighbourhood 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neighbourhood 1.0.0
File Size Uploaded Provenance Actions
neighbourhood-1.0.0.tar.gz 16.4 kB Without provenance Details for neighbourhood-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neighbourhood 1.0.0
File Interpreter ABI Platform Actions
neighbourhood-1.0.0-py3-none-any.whl Python 3 none any Details for neighbourhood-1.0.0-py3-none-any.whl

Total release size: 29.2 kB

Release files / neighbourhood-1.0.0.tar.gz

Download URL neighbourhood-1.0.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5dd6eaef7afdc732a9ea5b9e006322add6982f63daf8b00dc9d64d8af0ad077a
BLAKE2b-256 checksum
How to use checksums
0a343fb8ea87cbf3754994cdab9448f99e102a9ee278fc5b84f25dafbeb3403b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / neighbourhood-1.0.0-py3-none-any.whl

Download URL neighbourhood-1.0.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
446b7a23982b04b3bf69503356c4a0333a74e9643a376d538ba8ed978f335bcc
BLAKE2b-256 checksum
How to use checksums
59125124ecfebffce5b43178a8f6599ae5cfc32aee910a2064785e002d055245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for neighbourhood 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page