Welcome to NetFuse’s documentation!

——–NetFuse——–

Main

netfuse.main.parse_host_file(filepath) Dict[Union[int, str], Union[List[str], str]]

Parse the host file and convert the host entries into key-value pairs.

Parameters:

filepath – Host file that matches FQDN with server IPs hosting a specific domain.

Returns:

Returns a dictionary of parsed hosts file information.

Return type:

Dict[Union[int, str], List[str]]

netfuse.main.update_host_file(host_entries: Dict, output_file: str, dry_run: bool) None

Update the hosts entry file, with all the devices currently connected to the router.

Parameters:
  • host_entries – Data that has to be dumped into the hosts file.

  • output_file – Host file that matches FQDN with server IPs hosting a specific domain.

  • dry_run – Prints the information instead of writing to hosts file.

netfuse.main.flush_dns_cache() None

Flushes the DNS cache.

netfuse.main.dump(dry_run: bool, filepath: str, output: str, module: module) None

Dumps all devices’ hostname and IP addresses into the hosts file.

Config

class netfuse.config.Settings

Wrapper for the settings required by the module.

>>> Settings
format_key: Callable = None
os: str = 'Darwin'
etc_hosts: str = '/etc/hosts'
host_id: int = 254
flush_dns: Tuple = ()
start: float = None
router_pass = None

Errors

Custom errors for NetFuse module.

>>> Error
exception netfuse.errors.Error

Package’s base exception.

exception netfuse.errors.ValidationError

Custom validation error.

exception netfuse.errors.MissingRequirement

Custom requirement error.

Logger

Customized logger function for NetFuse module.

>>> LOGGER

——–Modules——–

At&t

netfuse.modules.att.get_network_id() str

Get network id from the current IP address.

Returns:

Network ID section of the IP address, ignoring the host ID.

Return type:

str

netfuse.modules.att.generate_dataframe()

Generate a dataframe using the devices information from router web page.

Returns:

Devices list as a data frame.

Return type:

pandas.DataFrame

netfuse.modules.att.attached_devices() Generator[Device]

Get all devices connected to the router.

Yields:

Generator[Device] – Yields each device information as a Device object.

Netgear

netfuse.modules.netgear.attached_devices()

Get all attached devices in a Netgear router.

Returns:

List of device objects.

Return type:

List[pynetgear.Device]

Squire

class netfuse.modules.squire.Device(dictionary: dict)

Convert dictionary into a device object.

>>> Device

Set dictionary keys as attributes of Device object.

Parameters:

dictionary – Takes the input dictionary as an argument.

Indices and tables