mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2025-04-27 05:41:01 -04:00
Signing information now presented much more clearly
This commit is contained in:
parent
9ad0f8412c
commit
514deb6b6c
@ -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, signed=None):
|
def _print_tmd_info(tmd: libWiiPy.title.TMD, signing_cert=None):
|
||||||
# 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,9 +69,23 @@ def _print_tmd_info(tmd: libWiiPy.title.TMD, signed=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 signed is not None:
|
if signing_cert is not None:
|
||||||
print(f" Signed: {signed}")
|
try:
|
||||||
print(f" Fakesigned: {tmd.get_is_fakesigned()}")
|
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}")
|
||||||
@ -85,7 +99,7 @@ def _print_tmd_info(tmd: libWiiPy.title.TMD, signed=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, signed=None):
|
def _print_ticket_info(ticket: libWiiPy.title.Ticket, signing_cert=None):
|
||||||
# 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 = ""
|
||||||
@ -131,9 +145,23 @@ def _print_ticket_info(ticket: libWiiPy.title.Ticket, signed=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 signed is not None:
|
if signing_cert is not None:
|
||||||
print(f" Signed: {signed}")
|
try:
|
||||||
print(f" Fakesigned: {ticket.get_is_fakesigned()}")
|
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):
|
||||||
@ -168,18 +196,25 @@ 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)}")
|
||||||
signed = title.get_is_signed()
|
tmd_cert = None
|
||||||
if signed:
|
ticket_cert = None
|
||||||
signing_str = "Valid (Unmodified)"
|
try:
|
||||||
elif title.get_is_fakesigned():
|
signed = title.get_is_signed()
|
||||||
signing_str = "Fakesigned"
|
tmd_cert = title.cert_chain.tmd_cert
|
||||||
else:
|
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)"
|
signing_str = "Invalid (Modified)"
|
||||||
print(f" Signing Status: {signing_str}")
|
print(f" Signing Status: {signing_str}")
|
||||||
print("")
|
print("")
|
||||||
_print_ticket_info(title.ticket, signed)
|
_print_ticket_info(title.ticket, ticket_cert)
|
||||||
print("")
|
print("")
|
||||||
_print_tmd_info(title.tmd, signed)
|
_print_tmd_info(title.tmd, tmd_cert)
|
||||||
|
|
||||||
|
|
||||||
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.wad.set_cert_data(cert_file.read_bytes())
|
title.load_cert_chain(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