Beispiel #1
0
 def buildDnsServers(self):
     if self.dnsServerIpList:
         # accept IPv4 addresses only
         # currently IPv6 addresses can not be assigned to any probe
         # and are not a part of reconciliation, so node CI can not be
         # created based on instance of IPv6 address
         isIPv4 = lambda ip: ip_addr.IPAddress(ip).get_version() == 4
         for dnsIpAddr in filter(isIPv4, self.dnsServerIpList):
             if ip_addr.isValidIpAddress(dnsIpAddr, filter_client_ip=True):
                 dnsHostOsh = modeling.createHostOSH(str(dnsIpAddr))
                 dnsAppOsh = modeling.createDnsOsh(str(dnsIpAddr), dnsHostOsh)
                 self.resultVector.add(dnsHostOsh)
                 self.resultVector.add(dnsAppOsh)
Beispiel #2
0
 def buildDnsServers(self):
     if self.dnsServerIpList:
         # accept IPv4 addresses only
         # currently IPv6 addresses can not be assigned to any probe
         # and are not a part of reconciliation, so node CI can not be
         # created based on instance of IPv6 address
         isIPv4 = lambda ip: ip_addr.IPAddress(ip).get_version() == 4
         for dnsIpAddr in filter(isIPv4, self.dnsServerIpList):
             if ip_addr.isValidIpAddress(dnsIpAddr, filter_client_ip=True):
                 dnsHostOsh = modeling.createHostOSH(str(dnsIpAddr))
                 dnsAppOsh = modeling.createDnsOsh(str(dnsIpAddr),
                                                   dnsHostOsh)
                 self.resultVector.add(dnsHostOsh)
                 self.resultVector.add(dnsAppOsh)
        ips = discoverer.getResults()
        if ips:
            logger.info("DNS servers: %s" % ips)
            list_ = StringVector(map(str, ips))
            attr = AttributeStateHolder('dns_servers', list_)
            hostOSH.addAttributeToList(attr)

            # accept IPv4 addresses only
            # currently IPv6 addresses can not be assigned to any probe
            # and are not a part of reconciliation, so node CI can not be
            # created based on instance of IPv6 address
            isIPv4 = lambda ip: ip_addr.IPAddress(ip).get_version() == 4
            for dnsIpAddr in filter(isIPv4, ips):
                if ip_addr.isValidIpAddress(dnsIpAddr, filter_client_ip=True):
                    dnsHostOsh = modeling.createHostOSH(str(dnsIpAddr))
                    dnsAppOsh = modeling.createDnsOsh(str(dnsIpAddr), dnsHostOsh)
                    vector.add(dnsHostOsh)
                    vector.add(dnsAppOsh)
        vector.add(hostOSH)

        #process interfaces looking for nic teaming interfaces.
        #looking up for interfaces with same mac
        macToInterfaceListMap = {}
        for interface in interfaceList:
            intList = macToInterfaceListMap.get(interface.macAddress, [])
            intList.append(interface)
            macToInterfaceListMap[interface.macAddress] = intList
        #checking if interface has a Team key word in it's name
        for ifaceList in macToInterfaceListMap.values():
            if ifaceList and len(ifaceList) < 2:
                continue