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.

Installation

python setup.py install

or

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)

TODOs:

  • 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 Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page