libWiiPy.title.ticket Module#
The libWiiPy.title.ticket
module provides support for handling Tickets, which are the license files used to decrypt the content of digital titles during installation. This module allows for easy parsing and editing of Tickets.
Module Contents#
- class libWiiPy.title.ticket.Ticket#
Bases:
object
A Ticket object that allows for either loading and editing an existing Ticket or creating one manually if desired.
- is_dev#
Whether this Ticket is signed for development or not, and whether the Title Key is encrypted for development or not.
- Type:
bool
- signature#
The signature applied to the ticket.
- Type:
bytes
- ticket_version#
The version of the ticket.
- Type:
int
- title_key_enc#
The Title Key contained in the ticket, in encrypted form.
- Type:
bytes
- ticket_id#
The unique ID of this ticket, used for console-specific title installations.
- Type:
bytes
- console_id#
The unique ID of the console this ticket was designed for, if this is a console-specific ticket.
- Type:
int
- title_version#
The version of the title this ticket was designed for.
- Type:
int
- common_key_index#
The index of the common key required to decrypt this ticket’s Title Key.
- Type:
int
- dump() bytes #
Dumps the Ticket object back into bytes.
- Returns:
The full Ticket file as bytes.
- Return type:
bytes
- fakesign() None #
Fakesigns this Ticket for the trucha bug.
This is done by brute-forcing a Ticket body hash starting with 00, causing it to pass signature verification on older IOS versions that incorrectly check the hash using strcmp() instead of memcmp(). The signature will also be erased and replaced with all NULL bytes.
The hash is brute-forced by using the first two bytes of an unused section of the Ticket as a 16-bit integer, and incrementing that value by 1 until an appropriate hash is found.
This modifies the Ticket object in place. You will need to call this method after any changes, and before dumping the Ticket object back into bytes.
- get_common_key_type() str #
Gets the name of the common key used to encrypt the Title Key contained in the ticket.
- Returns:
The name of the common key required.
- Return type:
str
- get_is_fakesigned() bool #
Checks the Ticket object to see if it is currently fakesigned. For a description of fakesigning, refer to the fakesign() method.
- Returns:
True if the Ticket is fakesigned, False otherwise.
- Return type:
bool
- get_title_id() str #
Gets the Title ID of the ticket’s associated title.
- Returns:
The Title ID of the title.
- Return type:
str
- get_title_key() bytes #
Gets the decrypted title key contained in the ticket.
- Returns:
The decrypted title key.
- Return type:
bytes
- load(ticket: bytes) None #
Loads raw Ticket data and sets all attributes of the WAD object. This allows for manipulating an already existing Ticket.
- Parameters:
ticket (bytes) – The data for the Ticket you wish to load.
- set_title_id(title_id) None #
Sets the Title ID property of the Ticket. Recommended over setting the property directly because of input validation.
- Parameters:
title_id (str) – The new Title ID of the title.
- set_title_version(new_version: str | int) None #
Sets the version of the title in the Ticket. Recommended over setting the data directly because of input validation.
Accepts either standard form (vX.X) as a string or decimal form (vXXX) as an integer.
- Parameters:
new_version (str, int) – The new version of the title. See description for valid formats.