diff options
Diffstat (limited to '')
-rwxr-xr-x | tests/msdos-overlap | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/msdos-overlap b/tests/msdos-overlap new file mode 100755 index 0000000..b2b03e6 --- /dev/null +++ b/tests/msdos-overlap @@ -0,0 +1,24 @@ +#!/usr/bin/python3 +""" + Write an overlapping partition to a msdos disk + + Call with disk image/device to mangle +""" +import sys + +BAD_ENTRY = (0x72, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x10, 0x83, 0x03, 0x20, 0x4f, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x50, 0x83, 0x00, 0x0a, 0x7a, 0xff, 0x27, + 0x00, 0x00, 0x0a, 0x15, 0x00, 0x00, 0x00, 0x00 ) +OFFSET = 0x1b8 + +if len(sys.argv) < 2: + print("%s: <image or device>" % sys.argv[0]) + sys.exit(1) + +with open(sys.argv[1], "rb+") as f: + f.seek(OFFSET, 0) + f.write(bytes(bytearray(BAD_ENTRY))) + +sys.exit(0) |