#!/usr/bin/env python """ This code is based on a discussion here: http://hardforum.com/showthread.php?t=1693051 and code pasted here: http://pastebin.com/URExZi29 """ import mmap import struct import os MEM_START = 0xFED10000 FILESIZE = 32*1024 # Script must be run as root if os.geteuid() != 0: print "You must be root or root-like to run this script." else: f = open("/dev/mem", "r+b") mem = mmap.mmap(f.fileno(), FILESIZE, prot=mmap.PROT_READ, offset=MEM_START) print "5004-5007h:", for i in range(0x5004, 0x5004+4): print "%x" % struct.unpack("B", mem[i]), print "" print "5008-500Bh:", for i in range(0x5008, 0x5008+4): print "%x" % struct.unpack("B", mem[i]), print "" mem.close()