2018-02-03 05:35:43 +00:00
|
|
|
# hactool
|
2018-01-24 17:52:25 +00:00
|
|
|
|
|
|
|
![License](https://img.shields.io/badge/license-ISC-blue.svg)
|
|
|
|
|
2018-02-03 05:35:43 +00:00
|
|
|
hactool is a tool to view information about, decrypt, and extract common file formats for the Nintendo Switch, especially Nintendo Content Archives.
|
2018-01-24 17:52:25 +00:00
|
|
|
|
|
|
|
It is heavily inspired by [ctrtool](https://github.com/profi200/Project_CTR/tree/master/ctrtool).
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```
|
2018-02-03 05:35:43 +00:00
|
|
|
Usage: hactool [options...] <file>
|
2018-01-24 17:52:25 +00:00
|
|
|
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.
|
2018-02-06 08:04:27 +00:00
|
|
|
-k, --keyset Load keys from an external file.
|
2018-04-26 06:18:34 +00:00
|
|
|
-t, --intype=type Specify input file type [nca, xci, pfs0, romfs, hfs0, npdm, pk11, pk21, ini1, kip1, nax0, keygen]
|
2018-01-24 17:52:25 +00:00
|
|
|
--titlekey=key Set title key for Rights ID crypto titles.
|
|
|
|
--contentkey=key Set raw key for NCA body decryption.
|
|
|
|
NCA options:
|
2018-02-03 19:28:08 +00:00
|
|
|
--plaintext=file Specify file path for saving a decrypted copy of the NCA.
|
|
|
|
--header=file Specify Header file path.
|
2018-01-24 17:52:25 +00:00
|
|
|
--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.
|
2018-02-03 05:38:11 +00:00
|
|
|
--baseromfs Set Base RomFS to use with update partitions.
|
2018-02-03 19:28:08 +00:00
|
|
|
--basenca Set Base NCA to use with update partitions.
|
2018-02-12 11:35:48 +00:00
|
|
|
--basefake Use a fake Base RomFS with update partitions (all reads will return 0xCC).
|
|
|
|
--onlyupdated Ignore non-updated files in update partitions.
|
2018-02-03 05:38:11 +00:00
|
|
|
PFS0 options:
|
2018-02-04 06:09:16 +00:00
|
|
|
--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.
|
2018-02-04 08:21:04 +00:00
|
|
|
XCI options:
|
|
|
|
--rootdir=dir Specify XCI root HFS0 directory path.
|
|
|
|
--updatedir=dir Specify XCI update HFS0 directory path.
|
2018-02-04 08:29:44 +00:00
|
|
|
--normaldir=dir Specify XCI normal HFS0 directory path.
|
|
|
|
--securedir=dir Specify XCI secure HFS0 directory path.
|
2018-05-31 19:55:42 +00:00
|
|
|
--logodir=dir Specify XCI logo HFS0 directory path.
|
2018-02-04 08:21:04 +00:00
|
|
|
--outdir=dir Specify XCI directory path. Overrides previous paths, if present.
|
2018-02-07 08:13:36 +00:00
|
|
|
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:
|
2018-04-26 06:12:38 +00:00
|
|
|
--ini1dir=dir Specify INI1 directory path.
|
|
|
|
--outdir=dir Specify INI1 directory path. Overrides previous path, if present.
|
|
|
|
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).
|
|
|
|
Key Derivation options:
|
|
|
|
--sbk=key Set console unique Secure Boot Key for key derivation.
|
|
|
|
--tseckey=key Set console unique TSEC Key for key derivation.
|
2018-02-03 19:28:08 +00:00
|
|
|
```
|
2018-01-24 17:52:25 +00:00
|
|
|
|
|
|
|
## 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.
|
|
|
|
|
2018-02-03 05:38:11 +00:00
|
|
|
If on Windows, I recommend using MinGW.
|
2018-01-24 17:52:25 +00:00
|
|
|
|
2018-02-06 08:04:27 +00:00
|
|
|
## 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.
|
|
|
|
|
2018-01-24 17:52:25 +00:00
|
|
|
## Licensing
|
|
|
|
|
|
|
|
This software is licensed under the terms of the ISC License.
|
|
|
|
You can find a copy of the license in the LICENSE file.
|