def getHOSTStatus(): fh = FritzHosts(fc) hosts = fh.get_hosts_info() activehosts = fh.get_active_hosts() print("**********************************\n") print("Overview known hosts:") print("Following %s hosts are known!\n" % (len(hosts))) print("Following %s hosts are active in your network:" % (len(activehosts))) print("IP-Address Name Status") print("---------------------------------------------------") for i in range(0, len(hosts) - 1): if hosts[i]["status"] == True: ipaddress = hosts[i]["ip"] hostname = hosts[i]["name"] hoststatus = hosts[i]["status"] print(f"{ipaddress:18} {hostname:25} - {hoststatus}")
def report_hosts(): fh = FritzHosts(address=args.ip, password=args.password) hosts = fh.get_active_hosts() return sorted((host["name"] for host in hosts), key=str.lower)