philiprehberger-net-scanner
LAN device discovery and TCP port scanning.
Installation
pip install philiprehberger-net-scanner
Usage
Network Discovery
from philiprehberger_net_scanner import scan_network
devices = scan_network("192.168.1.0/24", timeout=2.0)
for device in devices:
print(f"{device.ip} - {device.hostname or 'unknown'} ({device.response_time_ms:.1f}ms)")
Port Scanning
from philiprehberger_net_scanner import scan_ports
# Scan common ports
ports = scan_ports("192.168.1.1", ports="common")
for port in ports:
print(f"Port {port.number}: {port.state} ({port.service})")
# Scan specific range
ports = scan_ports("192.168.1.1", ports=range(1, 1024), timeout=0.5)
# Scan specific ports
ports = scan_ports("192.168.1.1", ports=[22, 80, 443, 3306, 5432])
Single port check
from philiprehberger_net_scanner import is_port_open
if is_port_open("example.com", 443, timeout=1.0):
print("HTTPS is reachable")
Async Port Scanning
import asyncio
from philiprehberger_net_scanner import async_scan_ports
ports = asyncio.run(async_scan_ports("192.168.1.1", ports=range(1, 65536), timeout=0.5))
API
| Function / Class | Description |
|---|---|
scan_network(cidr, timeout=1.0, max_workers=64, resolve_hostnames=True) |
Discover devices on a network using TCP connect probes |
scan_ports(host, ports="common", timeout=1.0, max_workers=128) |
Scan TCP ports on a host ("common", range, or list[int]) |
async_scan_ports(host, ports="common", timeout=1.0, concurrency=128) |
Asyncio-based version of scan_ports |
is_port_open(host, port, timeout=1.0) |
One-off boolean check for a single TCP port |
Device |
Discovered host: ip, hostname, mac, response_time_ms |
PortResult |
Scan result: number, state ("open"/"closed"/"filtered"), service |
Development
pip install -e .
python -m pytest tests/ -v
Support
If you find this project useful:
License
Metadata
Release files for philiprehberger-net-scanner 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| philiprehberger_net_scanner-0.2.0.tar.gz | 7.6 kB | Without provenance | Details for philiprehberger_net_scanner-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| philiprehberger_net_scanner-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for philiprehberger_net_scanner-0.2.0-py3-none-any.whl |
Total release size: 13.8 kB
Release files / philiprehberger_net_scanner-0.2.0.tar.gz
| Download URL | philiprehberger_net_scanner-0.2.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c732012733e7b9fa902efad5ead7cd8bcefb9de41a75d248df871cf67e6cc8f1
|
|
BLAKE2b-256 checksum How to use checksums |
a17eab4462efb310073376ae3ac5381f2e1fd862c25c06031a374eab52899ef5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / philiprehberger_net_scanner-0.2.0-py3-none-any.whl
| Download URL | philiprehberger_net_scanner-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
881a6a2e88d0dcb7caa4856c57e704f03d9ed140b90fca8f5e13cbd20f564d64
|
|
BLAKE2b-256 checksum How to use checksums |
0ad6a817d0a38c48675fa161e2839aed9d2c4eb8e8017ffa314e09ef801d013f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for philiprehberger-net-scanner 0.2.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.