Add fuse option to argument parsing

This commit is contained in:
Jeffrey Rongen 2024-05-01 11:27:59 +02:00
parent e33a28d35a
commit 27b831b32a

7
mtk
View file

@ -14,6 +14,7 @@ cmds = {
"rf": "Read whole flash to file", "rf": "Read whole flash to file",
"rs": "Read sectors starting at start_sector to filename", "rs": "Read sectors starting at start_sector to filename",
"ro": "Read flash starting at offset to filename", "ro": "Read flash starting at offset to filename",
"fs": "Mount the device as a FUSE filesystem",
"w": "Write partition from filename", "w": "Write partition from filename",
"wf": "Write flash from filename", "wf": "Write flash from filename",
"wl": "Write partitions from directory path to flash", "wl": "Write partitions from directory path to flash",
@ -55,7 +56,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(description=info) parser = argparse.ArgumentParser(description=info)
subparsers = parser.add_subparsers(dest="cmd", subparsers = parser.add_subparsers(dest="cmd",
help='Valid commands are: \n' + help='Valid commands are: \n' +
'printgpt, gpt, r, rl, rf, rs, w, wf, wl, e, es, footer, reset, \n' + 'printgpt, gpt, r, rl, rf, fs, rs, w, wf, wl, e, es, footer, reset, \n' +
'dumpbrom, dumpsram, dumppreloader, payload, crash, brute, gettargetconfig, \n' + 'dumpbrom, dumpsram, dumppreloader, payload, crash, brute, gettargetconfig, \n' +
'peek, stage, plstage, da, script\n') 'peek, stage, plstage, da, script\n')
@ -67,6 +68,7 @@ if __name__ == '__main__':
parser_rf = subparsers.add_parser("rf", help="Read whole flash to file") parser_rf = subparsers.add_parser("rf", help="Read whole flash to file")
parser_rs = subparsers.add_parser("rs", help="Read sectors starting at start_sector to filename") parser_rs = subparsers.add_parser("rs", help="Read sectors starting at start_sector to filename")
parser_ro = subparsers.add_parser("ro", help="Read flash starting at offset to filename") parser_ro = subparsers.add_parser("ro", help="Read flash starting at offset to filename")
parser_fs = subparsers.add_parser("fs", help="Mount the device as a FUSE filesystem")
parser_w = subparsers.add_parser("w", help="Write partition from filename") parser_w = subparsers.add_parser("w", help="Write partition from filename")
parser_wf = subparsers.add_parser("wf", help="Write flash from filename") parser_wf = subparsers.add_parser("wf", help="Write flash from filename")
parser_wl = subparsers.add_parser("wl", help="Write partitions from directory path to flash") parser_wl = subparsers.add_parser("wl", help="Write partitions from directory path to flash")
@ -405,6 +407,9 @@ if __name__ == '__main__':
parser_ro.add_argument('--auth', type=str, help="Use auth file (auth_sv5.auth)") parser_ro.add_argument('--auth', type=str, help="Use auth file (auth_sv5.auth)")
parser_ro.add_argument('--cert', type=str, help="Use cert file") parser_ro.add_argument('--cert', type=str, help="Use cert file")
parser_fs.add_argument('mountpoint', help='Directory to mount the FUSE filesystem in')
parser_fs.add_argument('--rw', help='Mount the filesystem as writeable', default=False, action='store_true')
parser_w.add_argument('partitionname', help='Partition to write (separate by comma for multiple partitions)') parser_w.add_argument('partitionname', help='Partition to write (separate by comma for multiple partitions)')
parser_w.add_argument('filename', help='Filename for writing (separate by comma for multiple filenames)') parser_w.add_argument('filename', help='Filename for writing (separate by comma for multiple filenames)')
parser_w.add_argument('--loader', type=str, help='Use specific DA loader, disable autodetection') parser_w.add_argument('--loader', type=str, help='Use specific DA loader, disable autodetection')