diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:16:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:16:34 +0000 |
commit | a398d2c2b5fd6ab0545d8bb019f9a970b2309404 (patch) | |
tree | 272fc7ab226258d7ceddee12c8c682c8e711c2b0 /tests/msdos-overlap | |
parent | Initial commit. (diff) | |
download | parted-upstream.tar.xz parted-upstream.zip |
Adding upstream version 3.6.upstream/3.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/msdos-overlap')
-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) |