• Stars
    star
    986
  • Rank 46,190 (Top 1.0 %)
  • Language
    C
  • License
    ISC License
  • Created over 6 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

hactool is a tool to view information about, decrypt, and extract common file formats for the Nintendo Switch, especially Nintendo Content Archives.

hactool

License

hactool is a tool to view information about, decrypt, and extract common file formats for the Nintendo Switch, especially Nintendo Content Archives.

It is heavily inspired by ctrtool.

Usage

Usage: hactool [options...] <file>
Options:
-i, --info        Show file info.
                      This is the default action.
-x, --extract     Extract data from file.
                      This is also the default action.
  -r, --raw          Keep raw data, don't unpack.
  -y, --verify       Verify hashes and signatures.
  -d, --dev          Decrypt with development keys instead of retail.
  -k, --keyset       Load keys from an external file.
  -t, --intype=type  Specify input file type [nca, xci, pfs0, romfs, hfs0, npdm, pk11, pk21, ini1, kip1, nax0, save, keygen]
  --titlekey=key     Set title key for Rights ID crypto titles.
  --contentkey=key   Set raw key for NCA body decryption.
  --disablekeywarns  Disables warning output when loading external keys.
NCA options:
  --plaintext=file   Specify file path for saving a decrypted copy of the NCA.
  --header=file      Specify Header file path.
  --section0=file    Specify Section 0 file path.
  --section1=file    Specify Section 1 file path.
  --section2=file    Specify Section 2 file path.
  --section3=file    Specify Section 3 file path.
  --section0dir=dir  Specify Section 0 directory path.
  --section1dir=dir  Specify Section 1 directory path.
  --section2dir=dir  Specify Section 2 directory path.
  --section3dir=dir  Specify Section 3 directory path.
  --exefs=file       Specify ExeFS file path. Overrides appropriate section file path.
  --exefsdir=dir     Specify ExeFS directory path. Overrides appropriate section directory path.
  --romfs=file       Specify RomFS file path. Overrides appropriate section file path.
  --romfsdir=dir     Specify RomFS directory path. Overrides appropriate section directory path.
  --listromfs        List files in RomFS.
  --baseromfs        Set Base RomFS to use with update partitions.
  --basenca          Set Base NCA to use with update partitions.
  --basefake         Use a fake Base RomFS with update partitions (all reads will return 0xCC).
  --onlyupdated      Ignore non-updated files in update partitions.
NPDM options:
  --json=file        Specify file path for saving JSON representation of program permissions to.
KIP1 options:
  --json=file        Specify file path for saving JSON representation of program permissions to.
  --uncompressed=f   Specify file path for saving uncompressed KIP1.
NSO0 options:
  --uncompressed=f   Specify file path for saving uncompressed NSO0.
PFS0 options:
  --pfs0dir=dir      Specify PFS0 directory path.
  --outdir=dir       Specify PFS0 directory path. Overrides previous path, if present.
  --exefsdir=dir     Specify PFS0 directory path. Overrides previous paths, if present for ExeFS PFS0.
RomFS options:
  --romfsdir=dir     Specify RomFS directory path.
  --outdir=dir       Specify RomFS directory path. Overrides previous path, if present.
  --listromfs        List files in RomFS.
HFS0 options:
  --hfs0dir=dir      Specify HFS0 directory path.
  --outdir=dir       Specify HFS0 directory path. Overrides previous path, if present.
  --exefsdir=dir     Specify HFS0 directory path. Overrides previous paths, if present.
XCI options:
  --rootdir=dir      Specify XCI root HFS0 directory path.
  --updatedir=dir    Specify XCI update HFS0 directory path.
  --normaldir=dir    Specify XCI normal HFS0 directory path.
  --securedir=dir    Specify XCI secure HFS0 directory path.
  --logodir=dir      Specify XCI logo HFS0 directory path.
  --outdir=dir       Specify XCI directory path. Overrides previous paths, if present.
Package1 options:
  --package1dir=dir  Specify Package1 directory path.
  --outdir=dir       Specify Package1 directory path. Overrides previous path, if present.
Package2 options:
  --package2dir=dir  Specify Package2 directory path.
  --outdir=dir       Specify Package2 directory path. Overrides previous path, if present.
  --extractini1      Enable INI1 extraction to default directory (redundant with --ini1dir set).
  --ini1dir=dir      Specify INI1 directory path. Overrides default path, if present.
INI1 options:
  --ini1dir=dir      Specify INI1 directory path.
  --outdir=dir       Specify INI1 directory path. Overrides previous path, if present.
  --saveini1json     Enable generation of JSON descriptors for all INI1 members.
NAX0 options:
  --sdseed=seed      Set console unique seed for SD card NAX0 encryption.
  --sdpath=path      Set relative path for NAX0 key derivation (ex: /registered/000000FF/cafebabecafebabecafebabecafebabe.nca).
Save data options:
  --outdir=dir       Specify save directory path.
  --listfiles        List files in save file.
