Skip to main content

A python module to manipulate and create MBRs.

Project description

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 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:


  • 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

  • Tests?

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymbr-1.0.3.tar.gz (4.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page