Example #1
0
    def test_dump(self):
        elf = ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB, 183, ['a'], ['b'],
                  ['libc.so', 'libm.so'], {'hello', 'world'}, {'d', 'e'})

        f = StringIO()
        elf.dump(f)
        actual_output = f.getvalue()

        self.assertEqual(
            'EI_CLASS\t32\n'
            'EI_DATA\t\tLittle-Endian\n'
            'E_MACHINE\tEM_AARCH64\n'
            'FILE_SIZE\t0\n'
            'RO_SEG_FILE_SIZE\t0\n'
            'RO_SEG_MEM_SIZE\t0\n'
            'RW_SEG_FILE_SIZE\t0\n'
            'RW_SEG_MEM_SIZE\t0\n'
            'DT_RPATH\ta\n'
            'DT_RUNPATH\tb\n'
            'DT_NEEDED\tlibc.so\n'
            'DT_NEEDED\tlibm.so\n'
            'EXP_SYMBOL\thello\n'
            'EXP_SYMBOL\tworld\n'
            'IMP_SYMBOL\td\n'
            'IMP_SYMBOL\te\n', actual_output)
    def test_dump(self):
        elf = ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB, 183, ['a'], ['b'],
                  ['libc.so', 'libm.so'], {'hello', 'world'}, {'d', 'e'})

        f = StringIO()
        elf.dump(f)
        actual_output = f.getvalue()

        self.assertEqual('EI_CLASS\t32\n'
                         'EI_DATA\t\tLittle-Endian\n'
                         'E_MACHINE\tEM_AARCH64\n'
                         'FILE_SIZE\t0\n'
                         'RO_SEG_FILE_SIZE\t0\n'
                         'RO_SEG_MEM_SIZE\t0\n'
                         'RW_SEG_FILE_SIZE\t0\n'
                         'RW_SEG_MEM_SIZE\t0\n'
                         'DT_RPATH\ta\n'
                         'DT_RUNPATH\tb\n'
                         'DT_NEEDED\tlibc.so\n'
                         'DT_NEEDED\tlibm.so\n'
                         'EXP_SYMBOL\thello\n'
                         'EXP_SYMBOL\tworld\n'
                         'IMP_SYMBOL\td\n'
                         'IMP_SYMBOL\te\n',
                         actual_output)
Example #3
0
    def test_dump(self):
        elf = ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB, 183, 'a', 'b',
                  ['libc.so', 'libm.so'], ['hello', 'world'])

        with StringIO() as f:
            elf.dump(f)
            actual_output = f.getvalue()

        self.assertEqual(
            'EI_CLASS\t32\n'
            'EI_DATA\t\tLittle-Endian\n'
            'E_MACHINE\tEM_AARCH64\n'
            'DT_RPATH\ta\n'
            'DT_RUNPATH\tb\n'
            'DT_NEEDED\tlibc.so\n'
            'DT_NEEDED\tlibm.so\n'
            'SYMBOL\t\thello\n'
            'SYMBOL\t\tworld\n', actual_output)