Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

philiprehberger_net_scanner-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

philiprehberger_net_scanner-0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_net_scanner-0.1.1.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_net_scanner-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fe6bce11249d93f8fd43ab98dffaf9a839e9267e5b0bed991c01c4d1809e5f54
MD5 71a075c3fc4119b7774454f24251aabc
BLAKE2b-256 72adbebec718ebfab6366d3b73f7715eb56c4240ce1c5e006f60aed78b4c46a9

See more details on using hashes here.

File details

Details for the file philiprehberger_net_scanner-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_net_scanner-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee0e758be743035291d6db26a883da4294c5e19fcd640716a8109971116a27d5
MD5 e6083f598d99ef56fa98d0f88187863f
BLAKE2b-256 ce1ef567b5d31d1a22c7a31446e4d4e04b2183db7c014a3a25796d75dd41def1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page