Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Take the master boot record from this week's module and use it as a file input for your program. It will be named block.dd and

Take the master boot record from this week's module and use it as a file input for your program. It will be named block.dd and you can assume that it's in your current directory so you don't have to provide a path to it. Make sure that you copy it into the directory where your Python file is located or your program will fail.

Use the information in the Wikipedia entry for Master Boot Record (Links to an external site.)Links to an external site. to write a program that will parse a portion of the partition table. The first partition entry is located at the address 1BE (hex). Print out the status byte (1 byte located at the starting address), the partition type (1 byte located at the address 1BE + 4) and the address of the first sector in the partition (1BE + 8).

import struct

# open block.dd as read binary

f = open("block.dd", "rb")

# read the data

data = f.read()

# read the first two bytes for status byte(0x1BE) and partition type

(0x1BE + 4) status = data[0x1BE] partition_type = data[0x1BE + 4]

# the third value for the first sector is four bytes in value according to the table on the wiki page, # so we need to use unpack to unpack as an integer and give the range of values we want to unpack

def chunk(): sector = struct.unpack("

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

How do you try to manipulate your unique smell?

Answered: 1 week ago

Question

2. What should an employer do when facing an OSHA inspection?

Answered: 1 week ago