Ejemplo n.º 1
0
    def test_elf(self):

        # BFD available for different operating systems
        # but current test needs Linux.
        if not self.is_linux(): return

        try:

            from pyopenreil.utils import bin_BFD

            self._run_test(lambda abi: abi.cdecl, 
                ARCH_X86, bin_BFD.Reader(self.file_path(self.ELF_NAME)), self.ELF_ADDR)

        except ImportError, why: print '[!]', str(why)
Ejemplo n.º 2
0
def openreil_cfg(sample):
    reader = bin_BFD.Reader(samples_dir + sample)
    addr = None
    for k,v in reader.bfd.symbols.iteritems():
        if v.name == 'main':
            addr = k

    tr = CodeStorageTranslator(reader)
    cfg = CFGraphBuilder(tr).traverse(addr)

    vis = OpenreilVisFactory().default_cfg_pipeline(asminst=True, reilinst=False)
    vis.set_output(DotOutput(sample + '_openreil_asm', format="png"))
    vis.process(cfg)

    vis = OpenreilVisFactory().default_cfg_pipeline(asminst=False, reilinst=True)
    vis.set_output(DotOutput(sample + '_openreil_reil', format="png"))
    vis.process(cfg)