Key Derivation options:
  --sbk=key          Set console unique Secure Boot Key for key derivation.
  --tseckey=key      Set console unique TSEC Key for key derivation.```

Building

Copy config.mk.template to config.mk, make changes as required, and then run make. If your make is not GNU make (e.g. on BSD variants), you need to call gmake instead.

If on Windows, I recommend using MinGW.

External Keys

External keys can be provided by the -k/--keyset argument to the a keyset filename. Keyset files are text files containing one key per line, in the form "key_name = HEXADECIMALKEY". Case shouldn't matter, nor should whitespace.

In addition, if -k/--keyset is not set, hactool will check for the presence of a keyset file in $HOME/.switch/prod.keys (or $HOME/.switch/dev.keys if -d/--dev is set). If present, this file will automatically be loaded.

Licensing

This software is licensed under the terms of the ISC License.
You can find a copy of the license in the LICENSE file.

More Repositories

1

boot9strap

Boot9/Boot11 code execution.
C
935
star
2

Rhydon

Save file editor for Pokemon Red/Blue/Yellow.
C#
71
star
3

3DS-SSL-Patch

Patches the SSL module to disable Root CA Verification
Assembly
63
star
4

SMPatcher

Applies patches to Pokemon Sun/Moon code.bin
C#
56
star
5

nustool

nustool is a simple downloader and decryptor for titles on the Nintendo Update Servers (NUS).
C
42
star
6

FEAT

Fire Emblem Archive Tool (A tool to automatically extract data from 3DS Fire Emblem archives)
C#
31
star
7

RomFS-Builder

This is a program to convert a folder in windows into a 3DS RomFS binary. For use with makerom.
C#
30
star
8

FEITS

Fire Emblem: If Text Simulator
C#
28
star
9

3DS-Builder

This is a program to convert romfs/exefs folders in windows (or pre-built binaries) and an extended header into a .3ds NCSD binary.
C#
27
star
10

nx_secmon_ida_loader

IDA Pro loader for the Nintendo Switch secure monitor
Python
25
star
11

CTRAesEngine

C# Library to simulate the 3DS's hardware AES engine.
C#
24
star
12

Rumble-World-Save-Tool

A tool for editing/decompressing Pokemon Rumble World save files.
C#
23
star
13

SunMoonPatches

Collection of ARM ASM patches for Pokemon Sun/Moon.
Assembly
22
star
14

33-and-a-half-c3

JavaScript
20
star
15

local_wireless_tools

Tools for Gen VII local wireless data.
Python
18
star
16

MysteryGiftTool

Automatic tracking/downloading/decryption/extraction of Gen VI/VII Mystery Gifts/PGL Regulations.
C#
17
star
17

otptool

view and extract data from a 3DS OTP
C
17
star
18

3ds-crypto-server

ARM11 Userland homebrew for 3ds crypto over the network.
C
17
star
19

EULASetter

3DS homebrew to set your accepted EULA version.
Makefile
16
star
20

PSSE

Pokemon Shuffle Save Editor
C#
13
star
21

ccrypt

Decrypts the ClCertA files.
C
13
star
22

FEAST

Save Compressor/Decompressor for Fire Emblem: Awakening
C#
13
star
23

3ds-pohlig-hellman

Implements an RSA keyslot recovery attack on the 3DS's hardware RSA engine.
Python
12
star
24

kernel-scripts

Collection of reverse engineering utility scripts for the Horizon Kernel
Python
12
star
25

ScreenInfo

Find out if your N3DS has IPS/TN Screens!
Makefile
11
star
26

memecrypto_test

C
10
star
27

FireEmblemSoVTextTranslation

Repository of text for Fire Emblem Echoes: Shadows of Valentia
10
star
28

RSWE

Ruby Sapphire Wilds Editor
C#
8
star
29

fatal_renderer

Tool for rendering atmosphere fatal images on PC
C++
7
star
30

BadgeArcadeTool

Automatic Tracking/Extraction of badges from Nintendo Badge Arcade.
C#
7
star
31

CTRKeyScrambler

C# Code to emulate the 3DS's hardware AES KeyScrambler
C#
6
star
32

XYWE

Encounter Data Editor for Pokemon X/Y
C#
5
star
33

CTR_Textures

API for decoding textures for the Nintendo 3DS.
C#
5
star
34

romfs_diag

Diagnostic tool for memory usage when building romfs on console
C++
5
star
35

boot-scripts

Collection of code auto-generation utility scripts for the Horizon `Boot` system module
Python
4
star
36

Pokemon-Shuffle-Unpacker

Unpacks Pokemon Shuffle's RomFS's archives to folders with meaningful file names.
C#
4
star
37

Personal-Editor

Editor for Personal.Garc (Extracted) for Gen VI Pokemon Games (X/Y and OR/AS)
C#
4
star
38

UnsafeA9LHInstaller-Stage2

Stage 2 payload for UnsafeA9LHInstaller
C
3
star
39

fnv-notes

Collection of notes on FNV(1a) family of hashes
3
star
40

DLCTool

Quickly thrown-together tool for rebuilding 3DS DLC CIAs for Team If.
C#
3
star
41

memdump

Memdumping from spider plus occasional crashes with a red screen. (and some debug output calls I forgot to remove, ah well.)
C
3
star
42

3dsexplorer

Automatically exported from code.google.com/p/3dsexplorer
C#
2
star
43

Fire-Emblem-If-Patcher

Legacy tool to automatically patch Fire Emblem If -- created for the Translation project in 2015, no longer supported/maintained.
C#
2
star
44

qrtool

Command-line tool for generating QR codes.
C#
2
star
45

SoVPG

Portrait Generator for Fire Emblem Echoes: Shadows of Valentia.
C#
2
star
46

JNUSTool

A tool to download and decrypt NUS stuff
Java
1
star
47

gf-pawncc

The Pawn Language compiler with tweaks to support Game Freak's AMX fork in the Gen 6/7/8(+?) Pokรฉmon games.
C
1
star
48

TPP-JSON-Generator

Converts a Pokemon Platinum Save's boxes to a JSON-parsable string. For use with Twitch Plays Pokemon Battle Revolution.
C#
1
star