mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2025-06-07 23:11:01 -04:00
Compare commits
No commits in common. "514deb6b6c7dd623cbda73207e792a89beb000d3" and "4e6c7d2dd0bcfa0d1a9449481c09ff3f082df26e" have entirely different histories.
514deb6b6c
...
4e6c7d2dd0
@ -8,7 +8,7 @@ import libWiiPy
|
|||||||
from modules.core import fatal_error
|
from modules.core import fatal_error
|
||||||
|
|
||||||
|
|
||||||
def _print_tmd_info(tmd: libWiiPy.title.TMD, signing_cert=None):
|
def _print_tmd_info(tmd: libWiiPy.title.TMD):
|
||||||
# Get all important keys from the TMD and print them out nicely.
|
# Get all important keys from the TMD and print them out nicely.
|
||||||
print("Title Info")
|
print("Title Info")
|
||||||
ascii_tid = ""
|
ascii_tid = ""
|
||||||
@ -69,23 +69,7 @@ def _print_tmd_info(tmd: libWiiPy.title.TMD, signing_cert=None):
|
|||||||
print(f" vWii Title: {bool(tmd.vwii)}")
|
print(f" vWii Title: {bool(tmd.vwii)}")
|
||||||
print(f" DVD Video Access: {tmd.get_access_right(tmd.AccessFlags.DVD_VIDEO)}")
|
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" AHB Access: {tmd.get_access_right(tmd.AccessFlags.AHB)}")
|
||||||
if signing_cert is not None:
|
print(f" Fakesigned: {tmd.get_is_fakesigned()}")
|
||||||
try:
|
|
||||||
signed = libWiiPy.title.verify_tmd_sig(signing_cert, tmd)
|
|
||||||
if signed:
|
|
||||||
signing_str = "Valid (Unmodified)"
|
|
||||||
elif tmd.get_is_fakesigned():
|
|
||||||
signing_str = "Fakesigned"
|
|
||||||
else:
|
|
||||||
signing_str = "Invalid (Modified)"
|
|
||||||
except ValueError:
|
|
||||||
if tmd.get_is_fakesigned():
|
|
||||||
signing_str = "Fakesigned"
|
|
||||||
else:
|
|
||||||
signing_str = "Invalid (Modified)"
|
|
||||||
print(f" Signing Status: {signing_str}")
|
|
||||||
else:
|
|
||||||
print(f" Fakesigned: {tmd.get_is_fakesigned()}")
|
|
||||||
# Iterate over the content and print their details.
|
# Iterate over the content and print their details.
|
||||||
print("\nContent Info")
|
print("\nContent Info")
|
||||||
print(f" Total Contents: {tmd.num_contents}")
|
print(f" Total Contents: {tmd.num_contents}")
|
||||||
@ -99,7 +83,7 @@ def _print_tmd_info(tmd: libWiiPy.title.TMD, signing_cert=None):
|
|||||||
print(f" Content Hash: {content.content_hash.decode()}")
|
print(f" Content Hash: {content.content_hash.decode()}")
|
||||||
|
|
||||||
|
|
||||||
def _print_ticket_info(ticket: libWiiPy.title.Ticket, signing_cert=None):
|
def _print_ticket_info(ticket: libWiiPy.title.Ticket):
|
||||||
# Get all important keys from the TMD and print them out nicely.
|
# Get all important keys from the TMD and print them out nicely.
|
||||||
print(f"Ticket Info")
|
print(f"Ticket Info")
|
||||||
ascii_tid = ""
|
ascii_tid = ""
|
||||||
@ -145,23 +129,6 @@ def _print_ticket_info(ticket: libWiiPy.title.Ticket, signing_cert=None):
|
|||||||
print(f" Decryption Key: {key}")
|
print(f" Decryption Key: {key}")
|
||||||
print(f" Title Key (Encrypted): {binascii.hexlify(ticket.title_key_enc).decode()}")
|
print(f" Title Key (Encrypted): {binascii.hexlify(ticket.title_key_enc).decode()}")
|
||||||
print(f" Title Key (Decrypted): {binascii.hexlify(ticket.get_title_key()).decode()}")
|
print(f" Title Key (Decrypted): {binascii.hexlify(ticket.get_title_key()).decode()}")
|
||||||
if signing_cert is not None:
|
|
||||||
try:
|
|
||||||
signed = libWiiPy.title.verify_ticket_sig(signing_cert, ticket)
|
|
||||||
if signed:
|
|
||||||
signing_str = "Valid (Unmodified)"
|
|
||||||
elif ticket.get_is_fakesigned():
|
|
||||||
signing_str = "Fakesigned"
|
|
||||||
else:
|
|
||||||
signing_str = "Invalid (Modified)"
|
|
||||||
except ValueError:
|
|
||||||
if ticket.get_is_fakesigned():
|
|
||||||
signing_str = "Fakesigned"
|
|
||||||
else:
|
|
||||||
signing_str = "Invalid (Modified)"
|
|
||||||
print(f" Signing Status: {signing_str}")
|
|
||||||
else:
|
|
||||||
print(f" Fakesigned: {ticket.get_is_fakesigned()}")
|
|
||||||
|
|
||||||
|
|
||||||
def _print_wad_info(title: libWiiPy.title.Title):
|
def _print_wad_info(title: libWiiPy.title.Title):
|
||||||
@ -196,25 +163,10 @@ def _print_wad_info(title: libWiiPy.title.Title):
|
|||||||
print(f" Installed Size (MB): {min_size}-{max_size} MB")
|
print(f" Installed Size (MB): {min_size}-{max_size} MB")
|
||||||
print(f" Has Meta/Footer: {bool(title.wad.wad_meta_size)}")
|
print(f" Has Meta/Footer: {bool(title.wad.wad_meta_size)}")
|
||||||
print(f" Has CRL: {bool(title.wad.wad_crl_size)}")
|
print(f" Has CRL: {bool(title.wad.wad_crl_size)}")
|
||||||
tmd_cert = None
|
|
||||||
ticket_cert = None
|
|
||||||
try:
|
|
||||||
signed = title.get_is_signed()
|
|
||||||
tmd_cert = title.cert_chain.tmd_cert
|
|
||||||
ticket_cert = title.cert_chain.ticket_cert
|
|
||||||
if signed:
|
|
||||||
signing_str = "Valid (Unmodified)"
|
|
||||||
elif title.get_is_fakesigned():
|
|
||||||
signing_str = "Fakesigned"
|
|
||||||
else:
|
|
||||||
signing_str = "Invalid (Modified)"
|
|
||||||
except ValueError:
|
|
||||||
signing_str = "Invalid (Modified)"
|
|
||||||
print(f" Signing Status: {signing_str}")
|
|
||||||
print("")
|
print("")
|
||||||
_print_ticket_info(title.ticket, ticket_cert)
|
_print_ticket_info(title.ticket)
|
||||||
print("")
|
print("")
|
||||||
_print_tmd_info(title.tmd, tmd_cert)
|
_print_tmd_info(title.tmd)
|
||||||
|
|
||||||
|
|
||||||
def handle_info(args):
|
def handle_info(args):
|
||||||
|
@ -253,7 +253,7 @@ def handle_wad_pack(args):
|
|||||||
title = libWiiPy.title.Title()
|
title = libWiiPy.title.Title()
|
||||||
title.load_tmd(tmd_file.read_bytes())
|
title.load_tmd(tmd_file.read_bytes())
|
||||||
title.load_ticket(ticket_file.read_bytes())
|
title.load_ticket(ticket_file.read_bytes())
|
||||||
title.load_cert_chain(cert_file.read_bytes())
|
title.wad.set_cert_data(cert_file.read_bytes())
|
||||||
# Footers are not super common and are not required, so we don't care about one existing until we get to
|
# Footers are not super common and are not required, so we don't care about one existing until we get to
|
||||||
# the step where we'd pack it.
|
# the step where we'd pack it.
|
||||||
footer_file = pathlib.Path(list(input_path.glob("*.[fF][oO][oO][tT][eE][rR]"))[0])
|
footer_file = pathlib.Path(list(input_path.glob("*.[fF][oO][oO][tT][eE][rR]"))[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user