示例#1
0
 def __init__(self, arch, alloc_size=0x4000, granularity=16):
     super(AngrExternObject, self).__init__('##angr_externs##')
     self._next_addr = 0
     self._lookup_table = {}
     self._arch = arch
     self._alloc_size = alloc_size
     self._granularity = granularity
     self.memory = Clemory(arch)
     self.memory.add_backer(0, '\0' * alloc_size)
示例#2
0
 def __init__(self, arch, alloc_size=0x4000, granularity=16):
     super(AngrExternObject, self).__init__('##angr_externs##')
     self._next_addr = 0
     self._lookup_table = {}
     self._arch = arch
     self._alloc_size = alloc_size
     self._granularity = granularity
     self.memory = Clemory(arch)
     self.memory.add_backer(0, '\0' * alloc_size)
     self.segments = [Segment(0, 0, 0, alloc_size)]
     self.segments[0].is_readable = True
     self.segments[0].is_writable = False
     self.segments[0].is_executable = True
示例#3
0
class AngrExternObject(Backend):
    def __init__(self, arch, alloc_size=0x4000, granularity=16):
        super(AngrExternObject, self).__init__('##angr_externs##')
        self._next_addr = 0
        self._lookup_table = {}
        self._arch = arch
        self._alloc_size = alloc_size
        self._granularity = granularity
        self.memory = Clemory(arch)
        self.memory.add_backer(0, '\0' * alloc_size)
        self.segments = [Segment(0, 0, 0, alloc_size)]
        self.segments[0].is_readable = True
        self.segments[0].is_writable = False
        self.segments[0].is_executable = True

    def get_max_addr(self):
        return self._alloc_size + self.mapped_base

    def get_min_addr(self):
        return self.mapped_base

    def contains_addr(self, addr):
        return self.get_min_addr() <= addr < self.get_max_addr()

    def get_pseudo_addr(self, ident, size=16):
        if ident not in self._lookup_table:
            self._lookup_table[ident] = self._next_addr
            self._next_addr += size + (
                (self._granularity - size) % self._granularity)
        return self._lookup_table[ident]

    def anon_allocation(self, size=16):
        out = self._next_addr
        self._next_addr += size + (
            (self._granularity - size) % self._granularity)
        return out

    def contains_identifier(self, ident):
        return ident in self._lookup_table

    def get_pseudo_addr_for_symbol(self, ident):
        if ident not in self._lookup_table:
            return None

        return self._lookup_table[ident]

    def rebase(self):
        super(AngrExternObject, self).rebase()
        self._next_addr = AT.from_lva(self._next_addr, self).to_mva()
示例#4
0
 def __init__(self, arch, alloc_size=0x4000, granularity=16):
     super(AngrExternObject, self).__init__('##angr_externs##')
     self._next_addr = 0
     self._lookup_table = {}
     self._arch = arch
     self._alloc_size = alloc_size
     self._granularity = granularity
     self.memory = Clemory(arch)
     self.memory.add_backer(0, '\0'*alloc_size)
示例#5
0
class AngrExternObject(Backend):
    def __init__(self, arch, alloc_size=0x4000, granularity=16):
        super(AngrExternObject, self).__init__('##angr_externs##')
        self._next_addr = 0
        self._lookup_table = {}
        self._arch = arch
        self._alloc_size = alloc_size
        self._granularity = granularity
        self.memory = Clemory(arch)
        self.memory.add_backer(0, '\0'*alloc_size)
        self.segments = [Segment(0, 0, 0, alloc_size)]
        self.segments[0].is_readable = True
        self.segments[0].is_writable = False
        self.segments[0].is_executable = True

    def get_max_addr(self):
        return self._alloc_size + self.rebase_addr

    def get_min_addr(self):
        return self.rebase_addr

    def contains_addr(self, addr):
        return addr >= self.get_min_addr() and addr < self.get_max_addr()

    def get_pseudo_addr(self, ident, size=16):
        if ident not in self._lookup_table:
            self._lookup_table[ident] = self._next_addr
            self._next_addr += size + ((self._granularity - size) % self._granularity)
        return self._lookup_table[ident] + self.rebase_addr

    def anon_allocation(self, size=16):
        out = self._next_addr + self.rebase_addr
        self._next_addr += size + ((self._granularity - size) % self._granularity)
        return out

    def contains_identifier(self, ident):
        return ident in self._lookup_table

    def get_pseudo_addr_for_symbol(self, ident):
        if ident not in self._lookup_table:
            return None

        return self._lookup_table[ident] + self.rebase_addr
示例#6
0
文件: extern_obj.py 项目: angr/angr
 def __init__(self, arch, alloc_size=0x4000, granularity=16):
     super(AngrExternObject, self).__init__('##angr_externs##')
     self._next_addr = 0
     self._lookup_table = {}
     self._arch = arch
     self._alloc_size = alloc_size
     self._granularity = granularity
     self.memory = Clemory(arch)
     self.memory.add_backer(0, '\0'*alloc_size)
     self.segments = [Segment(0, 0, 0, alloc_size)]
     self.segments[0].is_readable = True
     self.segments[0].is_writable = False
     self.segments[0].is_executable = True
示例#7
0
class AngrExternObject(Backend):
    def __init__(self, arch, alloc_size=0x4000, granularity=16):
        super(AngrExternObject, self).__init__('##angr_externs##')
        self._next_addr = 0
        self._lookup_table = {}
        self._arch = arch
        self._alloc_size = alloc_size
        self._granularity = granularity
        self.memory = Clemory(arch)
        self.memory.add_backer(0, '\0'*alloc_size)

    def get_max_addr(self):
        return self._alloc_size + self.rebase_addr

    def get_min_addr(self):
        return self.rebase_addr

    def get_pseudo_addr(self, ident, size=16):
        if ident not in self._lookup_table:
            self._lookup_table[ident] = self._next_addr
            self._next_addr += size + ((self._granularity - size) % self._granularity)
        return self._lookup_table[ident] + self.rebase_addr
示例#8
0
class AngrExternObject(Backend):
    def __init__(self, arch, alloc_size=0x4000, granularity=16):
        super(AngrExternObject, self).__init__('##angr_externs##')
        self._next_addr = 0
        self._lookup_table = {}
        self._arch = arch
        self._alloc_size = alloc_size
        self._granularity = granularity
        self.memory = Clemory(arch)
        self.memory.add_backer(0, '\0' * alloc_size)

    def get_max_addr(self):
        return self._alloc_size + self.rebase_addr

    def get_min_addr(self):
        return self.rebase_addr

    def get_pseudo_addr(self, ident, size=16):
        if ident not in self._lookup_table:
            self._lookup_table[ident] = self._next_addr
            self._next_addr += size + (
                (self._granularity - size) % self._granularity)
        return self._lookup_table[ident] + self.rebase_addr