mirror of
https://github.com/NinjaCheetah/libWiiPy.git
synced 2025-04-26 13:21:01 -04:00
Fully documented remaining files
This commit is contained in:
parent
6c5c045bb1
commit
8eb54ab961
@ -9,9 +9,19 @@ vwii_key = '30bfc76e7c19afbb23163330ced7c28d'
|
|||||||
|
|
||||||
|
|
||||||
def get_common_key(common_key_index):
|
def get_common_key(common_key_index):
|
||||||
"""
|
"""Gets the specified Wii Common Key based on the index provided.
|
||||||
Returns the specified Wii Common Key based on the index provided.
|
|
||||||
Possible values for common_key_index: 0: Common Key, 1: Korean Key, 2: vWii Key
|
Possible values for common_key_index: 0: Common Key, 1: Korean Key, 2: vWii Key
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
common_key_index : int
|
||||||
|
The index of the common key to be returned.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bytes
|
||||||
|
The specified common key, in binary format.
|
||||||
"""
|
"""
|
||||||
match common_key_index:
|
match common_key_index:
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -8,9 +8,23 @@ from Crypto.Cipher import AES
|
|||||||
|
|
||||||
|
|
||||||
def decrypt_title_key(title_key_enc, common_key_index, title_id):
|
def decrypt_title_key(title_key_enc, common_key_index, title_id):
|
||||||
"""
|
"""Gets the decrypted version of the encrypted Title Key provided.
|
||||||
Returns the decrypted version of the encrypted Title Key provided.
|
|
||||||
Requires the index of the common key to use, and the Title ID of the title that the Title Key is for.
|
Requires the index of the common key to use, and the Title ID of the title that the Title Key is for.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
title_key_enc : bytes
|
||||||
|
The encrypted Title Key.
|
||||||
|
common_key_index : int
|
||||||
|
The index of the common key to be returned.
|
||||||
|
title_id : bytes
|
||||||
|
The title ID of the tite that the key is for.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bytes
|
||||||
|
The decrypted Title Key.
|
||||||
"""
|
"""
|
||||||
# Load the correct common key for the title.
|
# Load the correct common key for the title.
|
||||||
common_key = get_common_key(common_key_index)
|
common_key = get_common_key(common_key_index)
|
||||||
|
@ -11,7 +11,15 @@ from typing import List
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class TitleLimit:
|
class TitleLimit:
|
||||||
"""Creates a TitleLimit object that contains the type of restriction and the limit."""
|
"""Creates a TitleLimit object that contains the type of restriction and the limit.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
----------
|
||||||
|
limit_type : int
|
||||||
|
The type of play limit applied.
|
||||||
|
maximum_usage : int
|
||||||
|
The maximum value for the type of play limit applied.
|
||||||
|
"""
|
||||||
# The type of play limit applied. The following types exist:
|
# The type of play limit applied. The following types exist:
|
||||||
# 0 = None, 1 = Time Limit, 3 = None, 4 = Launch Count
|
# 0 = None, 1 = Time Limit, 3 = None, 4 = Launch Count
|
||||||
limit_type: int
|
limit_type: int
|
||||||
@ -105,40 +113,102 @@ class Ticket:
|
|||||||
self.title_limits_list.append(TitleLimit(limit_type, limit_value))
|
self.title_limits_list.append(TitleLimit(limit_type, limit_value))
|
||||||
|
|
||||||
def get_signature(self):
|
def get_signature(self):
|
||||||
"""Returns the signature of the ticket."""
|
"""Gets the signature of the ticket.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bytes
|
||||||
|
The signature.
|
||||||
|
"""
|
||||||
return self.signature
|
return self.signature
|
||||||
|
|
||||||
def get_ticket_version(self):
|
def get_ticket_version(self):
|
||||||
"""Returns the version of the ticket."""
|
"""Gets the version of the ticket.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
int
|
||||||
|
The version.
|
||||||
|
"""
|
||||||
return self.ticket_version
|
return self.ticket_version
|
||||||
|
|
||||||
def get_title_key_enc(self):
|
def get_title_key_enc(self):
|
||||||
"""Returns the title key contained in the ticket, in encrypted form."""
|
"""Gets the Title Key contained in the ticket, in encrypted form.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bytes
|
||||||
|
The encrypted Title Key.
|
||||||
|
"""
|
||||||
return self.title_key_enc
|
return self.title_key_enc
|
||||||
|
|
||||||
def get_ticket_id(self):
|
def get_ticket_id(self):
|
||||||
"""Returns the ID of the ticket."""
|
"""Gets the ID of the ticket.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bytes
|
||||||
|
The ID of the ticket.
|
||||||
|
"""
|
||||||
return self.ticket_id
|
return self.ticket_id
|
||||||
|
|
||||||
def get_console_id(self):
|
def get_console_id(self):
|
||||||
"""Returns the ID of the console this ticket is designed for, if the ticket is console-specific."""
|
"""Gets the ID of the console this ticket is designed for, if the ticket is console-specific.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bytes
|
||||||
|
The ID of the console.
|
||||||
|
"""
|
||||||
return self.console_id
|
return self.console_id
|
||||||
|
|
||||||
def get_title_id(self):
|
def get_title_id(self):
|
||||||
"""Returns the Title ID of the ticket's associated title."""
|
"""Gets the Title ID of the ticket's associated title.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
str
|
||||||
|
The Title ID of the title.
|
||||||
|
"""
|
||||||
title_id_str = str(self.title_id.decode())
|
title_id_str = str(self.title_id.decode())
|
||||||
return title_id_str
|
return title_id_str
|
||||||
|
|
||||||
def get_title_version(self):
|
def get_title_version(self):
|
||||||
"""Returns the version of the ticket's associated title that this ticket is designed for."""
|
"""Gets the version of the ticket's associated title that this ticket is designed for.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
int
|
||||||
|
The version of the title.
|
||||||
|
"""
|
||||||
return self.title_version
|
return self.title_version
|
||||||
|
|
||||||
def get_common_key_index(self):
|
def get_common_key_index(self):
|
||||||
"""Returns the index of the common key used to encrypt the Title Key contained in the ticket."""
|
"""Gets the index of the common key used to encrypt the Title Key contained in the ticket.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
int
|
||||||
|
The index of the common key required.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
commonkeys.get_common_key
|
||||||
|
"""
|
||||||
return self.common_key_index
|
return self.common_key_index
|
||||||
|
|
||||||
def get_common_key_type(self):
|
def get_common_key_type(self):
|
||||||
"""Returns the name of the common key used to encrypt the Title Key contained in the ticket."""
|
"""Gets the name of the common key used to encrypt the Title Key contained in the ticket.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
str
|
||||||
|
The name of the common key required.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
commonkeys.get_common_key
|
||||||
|
"""
|
||||||
match self.common_key_index:
|
match self.common_key_index:
|
||||||
case 0:
|
case 0:
|
||||||
return "Common"
|
return "Common"
|
||||||
@ -148,7 +218,13 @@ class Ticket:
|
|||||||
return "vWii"
|
return "vWii"
|
||||||
|
|
||||||
def get_title_key(self):
|
def get_title_key(self):
|
||||||
"""Returns the decrypted title key contained in the ticket."""
|
"""Gets the decrypted title key contained in the ticket.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
bytes
|
||||||
|
The decrypted title key.
|
||||||
|
"""
|
||||||
title_key = decrypt_title_key(self.title_key_enc, self.common_key_index, self.title_id)
|
title_key = decrypt_title_key(self.title_key_enc, self.common_key_index, self.title_id)
|
||||||
return title_key
|
return title_key
|
||||||
|
|
||||||
|
@ -290,6 +290,11 @@ class TMD:
|
|||||||
def get_content_record(self, record):
|
def get_content_record(self, record):
|
||||||
"""Gets the content record at the specified index.
|
"""Gets the content record at the specified index.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
record : int
|
||||||
|
The content record to be retrieved.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
ContentRecord
|
ContentRecord
|
||||||
|
Loading…
x
Reference in New Issue
Block a user