Skip to content

Instantly share code, notes, and snippets.

@nguyenl95
Last active Jul 12, 2019
Embed
What would you like to do?
#!/usr/bin/python2
import binascii
import hashlib
drv='/dev/sdb'
mode='rb+'
# pwd default is 'admin'
sector_size=512
magic_string=r"%@#$*&^!**$#&@^%%@#$*&^!**$#&@^%"
magic_number=55
with open(drv, mode) as disk:
with open('raw0.bin') as raw0:
disk.seek(0)
disk.write(raw0.read())
with open('raw1.bin') as raw1:
disk.seek(sector_size*8199)
disk.write(raw1.read())
with open('raw2.bin') as raw2:
for i in range(1, 59):
disk.seek(63+i*262144)
disk.write(raw2.read())
for x in xrange(11, 16):
disk.seek(x*sector_size)
disk.write(magic_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment