pyctr.type.save.disa module

exception pyctr.type.save.disa.UnformattedSaveError[source]

Bases: InvalidPartitionContainerError

The archive appears to be unformatted. The difference here is that the first 0x20 bytes are all null bytes, the rest is garbage.

class pyctr.type.save.disa.DISA(file, mode='rb', *, fs=None, closefd=None, crypto=None, dev=False, cmac_base=None, sd_key_file=None, sd_key=None)[source]

Bases: PartitionContainerBase

Reads and writes to DISA files.

Parameters:
  • file (FilePathOrObject) – A file path or a file-like object with the DIFF data.

  • mode (ReadWriteBinaryFileModes) – Mode to open the file with, passed to open. Only used if a file path was given.

  • closefd (bool | None) – Close the underlying file object when closed. Defaults to True for file paths, and False for file-like objects.

  • crypto (CryptoEngine) – A custom CryptoEngine object to be used. Defaults to None, which causes a new one to be created.

  • dev (bool) – Use devunit keys.

  • cmac_base (CMACTypeBase) – A CMACTypeBase object that describes how to update the CMAC.

  • sd_key_file (FilePath) – Path to a movable.sed file to load the SD KeyY from.

  • sd_key (bytes) – SD KeyY to use. Has priority over sd_key_file if both are specified.

  • fs (FS | None)

partitions: dict[int, Partition]

Partitions of the file. DISA can have one or two, so there is always 0 but there can be 1 as well.