Last active
July 12, 2019 03:43
-
-
Save nguyenl95/9deacab5ceb98da1d8539aa1b552ce03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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