Exemplo n.º 1
0
    def _rr_history_to_domains(self, rr_history_info):
        domains = []

        for rr_history in rr_history_info:
            for rr_domain in rr_history.get('rrs', []):
                for elem in expand_domain(rr_domain['rr']):
                    domains.add(elem)

        return domains
Exemplo n.º 2
0
    def _cooccurrences_to_domains(self, cooccurrence_info):
        domains = set()

        for domain, cooccurence in cooccurrence_info.iteritems():
            for occur_domain in cooccurence.get('pfs2', []):
                for elem in expand_domain(occur_domain[0]):
                    domains.add(elem)

        return domains
Exemplo n.º 3
0
    def _cooccurrences_to_domains(self, cooccurrence_info):
        domains = []

        for cooccurence in cooccurrence_info:
            for occur_domain in cooccurence.get('pfs2', []):
                for elem in expand_domain(occur_domain[0]):
                    domains.add(elem)

        return domains
Exemplo n.º 4
0
    def _rr_history_to_domains(self, rr_history_info):
        domains = set()

        for ip, rr_history in rr_history_info.iteritems():
            for rr_domain in rr_history.get('rrs', []):
                for elem in expand_domain(rr_domain['rr']):
                    domains.add(elem)

        return domains
Exemplo n.º 5
0
    def _rr_history_to_domains(self, rr_history_info):
        domains = []

        for rr_history in rr_history_info:
            for rr_domain in rr_history.get('rrs', []):
                for elem in expand_domain(rr_domain['rr']):
                    domains.add(elem)

        return domains
Exemplo n.º 6
0
    def _cooccurrences_to_domains(self, cooccurrence_info):
        domains = []

        for cooccurence in cooccurrence_info:
            for occur_domain in cooccurence.get('pfs2', []):
                for elem in expand_domain(occur_domain[0]):
                    domains.add(elem)

        return domains
    def _add_domain(self, domain):
        """Clean a domain and store it internally"""
        if not domain:
            return

        try:
            domain = clean_domain(domain)
            for extracted in expand_domain(domain):
                self._domains.add(extracted)
        except BadDomainError:
            pass
    def _add_domain(self, domain):
        """Clean a domain and store it internally"""
        if not domain:
            return

        try:
            domain = clean_domain(domain)
            for extracted in expand_domain(domain):
                self._domains.add(extracted)
        except BadDomainError:
            pass
Exemplo n.º 9
0
    def _rr_history_to_domains(self, rr_history_info):
        """Parse the results of a call to the OpenDNS rr_history endpoint.

        Args:
            rr_history_info: Result of a call to rr_history
        Returns:
            An enumerable of domains
        """
        domains = set()

        for ip, rr_history in rr_history_info.iteritems():
            for rr_domain in rr_history.get('rrs', []):
                for elem in expand_domain(rr_domain['rr']):
                    domains.add(elem)

        return domains
Exemplo n.º 10
0
    def _cooccurrences_to_domains(self, cooccurrence_info):
        """Parse the results of a call to the OpenDNS cooccurrences endpoint.

        Args:
            cooccurrence_info: Result of a call to cooccurrences
        Returns:
            An enumerable of domains
        """
        domains = set()

        for domain, cooccurence in cooccurrence_info.iteritems():
            for occur_domain in cooccurence.get('pfs2', []):
                for elem in expand_domain(occur_domain[0]):
                    domains.add(elem)

        return domains
Exemplo n.º 11
0
    def _rr_history_to_domains(self, rr_history_info):
        """Parse the results of a call to the OpenDNS rr_history endpoint.

        Args:
            rr_history_info: Result of a call to rr_history
        Returns:
            An enumerable of domains
        """
        domains = set()

        for ip, rr_history in rr_history_info.iteritems():
            for rr_domain in rr_history.get('rrs', []):
                for elem in expand_domain(rr_domain['rr']):
                    domains.add(elem)

        return domains
Exemplo n.º 12
0
    def _cooccurrences_to_domains(self, cooccurrence_info):
        """Parse the results of a call to the OpenDNS cooccurrences endpoint.

        Args:
            cooccurrence_info: Result of a call to cooccurrences
        Returns:
            An enumerable of domains
        """
        domains = set()

        for domain, cooccurence in cooccurrence_info.iteritems():
            for occur_domain in cooccurence.get('pfs2', []):
                for elem in expand_domain(occur_domain[0]):
                    domains.add(elem)

        return domains
Exemplo n.º 13
0
 def _test_expand_domain(self, initial_domain, expected):
     expanded = list(expand_domain(initial_domain))
     T.assert_equal(sorted(expanded), sorted(expected))
Exemplo n.º 14
0
 def _test_expand_domain(self, initial_domain, expected):
     expanded = list(expand_domain(initial_domain))
     T.assert_equal(sorted(expanded), sorted(expected))
Exemplo n.º 15
0
 def _test_expand_domain(self, initial_domain, expected):
     expanded = list(expand_domain(initial_domain))
     assert sorted(expanded) == sorted(expected)