def getAngrBlackAddrs(binary): global BLACK_ADDRS e = elf.ELF(binary) for (sym, addr) in e.plt.items(): if sym in angr_black_plt: BLACK_ADDRS.add(addr)
def getNonRetFuncsFromSymbols(binary, known_non_ret): global Black_ADDRS e = elf.ELF(binary) for (sym, addr) in e.symbols.items(): if sym in KNOWN_NON_RETS: logging.debug("Adding known non-ret %s at 0x%x" % (sym, addr)) known_non_ret.add(sym) if sym in Black_LIST: Black_ADDRS.add(addr) for (sym, addr) in e.plt.items(): if sym in KNOWN_NON_RETS: logging.debug("Adding known non-ret %s at 0x%x" % (sym, addr)) if sym in Black_LIST: Black_ADDRS.add(addr)
def dump_and_func_check(self, a, file): if not os.path.isdir(self.output_dir): os.makedirs(self.output_dir) out_file = self.output_dir + file.split("/")[-1] f = open(out_file, 'wb') f.write(a.get_file(file)) f.close() library = elf.ELF(out_file) # checks libraries functions names for key in library.symbols.keys(): for func in self.known_function_libs_names: if func in key: self.score = self.score + 1 return self.score