Пример #1
0
def strings(phys_pos, filename):
  import memory
  f = open(filename, "w")
  while 1:
    s = memory.access(10, phys_pos)
    print >>f, "%08x\t%s" % (phys_pos, repr(s))
    phys_pos += len(s) + 1
Пример #2
0
    def get_value(loc, mem_type=6, info=None, image=0): #unsigned long int
	"""
	uses the memory module to access physical memory
	returns a representation based on mem_type
	loc is a virtual address

	may raise a MemoryAccessException
	"""
	if loc < 4096: raise NullPointerException(loc, repr(info))

	# check if we have a userspace address
	# for 2.6.11 kernels this is 0xffff810000000000UL
	# since 2.6.27 this is 0xffff880000000000UL
	# if loc < 0xffff880000000000:
	if loc < KERNEL_PAGE_OFFSET:
		# this is a userspace virtual address!
		raise UserspaceVirtualAddressException("userspace paging not implemented!", loc, str(info))
	try:
		physloc = memory.virt_to_phys(loc, image)
		return memory.access(mem_type, physloc, image)
	except ValueError, e:
		raise PageNotPresent("page not present")
Пример #3
0
    def get_value(loc, mem_type=6, info=None, image=0):  #unsigned long int
        """
	uses the memory module to access physical memory
	returns a representation based on mem_type
	loc is a virtual address

	may raise a MemoryAccessException
	"""
        if loc < 4096: raise NullPointerException(loc, repr(info))

        # check if we have a userspace address
        # for 2.6.11 kernels this is 0xffff810000000000UL
        # since 2.6.27 this is 0xffff880000000000UL
        # if loc < 0xffff880000000000:
        if loc < KERNEL_PAGE_OFFSET:
            # this is a userspace virtual address!
            raise UserspaceVirtualAddressException(
                "userspace paging not implemented!", loc, str(info))
        try:
            physloc = memory.virt_to_phys(loc, image)
            return memory.access(mem_type, physloc, image)
        except ValueError, e:
            raise PageNotPresent("page not present")