Allow fakesigning a file in place via fakesign command

WADs patched with iospatch are also now fakesigned by default when exported.
This commit is contained in:
Campbell 2024-07-29 17:18:24 -04:00
parent 6af035068c
commit 304539b120
Signed by: NinjaCheetah
GPG Key ID: B547958AF96ED344
3 changed files with 8 additions and 3 deletions

View File

@ -7,7 +7,10 @@ import libWiiPy
def handle_fakesign(args):
input_path = pathlib.Path(args.input)
output_path = pathlib.Path(args.output)
if args.output is not None:
output_path = pathlib.Path(args.output)
else:
output_path = pathlib.Path(args.input)
if not input_path.exists():
raise FileNotFoundError(input_path)

View File

@ -93,6 +93,7 @@ def handle_iospatch(args):
" compatible with this IOS.")
if patch_count > 0 or args.version is not None or args.slot is not None:
ios_patcher.title.fakesign() # Signature is broken anyway, so fakesign for maximum installation openings
if args.output is not None:
output_path = pathlib.Path(args.output)
output_file = open(output_path, "wb")

View File

@ -52,10 +52,11 @@ if __name__ == "__main__":
# Argument parser for the fakesign subcommand.
fakesign_parser = subparsers.add_parser("fakesign", help="fakesign a TMD, Ticket, or WAD (trucha bug)",
description="fakesign a TMD, Ticket, or WAD (trucha bug)")
description="fakesign a TMD, Ticket, or WAD (trucha bug); by default, this "
"will overwrite the input file if no output file is specified")
fakesign_parser.set_defaults(func=handle_fakesign)
fakesign_parser.add_argument("input", metavar="IN", type=str, help="input file")
fakesign_parser.add_argument("output", metavar="OUT", type=str, help="output file")
fakesign_parser.add_argument("-o", "--output", metavar="OUT", type=str, help="output file (optional)")
# Argument parser for the iospatch command.
iospatch_parser = subparsers.add_parser("iospatch", help="patch IOS WADs to re-enable exploits",