Skip to content

Oleaintueri/pyphorus

Repository files navigation

Pyphorus

GitHub GitHub tag (latest SemVer) PyPI


A small network utility library written in Python 3.

Features:

  • Port scanner
  • UPnP client (SSDP wrapper)

Build with ❤️ by

Oleaintueri is sponsoring the development and maintenance of this project within their organisation.

Getting started

Installation

pip install pyphorus

Or

pip install git+https://github.com/Oleaintueri/pyphorus.git

Usage

import pyphorus

if __name__ == "__main__":
    phorus = pyphorus.Pyphorus()
    devices = phorus.scan_ports("192.168.0.1", ports=[80, 443, 9000], only_open=True)
    
    for device in devices:
        print(device.ip, device.port)
    
    # get all devices with ssdp:all
    devices = phorus.scan_upnp("upnp:rootdevice")
    
    for device in devices:
        print(device.ip, device.friendly_name, device.device_type)
    
    # if you want only the unique ips to remain and are not interested in the ports
    unique_devices = pyphorus.utils.strip_duplicate_ips(devices)

Testing

Pyphorus uses nose to run its tests and mock testing server.

nosetests -v