Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This question was asked before by someone else but the solution did not work and

ID: 3752333 • Letter: T

Question

This question was asked before by someone else but the solution did not work and it didn't work for me either. Below is the question:

I am to build on the program from last week(posted below). Use the same file from last week. You will be extracting the first partition entry from the master boot record that is contained in the file. The first partition entry starts at offset 0x1BE and ends at 0x1CD. Pull that chunk of bytes out of the file provided and send it to the server software that you will write. The server will listen for the chunk of data and print out the status of the drive, the partition type and the starting address of the partition as an integer.

LAST WEEK'S CODE:

import struct

data = bytearray()

# Open the block.dd to read and parse
with open('block.dd', 'rb') as file:
____data = file.read()

# Parse and assign partition status byte
status = data[0x1BE]
# Parse and assign partition type byte
partitionType = data[0x1C2]
# Parse, unpack, and assign address of first sector of partition (4 bytes)
firstSectorAddress = struct.unpack("<i", data[0x1C6:0x1CA])

print("Status: ", hex(status))
print("Partition Type: ", hex(partitionType))
print("Address of First Sector: ", firstSectorAddress[0])

THE CODE I HAVE FOR THIS WEEK SO FAR:

CLIENT FILE:

SERVER FILE:

THANK YOU IN ADVANCE!!!

Explanation / Answer

print("Status: ", hex(status))
print("Partition Type: ", hex(partitionType))
print("Address of First Sector: ", firstSectorAddress[0])

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote