This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "3ds/result.h" | |
#include "3ds/services/ndm.h" | |
#include "3ds/svc.h" | |
#include <3ds/services/frd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <3ds.h> | |
int main(int argc, char* argv[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyctr.crypto.engine import CryptoEngine, Keyslot | |
from io import BytesIO | |
from typing import IO | |
import os | |
def readle(i: IO, s) -> int: | |
return int.from_bytes(i.read(s), 'little') | |
def readbe(i: IO, s) -> int: | |
return int.from_bytes(i.read(s), 'big') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def ipc_getcmdid(hdr: int) -> int: | |
return ((hdr & ~0xFFFF) >> 16) | |
def ipc_get_normal_args_count(hdr: int) -> int: | |
return ((hdr >> 6) & 0x3F) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <3ds.h> | |
typedef struct arg { | |
Handle exit; | |
Handle interrupt; | |
int fire_count; | |
} arg; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Cryptodome.Cipher import AES | |
wrap_key = ... # keyslot 0x31 normalkey, obtain KeyX from boot9 and KeyY from NATIVE_FIRM, use something like pyctr to keygen | |
def apt_unwrap(inp: bytes, nnc_offset: int, nnc_size: int, skip_verify_nonstandard_ccm: bool = False): | |
unwrapped_len = len(inp) - 0x10 | |
nnc_size &= 12 | |
nonce = inp[0:nnc_size] + b'\x00' * (12 - nnc_size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15 as pd | |
from cryptography.hazmat.primitives.hashes import SHA256 as sha256 | |
from cryptography.hazmat.primitives.asymmetric import rsa | |
import cryptography.hazmat.backends | |
with open("ncch.bin", "rb") as f: | |
ncch_sig = f.read(0x100) | |
ncch_header_data = f.read(0x100) | |
with open("extheader.bin", "rb") as f: |