Menu
support@authoritypapers.com
+1(805) 568 7317

hello i need help with the following program in python in displaying the 4 partition 5151797

Hello, I need help with the following program in python in displaying the 4 partitions from the mbr.dd file, thank you in advance:
Recreate the following python script that displays information about the MBR, and then display all the information about each
Translating MBR Entry Partition 1 8001 01 00 OB FE 3F 3F 3F 00 00 00 01 BO OF 00 Bootable Starting Cylinder Head Sector Head

offset (d) 0O 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 33 co 3AŽD.1aP.P.uN.I .. PW&.6MEN. . 8n. .u.fA. a6t.8 fE.It.8, to

mbrreader.py

#!/usr/bin/python3

import struct

def mbr_partition(mbr,no):
size=16
start=446 +(no-1)*size
end = start+size
part = mbr[start:end]
return part

f = open(“mbr.dd”, “rb”)
mbr=bytearray()
try:
mbr=f.read(512)
finally:
f.close()
x= struct.unpack(” print(“Disk Signature”, x[0])
x= mbr[0x1be]
if x == 0x80:
print(“Active flag is active”)
else:
print(“Active flag is inactive”)

lbastart = struct.unpack(” print(“partition is lba-start:”, lbastart[0])
lbaend = struct.unpack(” print(“partition is lba-end:”, lbaend[0])
# the partitions as whole 16 bytes:
part1 = mbr_partition(mbr,1)   
print( “partition no 1:n”)
for byte in part1:
print(f'{byte:02x}',sep=' ', end=' ')
print(“n”)

part2 = mbr_partition(mbr,2)
print( “partition no 2:n”)
for byte in part2:
print(f'{byte:02x}',sep=' ', end=' ')
print(“n”)

part3 = mbr_partition(mbr,3)
print( “partition no 3:n”)
for byte in part3:
print(f'{byte:02x}',sep=' ', end=' ')
print(“n”)

part4 = mbr_partition(mbr,4)
print( “partition no 4:n”)
for byte in part4:
print(f'{byte:02x}',sep=' ', end=' ')
print(“n”)

part1 = mbr[446]
print(“partition no 1: code in decimal”, part1)
print(f'partition no 1: code in hexa {part1:02x}n')
h = mbr[447]
s = mbr[448]
c = mbr[449]
print( “partition no 1 H: code in decimal”, h)
print(f'partition no 1 H: code in hexa {h:02x}n')

print( “partition no 1 S: code in decimal”, s)
print(f'partition no 1 S: code in hexa {s:02x}n')

print( “partition no 1 S 6 bits: code in decimal”, s&0x3f)
print(f'partition no 1 S 6 bits: code in hexa {s&0x3f:02x}n')

print( “partition no 1 S 2 bits: code in decimal”, s>>6)
print(f'partition no 1 S 2 bits: code in hexa {s>>6:02x}n')

print( “partition no 1 C : code in decimal”, c)
print(f'partition no 1 C : code in hexa {c:02x}n')

print(“partition no 1 S+C 10 bits: code in decimal”, (((s>>6)&0x03) print(f'partition no 1 S+C 10 bits: code in hexa {(((s>>6)&0x03)

part2 = mbr[462]
print(“partition no 2:”, part2)
print(f'partition no 2: code in hexa {part2:02x}n')
h = mbr[463]
s = mbr[464]
c = mbr[465]
print( “partition no 2 H: code in decimal”, h)
print(f'partition no 2 H: code in hexa {h:02x}n')

print( “partition no 2 S: code in decimal”, s)
print(f'partition no 2 S: code in hexa {s:02x}n')

print( “partition no 2 S 6 bits: code in decimal”, s&0x3f)
print(f'partition no 2 S 6 bits: code in hexa {s&0x3f:02x}n')

print( “partition no 2 S 2 bits: code in decimal”, s>>6)
print(f'partition no 2 S 2 bits: code in hexa {s>>6:02x}n')

part3 = mbr[478]
print(“partition no 2:”, part3)
print(f'partition no 2: code in hexa {part3:02x}n')
h = mbr[479]
s = mbr[480]
c = mbr[481]
print( “partition no 2 H: code in decimal”, h)
print(f'partition no 2 H: code in hexa {h:02x}n')

print( “partition no 3 S: code in decimal”, s)
print(f'partition no 3 S: code in hexa {s:02x}n')

print( “partition no 3 S 6 bits: code in decimal”, s&0x3f)
print(f'partition no 3 S 6 bits: code in hexa {s&0x3f:02x}n')

print( “partition no 3 S 2 bits: code in decimal”, s>>6)
print(f'partition no 3 S 2 bits: code in hexa {s>>6:02x}n')

part4 = mbr[494]
print(“partition no 3:”, part4)
print(f'partition no 3: code in hexa {part4:02x}n')
h = mbr[495]
s = mbr[496]
c = mbr[497]
print( “partition no 4 H: code in decimal”, h)
print(f'partition no 4 H: code in hexa {h:02x}n')

print( “partition no 4 S: code in decimal”, s)
print(f'partition no 4 S: code in hexa {s:02x}n')

print( “partition no 4 S 6 bits: code in decimal”, s&0x3f)
print(f'partition no 4 S 6 bits: code in hexa {s&0x3f:02x}n')

print( “partition no 4 S 2 bits: code in decimal”, s>>6)
print(f'partition no 4 S 2 bits: code in hexa {s>>6:02x}n')

—————————————————————–

mbr512.dd
33 C0 8E D0 BC 00 7C 8E C0 8E D8 BE 00 7C BF 00 06 B9 00 02 FC F3 A4 50 68 1C 06 CB FB B9 04 00 BD BE 07 80 7E 00 00 7C 0B 0F 85 0E 01 83 C5 10 E2 F1 CD 18 88 56 00 55 C6 46 11 05 C6 46 10 00 B4 41 BB AA 55 CD 13 5D 72 0F 81 FB 55 AA 75 09 F7 C1 01 00 74 03 FE 46 10 66 60 80 7E 10 00 74 26 66 68 00 00 00 00 66 FF 76 08 68 00 00 68 00 7C 68 01 00 68 10 00 B4 42 8A 56 00 8B F4 CD 13 9F 83 C4 10 9E EB 14 B8 01 02 BB 00 7C 8A 56 00 8A 76 01 8A 4E 02 8A 6E 03 CD 13 66 61 73 1C FE 4E 11 75 0C 80 7E 00 80 0F 84 8A 00 B2 80 EB 84 55 32 E4 8A 56 00 CD 13 5D EB 9E 81 3E FE 7D 55 AA 75 6E FF 76 00 E8 8D 00 75 17 FA B0 D1 E6 64 E8 83 00 B0 DF E6 60 E8 7C 00 B0 FF E6 64 E8 75 00 FB B8 00 BB CD 1A 66 23 C0 75 3B 66 81 FB 54 43 50 41 75 32 81 F9 02 01 72 2C 66 68 07 BB 00 00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66 53 66 55 66 68 00 00 00 00 66 68 00 7C 00 00 66 61 68 00 00 07 CD 1A 5A 32 F6 EA 00 7C 00 00 CD 18 A0 B7 07 EB 08 A0 B6 07 EB 03 A0 B5 07 32 E4 05 00 07 8B F0 AC 3C 00 74 09 BB 07 00 B4 0E CD 10 EB F2 F4 EB FD 2B C9 E4 64 EB 00 24 02 E0 F8 24 02 C3 49 6E 76 61 6C 69 64 20 70 61 72 74 69 74 69 6F 6E 20 74 61 62 6C 65 00 45 72 72 6F 72 20 6C 6F 61 64 69 6E 67 20 6F 70 65 72 61 74 69 6E 67 20 73 79 73 74 65 6D 00 4D 69 73 73 69 6E 67 20 6F 70 65 72 61 74 69 6E 67 20 73 79 73 74 65 6D 00 00 00 63 7B 9A F2 7A CE 7F 00 00 00 02 03 00 06 BD 0B 72 80 00 00 00 00 20 1C 00 80 BD 0C 72 07 5B 3C 9F 80 20 1C 00 00 F0 0A 00 00 5B 3D 9F 83 61 01 A0 80 10 27 00 00 40 00 00 00 61 02 A0 85 D5 51 04 80 50 27 00 00 A0 18 00 55 AA

Recreate the following python script that displays information about the MBR, and then display all the information about each of the 4 partition Boot Indicator Starting Head Starting Sector Starting Cylinder System Indicator Ending Head Ending Sector Ending Cylinder Sectors Before Part Sectors in Partition Test your script on an MBR record that you can generate with the dd command C Translating MBR Entry Partition 1 8001 01 00 OB FE 3F 3F 3F 00 00 00 01 BO OF 00 Bootable Starting Cylinder Head Sector Head 8 bits Sector 6 bits Cylinder 10 bit O000000000 0h0000001 00000001 Head 1 Sector 1 Cylinder O Partition Code 0B Ending Cylinder 63 Head 254 Sector 63 Starting Sector= 63 (Little Endian) Sectors in the Partition: 01 BO OF 00-> LE=00 Of b0 01 16 7 0+ 16 O165 *0 164 15 +16s *11 + 162*0+ 161*0 + 160*1 = 1028097 (IN Little Endian) offset (d) 0O 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 33 co 3AŽD.1aP.P.uN.I .. PW&.6MEN. . 8n. .u.fA. a6t.8 fE.It.8, to u. .tu»…t.eò N.èF.spF…t. e-..t. .uoeF..f F. .fV..! .s. T.e 4.>p)Ut.e-..tÈ EB A9 8B FC 1E 57 8B F5 CB BF 05 00 8A 56 .e

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now