Advertisement
Guest User

ecc_check.py

a guest
Sep 1st, 2013
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. """
  4. This code is based on a discussion here:
  5.  
  6. http://hardforum.com/showthread.php?t=1693051
  7.  
  8. and code pasted here:
  9.  
  10. http://pastebin.com/URExZi29
  11. """
  12.  
  13. import mmap
  14. import struct
  15. import os
  16.  
  17. MEM_START = 0xFED10000
  18. FILESIZE = 32*1024
  19.  
  20. # Script must be run as root
  21. if os.geteuid() != 0:
  22.     print "You must be root or root-like to run this script."
  23.  
  24. else:
  25.     f = open("/dev/mem", "r+b")
  26.     mem = mmap.mmap(f.fileno(), FILESIZE, prot=mmap.PROT_READ, offset=MEM_START)
  27.  
  28.     print "5004-5007h:",
  29.     for i in range(0x5004, 0x5004+4):
  30.         print "%x" % struct.unpack("B", mem[i]),
  31.  
  32.     print ""
  33.  
  34.     print "5008-500Bh:",
  35.     for i in range(0x5008, 0x5008+4):
  36.         print "%x" % struct.unpack("B", mem[i]),
  37.  
  38.     print ""
  39.  
  40.     mem.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement