Skip to content

Commit 9ad0f84

Browse files
committed
Info command will now check for valid signature for WADs
This change does not apply to TMDs or Tickets on their own.
1 parent 4e6c7d2 commit 9ad0f84

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

commands/title/info.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from modules.core import fatal_error
99

1010

11-
def _print_tmd_info(tmd: libWiiPy.title.TMD):
11+
def _print_tmd_info(tmd: libWiiPy.title.TMD, signed=None):
1212
# Get all important keys from the TMD and print them out nicely.
1313
print("Title Info")
1414
ascii_tid = ""
@@ -69,6 +69,8 @@ def _print_tmd_info(tmd: libWiiPy.title.TMD):
6969
print(f" vWii Title: {bool(tmd.vwii)}")
7070
print(f" DVD Video Access: {tmd.get_access_right(tmd.AccessFlags.DVD_VIDEO)}")
7171
print(f" AHB Access: {tmd.get_access_right(tmd.AccessFlags.AHB)}")
72+
if signed is not None:
73+
print(f" Signed: {signed}")
7274
print(f" Fakesigned: {tmd.get_is_fakesigned()}")
7375
# Iterate over the content and print their details.
7476
print("\nContent Info")
@@ -83,7 +85,7 @@ def _print_tmd_info(tmd: libWiiPy.title.TMD):
8385
print(f" Content Hash: {content.content_hash.decode()}")
8486

8587

86-
def _print_ticket_info(ticket: libWiiPy.title.Ticket):
88+
def _print_ticket_info(ticket: libWiiPy.title.Ticket, signed=None):
8789
# Get all important keys from the TMD and print them out nicely.
8890
print(f"Ticket Info")
8991
ascii_tid = ""
@@ -129,6 +131,9 @@ def _print_ticket_info(ticket: libWiiPy.title.Ticket):
129131
print(f" Decryption Key: {key}")
130132
print(f" Title Key (Encrypted): {binascii.hexlify(ticket.title_key_enc).decode()}")
131133
print(f" Title Key (Decrypted): {binascii.hexlify(ticket.get_title_key()).decode()}")
134+
if signed is not None:
135+
print(f" Signed: {signed}")
136+
print(f" Fakesigned: {ticket.get_is_fakesigned()}")
132137

133138

134139
def _print_wad_info(title: libWiiPy.title.Title):
@@ -163,10 +168,18 @@ def _print_wad_info(title: libWiiPy.title.Title):
163168
print(f" Installed Size (MB): {min_size}-{max_size} MB")
164169
print(f" Has Meta/Footer: {bool(title.wad.wad_meta_size)}")
165170
print(f" Has CRL: {bool(title.wad.wad_crl_size)}")
171+
signed = title.get_is_signed()
172+
if signed:
173+
signing_str = "Valid (Unmodified)"
174+
elif title.get_is_fakesigned():
175+
signing_str = "Fakesigned"
176+
else:
177+
signing_str = "Invalid (Modified)"
178+
print(f" Signing Status: {signing_str}")
166179
print("")
167-
_print_ticket_info(title.ticket)
180+
_print_ticket_info(title.ticket, signed)
168181
print("")
169-
_print_tmd_info(title.tmd)
182+
_print_tmd_info(title.tmd, signed)
170183

171184

172185
def handle_info(args):

0 commit comments

Comments
 (0)