def RemoveOfflines(_sharedict): hosts = frozenset(_sharedict.keys()) online = set() for item in scan_all_hosts([_sharedict[host].ConnectInfo() for host in hosts]): online |= self.nscache(None, item[0]) for host in (hosts - online): del _sharedict[host] for host in _sharedict.keys(): if _sharedict[host].CheckScantype() is None: del _sharedict[host]
def check_online_shares(hostlist, port): iplist = frozenset([nscache(host) for host in hostlist]) hostlist = frozenset(hostlist) online = set(ip for (ip, port) in scan_all_hosts([(ip, port) for ip in iplist])) online = get_names_list(online) & hostlist return online, hostlist - online