I am looking for a way to write raw bytes into a disk image using Python. For example, I have an list containing several characters and I need to write all those characters in different parts of my disk.
In my Python script I need to do something like this: My list xab contains all those characters that I need to write in my this and the SelectedSectors list contains the sectors that will be written with each xab characters.
disk = open("mydisk.img",'ab')
for i in SelectedSectors:
disk.seek(SelectedSectors[i])
disk.write(xab[i])
disk.close()
I am not sure in how to deal with individual bytes in my disk image using Python. How should I solve this problem?
Best regards,
F.Borges