A python module to manipulate and create MBRs.
PyMBR is a simple module that allows the user to parse, manipulate or create MBR/Bootsectors easily.
- Parse full MBR dump
- Parse parts of the MBR such as the partition table.
- Change the bootcode or the artition table values.
- Compose the changes made into a a new MBR binary string.
python setup.py install
pip install pymbr
Sample usage - Creating a simple MBR
import pymbr mbr = pymbr.MBR() mbr.bootcode = pymbr.Bootcode.ZOIDBERG mbr.partitionTable = pymbr.PartitionTable.parse('\x00' * 64) mbr.signature = 0xaa55 bin = mbr.compose() with open('mbr.bin', 'wb') as file: file.write(bin)
- Add more common filesystems to the Filesystem class
- Add common MBR bootcode to he Bootcode class
- Add LBA to CHS converion
- Add overlapping partition prevention
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.