Skip to main content

pysecnet

Lightweight Python networking toolkit. Zero dependencies. Standard library only.

Installation

pip install pysecnet

Modules

subnet - Subnet Calculations

from pysecnet.subnet import cidr_to_mask, mask_to_cidr, subnet_info

cidr_to_mask(24)          # '255.255.255.0'
mask_to_cidr("255.255.255.0")  # 24
subnet_info("192.168.1.100", 24)
# {'network': '192.168.1.0', 'broadcast': '192.168.1.255',
#  'mask': '255.255.255.0', 'prefix': 24, 'usable_count': 254, ...}

port - Port Scanning

from pysecnet.port import check_port, service_name, scan_range

check_port("example.com", 80)       # True if open
service_name(443)                   # 'HTTPS'
scan_range("192.168.1.1", 1, 1024)  # [(port, service), ...]

dns - DNS Lookups

from pysecnet.dns import resolve_a, reverse_lookup, resolve

resolve_a("example.com")        # ['93.184.216.34']
reverse_lookup("8.8.8.8")       # 'dns.google'
resolve("example.com")          # '93.184.216.34'

ping - ICMP Ping

from pysecnet.ping import ping, ping_ok

result = ping("8.8.8.8")
# {'alive': True, 'avg_rtt': 12.5, 'packet_loss': 0.0, ...}

ping_ok("8.8.8.8")  # True

mac - MAC Address Utilities

from pysecnet.mac import validate, vendor, is_multicast

validate("00:11:22:aa:bb:cc")       # '00:11:22:aa:bb:cc'
vendor("00:0C:29:AA:BB:CC")         # 'VMware'
is_multicast("01:00:5E:00:00:01")   # True

http - HTTP/SSL Utilities

from pysecnet.http import get_headers, status_code, ssl_info

get_headers("https://example.com")  # {'status_code': 200, 'server': '...', ...}
status_code("https://example.com")  # 200
ssl_info("example.com")             # {'subject': '...', 'issuer': '...', ...}

utils - Validation Utilities

from pysecnet.utils import validate_ip, parse_cidr, is_private_ip

validate_ip("192.168.1.1")       # True
parse_cidr("10.0.0.0/24")        # ('10.0.0.0', 24)
is_private_ip("10.0.0.1")        # True

License

MIT

Download files

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

Source Distribution

pysecnet-1.0.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

pysecnet-1.0.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file pysecnet-1.0.0.tar.gz.

File metadata

  • Download URL: pysecnet-1.0.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pysecnet-1.0.0.tar.gz
Algorithm Hash digest
SHA256 73cd596b471976c7c80abe26a91db1fdea5462bab6da948019cfacf7455f33fe
MD5 f9f33ceec75061260143610313892364
BLAKE2b-256 45fc3bb78dbc13c2b1c635c7948f5d1b93718d1500d94d1af442ea3e5150e10a

See more details on using hashes here.

File details

Details for the file pysecnet-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pysecnet-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pysecnet-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1a49dbcd3e65b352bf3ac3a90c43fb2cf4d9403a1dc67ffd0358ee503206b74
MD5 3216d39fa063965fcf30c62ce15b1f97
BLAKE2b-256 1de4b40bc97dd8cac9297207cb32b54433cd5038e5f1838069b83277e2ddfe98

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 Sentry Error logging StatusPage Status page