mirror of
https://github.com/NinjaCheetah/libWiiPy.git
synced 2025-04-25 12:51:01 -04:00
Added methods to check if a TMD, Ticket, and Title are fakesigned
This commit is contained in:
parent
6220821a2f
commit
fb87c2c58c
@ -252,6 +252,27 @@ class Ticket:
|
||||
except OverflowError:
|
||||
raise Exception("An error occurred during fakesigning. Ticket could not be fakesigned!")
|
||||
|
||||
def get_is_fakesigned(self) -> bool:
|
||||
"""
|
||||
Checks the Ticket object to see if it is currently fakesigned. For a description of fakesigning, refer to the
|
||||
fakesign() method.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool:
|
||||
True if the Ticket is fakesigned, False otherwise.
|
||||
|
||||
See Also
|
||||
--------
|
||||
libWiiPy.title.ticket.Ticket.fakesign()
|
||||
"""
|
||||
if self.signature != b'\x00' * 256:
|
||||
return False
|
||||
test_hash = hashlib.sha1(self.dump()[320:]).hexdigest()
|
||||
if test_hash[:2] != '00':
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_title_id(self) -> str:
|
||||
"""
|
||||
Gets the Title ID of the ticket's associated title.
|
||||
@ -275,7 +296,7 @@ class Ticket:
|
||||
|
||||
See Also
|
||||
--------
|
||||
commonkeys.get_common_key
|
||||
libWiiPy.title.commonkeys.get_common_key
|
||||
"""
|
||||
match self.common_key_index:
|
||||
case 0:
|
||||
|
@ -316,3 +316,22 @@ class Title:
|
||||
"""
|
||||
self.tmd.fakesign()
|
||||
self.ticket.fakesign()
|
||||
|
||||
def get_is_fakesigned(self):
|
||||
"""
|
||||
Checks the Title object to see if it is currently fakesigned. This ensures that both the TMD and Ticket are
|
||||
fakesigned. For a description of fakesigning, refer to the fakesign() method.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool:
|
||||
True if the Title is fakesigned, False otherwise.
|
||||
|
||||
See Also
|
||||
--------
|
||||
libWiiPy.title.title.Title.fakesign()
|
||||
"""
|
||||
if self.tmd.get_is_fakesigned and self.ticket.get_is_fakesigned():
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -257,6 +257,27 @@ class TMD:
|
||||
except OverflowError:
|
||||
raise Exception("An error occurred during fakesigning. TMD could not be fakesigned!")
|
||||
|
||||
def get_is_fakesigned(self) -> bool:
|
||||
"""
|
||||
Checks the TMD object to see if it is currently fakesigned. For a description of fakesigning, refer to the
|
||||
fakesign() method.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool:
|
||||
True if the TMD is fakesigned, False otherwise.
|
||||
|
||||
See Also
|
||||
--------
|
||||
libWiiPy.title.tmd.TMD.fakesign()
|
||||
"""
|
||||
if self.signature != b'\x00' * 256:
|
||||
return False
|
||||
test_hash = hashlib.sha1(self.dump()[320:]).hexdigest()
|
||||
if test_hash[:2] != '00':
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_title_region(self) -> str:
|
||||
"""
|
||||
Gets the region of the TMD's associated title.
|
||||
@ -386,7 +407,7 @@ class TMD:
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
Whether the flag is enabled.
|
||||
True if the flag is enabled, False otherwise.
|
||||
"""
|
||||
return bool(self.access_rights & _bitmask(flag))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user