Skip to main content

PingSubnet

https://readthedocs.org/projects/pingsubnet/badge/

A Python script that will detect network adapters and ping every potential IPv4 address in the subnet.

If more than one network adapter is present, it will attempt to determine if any are invalid (possessing a loopback or self-assigned address) and present the user with a list of adapters to choose from.

The output is printed to the screen in tab-separated format (TSV) with a header row. This makes it easy to import into a spreadsheet or database.

Here is a (partially sanitized) example run:

Starting PingSubnet at 2024-12-31 23:59:59

Network Interfaces Detected:
  0 - Ethernet - 192.168.42.200
  1 - Ethernet 2 - 192.168.56.1
Enter the number to the left of your selection (or 'x' to exit): 0

Detected properties:
  Windows operating system
  interface name: Ethernet
  local hostname: NunYa
  local IP address: 192.168.42.200
  local network mask: 255.255.255.0
  local MAC address: 00:01:02:AA:BB:C8

Pinging addresses from 192.168.42.0 to 192.168.42.255

Threading 254 pings, pinging each host 3 times, and using a timeout of 5000 milliseconds...
Starting all threads...
Waiting for all threads to finish...

All online host IP and MAC addresses:
IP  MAC     Hostname        Ping    ping unit
192.168.42.1        00:01:02:AA:BB:01               1.6     ms
192.168.42.2        00:01:02:AA:BB:02               5.5     ms
192.168.42.3        00:01:02:AA:BB:03       homeassistant   1.6     ms
192.168.42.4        00:01:02:AA:BB:04       pi.hole 1.1     ms
(truncated for brevity)
192.168.42.200      00:01:02:AA:BB:C8       NunYa   12.5    ms

44 out of 254 hosts responded to a ping within 5.0 seconds.
Scanning took 12.22 seconds.

Goodbye from PingSubnet

In that example you will see the first two devices did not return a hostname. I still haven’t figured out why the socket library can sometimes detect the hostname and sometimes cannot. If anyone knows, tell me, so I can update this code (or update my DHCP server) to better handle hostnames.

Documentation

For detailed information on how to install and use this tool, please refer to the official documentation.

https://www.codefactor.io/repository/github/adamjhowell/pingsubnet/badge

Release files for pingsubnet 0.1.1

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

Source distribution (sdist)

Source distribution for pingsubnet 0.1.1
File Size Uploaded
pingsubnet-0.1.1.tar.gz 9.9 kB Details

Built distribution (wheel)

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

Total release size: 19.4 kB

Release files / pingsubnet-0.1.1.tar.gz

Download URL pingsubnet-0.1.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
46f32cf4fa6f8ca7e1e2783a9e8a8cf702e8b4be46f3484d98ae7388e8b4da5a
BLAKE2b-256 checksum
How to use checksums
d497c3386c22486a515d59d6e6a8c6af83a31f504308e321b300b0024dd5b334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release files / pingsubnet-0.1.1-py3-none-any.whl

Download URL pingsubnet-0.1.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9a74a742acbd7923d131894cd6036b879b337223a49c5aeec3335e6093117bd
BLAKE2b-256 checksum
How to use checksums
32969efd8556843bfea455777ec280126241d1857e50fdee62bd471882b88dc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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