angr/analyses/boyscout.py
def _reconnoiter(self):
        """
        The implementation here is simple - just perform a pattern matching of all different architectures we support,
        and then perform a vote.
        """
        # Retrieve the binary string of main binary
        votes = defaultdict(int)

        for arch in all_arches:
            regexes = set()
            if not arch.function_prologs:
                continue
            # TODO: BoyScout does not support Thumb-only / Cortex-M binaries yet.

            for ins_regex in set(arch.function_prologs).union(arch.function_epilogs):
                r = re.compile(ins_regex)
                regexes.add(r)

            for start_, data in self.project.loader.main_object.memory.backers():
                for regex in regexes:
                    # Match them!
                    for mo in regex.finditer(data):
                        position = mo.start() + start_
                        if position % arch.instruction_alignment == 0:
                            votes[(arch.name, arch.memory_endness)] += 1

            l.debug("%s %s hits %d times", arch.name, arch.memory_endness,
                    votes[(arch.name, arch.memory_endness)])

        arch_name, endianness, hits = sorted([(k[0], k[1], v) for k, v in votes.items()], key=lambda x: x[2], reverse=True)[0]

        if hits < self.cookiesize * 2:
        # this cannot possibly be code
            arch_name = "DATA"
            endianness = ""

        self.arch = arch_name
        self.endianness = endianness
        # Save it as well for debugging
        self.votes = votes

        l.debug("The architecture should be %s with %s", self.arch, self.endianness)

        The implementation here is simple - just perform a pattern matching of all different architectures we support,
        and then perform a vote.
        
The implementation here is simple - just perform a pattern matching of all different architectures we support,
and then perform a vote.
The implementation here is simple - just perform a pattern matching of all different architectures we support and then perform a vote .
def _reconnoiter(self):
        votes = defaultdict(int)
        for arch in all_arches:
            regexes = set()
            if not arch.function_prologs:
                continue
            for ins_regex in set(arch.function_prologs).union(arch.function_epilogs):
                r = re.compile(ins_regex)
                regexes.add(r)
            for start_, data in self.project.loader.main_object.memory.backers():
                for regex in regexes:
                    for mo in regex.finditer(data):
                        position = mo.start() + start_
                        if position % arch.instruction_alignment == 0:
                            votes[(arch.name, arch.memory_endness)] += 1
            l.debug("%s %s hits %d times", arch.name, arch.memory_endness,
                    votes[(arch.name, arch.memory_endness)])
        arch_name, endianness, hits = sorted([(k[0], k[1], v) for k, v in votes.items()], key=lambda x: x[2], reverse=True)[0]
        if hits < self.cookiesize * 2:
            arch_name = "DATA"
            endianness = ""
        self.arch = arch_name
        self.endianness = endianness
        self.votes = votes
        l.debug("The architecture should be %s with %s", self.arch, self.endianness)
def _reconnoiter ( self ) : votes = defaultdict ( int ) for arch in all_arches : regexes = set ( ) if not arch . function_prologs : continue for ins_regex in set ( arch . function_prologs ) . union ( arch . function_epilogs ) : r = re . compile ( ins_regex ) regexes . add ( r ) for start_ , data in self . project . loader . main_object . memory . backers ( ) : for regex in regexes : for mo in regex . finditer ( data ) : position = mo . start ( ) + start_ if position % arch . instruction_alignment == 0 : votes [ ( arch . name , arch . memory_endness ) ] += 1 l . debug ( "%s %s hits %d times" , arch . name , arch . memory_endness , votes [ ( arch . name , arch . memory_endness ) ] ) arch_name , endianness , hits = sorted ( [ ( k [ 0 ] , k [ 1 ] , v ) for k , v in votes . items ( ) ] , key = lambda x : x [ 2 ] , reverse = True ) [ 0 ] if hits < self . cookiesize * 2 : arch_name = "DATA" endianness = "" self . arch = arch_name self . endianness = endianness self . votes = votes l . debug ( "The architecture should be %s with %s" , self . arch , self . endianness )
The implementation here is simple - just perform a pattern matching of all different architectures we support,
and then perform a vote.
The implementation here is simple - just perform a pattern matching of all different architectures we support and then perform a vote .
"""
        The implementation here is simple - just perform a pattern matching of all different architectures we support,
        and then perform a vote.
        """ # Retrieve the binary string of main binary # TODO: BoyScout does not support Thumb-only / Cortex-M binaries yet. # Match them! # this cannot possibly be code # Save it as well for debugging
self