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 binaryvotes=defaultdict(int)forarchinall_arches:regexes=set()ifnotarch.function_prologs:continue# TODO: BoyScout does not support Thumb-only / Cortex-M binaries yet.forins_regexinset(arch.function_prologs).union(arch.function_epilogs):r=re.compile(ins_regex)regexes.add(r)forstart_,datainself.project.loader.main_object.memory.backers():forregexinregexes:# Match them!formoinregex.finditer(data):position=mo.start()+start_ifposition%arch.instruction_alignment==0:ifis_arm_arch(arch):votes[("ARM",arch.memory_endness)]+=1else:votes[(arch.name,arch.memory_endness)]+=1l.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)fork,vinvotes.items()],key=lambdax:x[2],reverse=True)[0]ifhits<self.cookiesize*2:# this cannot possibly be codearch_name="DATA"endianness=""self.arch=arch_nameself.endianness=endianness# Save it as well for debuggingself.votes=votesl.debug("The architecture should be %s with %s",self.arch,self.endianness)