LAN device discovery and TCP port scanning
Project description
philiprehberger-net-scanner
LAN device discovery and TCP port scanning.
Install
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])
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
scan_network(cidr, timeout?, max_workers?, resolve_hostnames?) -> list[Device]
Discover devices on a network using TCP connect probes.
scan_ports(host, ports?, timeout?, max_workers?) -> list[PortResult]
Scan TCP ports on a host. ports can be "common", a range, or a list[int].
async_scan_ports(host, ports?, timeout?, concurrency?) -> list[PortResult]
Async version using asyncio for high-performance scanning.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file philiprehberger_net_scanner-0.1.0.tar.gz.
File metadata
- Download URL: philiprehberger_net_scanner-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5c72d669379d13bb8e0b8ef1729a9d8f9064d9f1e68c209998d421afb0493a
|
|
| MD5 |
89041139b8c7307fbe0371ca7be906bd
|
|
| BLAKE2b-256 |
deae13f0103e35138a13e7cf48795c714d70053c3a974d33c4c966f308def7e3
|
File details
Details for the file philiprehberger_net_scanner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: philiprehberger_net_scanner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d34447290d4c956b3e61ef501a7bb4ab3cec695a3284b2513408069b517dab07
|
|
| MD5 |
d358a24a9eabedc16d65b48358935977
|
|
| BLAKE2b-256 |
926304b613f39e4a0e2a085b4a5cd3cc609d555fc3161142dc0e2ccbdcea1d7f
|