mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2026-01-17 07:35:58 -05:00
Compare commits
2 Commits
935f5eb7df
...
ebd6702056
| Author | SHA1 | Date | |
|---|---|---|---|
| ebd6702056 | |||
| 4b7eae8e85 |
@ -4,7 +4,9 @@
|
||||
import binascii
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
import libWiiPy
|
||||
|
||||
from modules.core import fatal_error
|
||||
|
||||
|
||||
@ -71,8 +73,8 @@ def _print_tmd_info(tmd: libWiiPy.title.TMD, signing_cert=None):
|
||||
print(f" Region: {region}")
|
||||
print(f" Title Type: {tmd.get_title_type()}")
|
||||
print(f" vWii Title: {bool(tmd.vwii)}")
|
||||
print(f" DVD Video Access: {tmd.get_access_right(tmd.AccessFlags.DVD_VIDEO)}")
|
||||
print(f" AHB Access: {tmd.get_access_right(tmd.AccessFlags.AHB)}")
|
||||
print(f" DVD Video Access: {tmd.get_access_right(libWiiPy.title.AccessFlags.DVD_VIDEO)}")
|
||||
print(f" AHB Access: {tmd.get_access_right(libWiiPy.title.AccessFlags.AHB)}")
|
||||
if signing_cert is not None:
|
||||
try:
|
||||
if libWiiPy.title.verify_tmd_sig(signing_cert, tmd):
|
||||
@ -106,22 +108,23 @@ def _print_ticket_info(ticket: libWiiPy.title.Ticket, signing_cert=None):
|
||||
# Get all important keys from the TMD and print them out nicely.
|
||||
print(f"Ticket Info")
|
||||
ascii_tid = ""
|
||||
decoded_tid = binascii.hexlify(ticket.title_id).decode()
|
||||
try:
|
||||
ascii_tid = str(bytes.fromhex(binascii.hexlify(ticket.title_id).decode()[8:].replace("00", "30")).decode("ascii"))
|
||||
except UnicodeDecodeError or binascii.Error:
|
||||
ascii_tid = str(bytes.fromhex(decoded_tid[8:].replace("00", "30")).decode("ascii"))
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
pattern = r"^[a-z0-9!@#$%^&*]{4}$"
|
||||
if re.fullmatch(pattern, ascii_tid, re.IGNORECASE):
|
||||
print(f" Title ID: {binascii.hexlify(ticket.title_id).decode().upper()} ({ascii_tid})")
|
||||
print(f" Title ID: {decoded_tid.upper()} ({ascii_tid})")
|
||||
else:
|
||||
print(f" Title ID: {binascii.hexlify(ticket.title_id).decode().upper()}")
|
||||
print(f" Title ID: {decoded_tid.upper()}")
|
||||
# This type of version number really only applies to the System Menu and IOS.
|
||||
if ticket.title_id.decode().startswith("00000001"):
|
||||
if ticket.title_id.decode() == "0000000100000001":
|
||||
if decoded_tid.startswith("00000001"):
|
||||
if decoded_tid == "0000000100000001":
|
||||
print(f" Title Version: {ticket.title_version} (boot2v{ticket.title_version})")
|
||||
else:
|
||||
print(f" Title Version: {ticket.title_version} "
|
||||
f"({libWiiPy.title.title_ver_dec_to_standard(ticket.title_version, ticket.title_id.decode())})")
|
||||
f"({libWiiPy.title.title_ver_dec_to_standard(ticket.title_version, decoded_tid)})")
|
||||
else:
|
||||
print(f" Title Version: {ticket.title_version}")
|
||||
print(f" Ticket Version: {ticket.ticket_version}")
|
||||
@ -136,6 +139,7 @@ def _print_ticket_info(ticket: libWiiPy.title.Ticket, signing_cert=None):
|
||||
print(f" Certificate Issuer: Root-CA00000002 (Development)")
|
||||
else:
|
||||
print(f" Certificate Info: {ticket.signature_issuer} (Unknown)")
|
||||
key = ""
|
||||
match ticket.common_key_index:
|
||||
case 0:
|
||||
if ticket.is_dev:
|
||||
|
||||
@ -44,7 +44,7 @@ def handle_nus_content(args):
|
||||
except ValueError:
|
||||
fatal_error("The specified Title ID or Content ID could not be found!")
|
||||
|
||||
if decrypt_content is True:
|
||||
if decrypt_content:
|
||||
output_path = output_path.with_suffix(".app")
|
||||
tmd = libWiiPy.title.TMD()
|
||||
tmd.load(libWiiPy.title.download_tmd(tid, version))
|
||||
@ -175,7 +175,7 @@ def handle_nus_title(args):
|
||||
|
||||
# Try to decrypt the contents for this title if a ticket was available.
|
||||
if output_dir is not None:
|
||||
if can_decrypt is True:
|
||||
if can_decrypt:
|
||||
for content in range(len(title.tmd.content_records)):
|
||||
print(f" - Decrypting content {content + 1} of {len(title.tmd.content_records)} "
|
||||
f"(Content ID: {title.tmd.content_records[content].content_id})...")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user