Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- img_path = 'C:/mbr12.img'
- file_com = 'C:/GAME_COM.com'
- start_pos = 0
- end_pos = 10
- with open(img_path, 'rb') as file:
- with open(file_com, 'rb') as wfile:
- text = wfile.read()
- print(len(text))
- ftext = file.read()
- print(len(ftext))
- empty = b'\00' * 13824
- for k in range(start_pos, end_pos):
- n = str(k)
- name = b'\00\01' + b'programm' + bytes(n, encoding="ascii")
- print(name)
- ftext = ftext[:4096 + 32*k] + name + ftext[4096 + 32*k + len(name):]
- for j in range(start_pos, end_pos):
- ftext = ftext[:4608 + 13824 * j] + empty + ftext[4608 + len(empty) + 13824 * j:]
- ftext = ftext[:4608 + 13824 * j] + text + ftext[4608 + len(text) + 13824 * j:]
- print(len(ftext))
- with open(img_path, 'wb') as file:
- file.write(ftext)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement