Module: tools/devices_info

class tools.devices_info.DeviceInfo(ip, alias, hostname)

Bases: object

A class to represent information about network devices.

Variables:
  • ip (str) – The IP address of the device.

  • alias (str) – An optional alias for the device.

  • hostname (str) – The hostname of the device.

  • port (list) – A list of open ports on the device.

addDevice(alias, hostname)

Adds a new device to the list of known devices.

Parameters:
  • ip (str) – The IP address of the device.

  • alias (str) – An alias for the device.

  • hostname (str) – The hostname of the device.

getDevice()

Returns the device with the given alias or IP address.

Parameters:

val (str) – The alias or IP address of the device to retrieve.

Returns:

The device with the given alias or IP address, or None if not found.

Return type:

DeviceInfo

matchPorts()

Returns a string containing open ports along with the matching service usually opened on that port

Returns:

A string containing open ports usage information

Return type:

str