Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import struct
- def print_mos(f, offset, idx):
- offset += 0x28
- offset += idx * 0x10
- f.seek(offset)
- asize = f.read(4)
- vdev = f.read(4)
- offset = f.read(8)
- asize = (struct.unpack("<L", asize)[0] & 0xFFFFFF) << 9
- vdev = struct.unpack("<L", vdev)[0]
- offset = struct.unpack("<Q", offset)[0]
- gang = (offset & 0x8000000000000000) != 0
- offset = ((offset & 0x7FFFFFFFFFFFFFFF) << 9) + 0x400000
- print "block %d @%d:%x, size %d, gang %d" % (idx, vdev, offset, asize, gang)
- f = open('disk', 'rb')
- pos = 0
- while True:
- f.seek(pos)
- magic = f.read(4)
- if len(magic) == 0:
- break
- if (struct.unpack("<L", magic)[0] == 0x00BAB10C):
- f.seek(pos+0x10)
- print "Uberblock found at %x, tgx %d" % (pos, struct.unpack("<Q", f.read(8))[0])
- print_mos(f, pos, 0)
- print_mos(f, pos, 1)
- print_mos(f, pos, 2)
- if (struct.unpack("<L", magic)[0] == 0x010E0A00):
- print "block at %x -- %x" % (pos, (pos - 0x400000) >> 9)
- pos += 0x200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement