mirror of
https://github.com/SciresM/hactool
synced 2024-11-21 19:53:01 +00:00
Re-brand ourselves, bump version number to 0.9
This commit is contained in:
parent
c25a188f1e
commit
6213403ffb
19 changed files with 59 additions and 59 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
|||
/config.mk
|
||||
/ncatool
|
||||
/ncatool.exe
|
||||
/hactool
|
||||
/hactool.exe
|
||||
/pki_zero.c
|
||||
/pki_full.c
|
||||
/pki_staging.c
|
||||
|
|
16
Makefile
16
Makefile
|
@ -12,12 +12,12 @@ CFLAGS += -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOU
|
|||
|
||||
all:
|
||||
cd mbedtls && $(MAKE) lib
|
||||
$(MAKE) ncatool
|
||||
$(MAKE) hactool
|
||||
|
||||
.c.o:
|
||||
$(CC) $(INCLUDE) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
ncatool: sha.o aes.o rsa.o npdm.o bktr.o pki.o pfs0.o utils.o nca.o main.o filepath.o
|
||||
hactool: sha.o aes.o rsa.o npdm.o bktr.o pki.o pfs0.o utils.o nca.o main.o filepath.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS) -L $(LIBDIR)
|
||||
|
||||
aes.o: aes.h types.h
|
||||
|
@ -43,14 +43,14 @@ sha.o: sha.h types.h
|
|||
utils.o: utils.h types.h
|
||||
|
||||
clean:
|
||||
rm -f *.o ncatool ncatool.exe
|
||||
rm -f *.o hactool hactool.exe
|
||||
cd mbedtls && $(MAKE) clean
|
||||
|
||||
dist:
|
||||
$(eval NCATOOLVER = $(shell grep '\bNCATOOL_VERSION\b' version.h \
|
||||
$(eval HACTOOLVER = $(shell grep '\bHACTOOL_VERSION\b' version.h \
|
||||
| cut -d' ' -f2 \
|
||||
| sed -e 's/"//g'))
|
||||
mkdir ncatool-$(NCATOOLVER)
|
||||
cp *.c *.h config.mk.template Makefile README.md LICENSE ncatool-$(NCATOOLVER)
|
||||
tar czf ncatool-$(NCATOOLVER).tar.gz ncatool-$(NCATOOLVER)
|
||||
rm -r ncatool-$(NCATOOLVER)
|
||||
mkdir hactool-$(HACTOOLVER)
|
||||
cp *.c *.h config.mk.template Makefile README.md LICENSE hactool-$(HACTOOLVER)
|
||||
tar czf hactool-$(HACTOOLVER).tar.gz hactool-$(HACTOOLVER)
|
||||
rm -r hactool-$(HACTOOLVER)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# ncatool
|
||||
# hactool
|
||||
|
||||
![License](https://img.shields.io/badge/license-ISC-blue.svg)
|
||||
|
||||
ncatool is a tool to view information about, decrypt, and extract Nintendo Content Archives.
|
||||
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](https://github.com/profi200/Project_CTR/tree/master/ctrtool).
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
Usage: ncatool [options...] <file>
|
||||
Usage: hactool [options...] <file>
|
||||
Options:
|
||||
-i, --info Show file info.
|
||||
This is the default action.
|
||||
|
|
4
aes.h
4
aes.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_AES_H
|
||||
#define NCATOOL_AES_H
|
||||
#ifndef HACTOOL_AES_H
|
||||
#define HACTOOL_AES_H
|
||||
|
||||
#include "mbedtls/cipher.h"
|
||||
|
||||
|
|
4
bktr.h
4
bktr.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_BKTR_H
|
||||
#define NCATOOL_BKTR_H
|
||||
#ifndef HACTOOL_BKTR_H
|
||||
#define HACTOOL_BKTR_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_FILEPATH_H
|
||||
#define NCATOOL_FILEPATH_H
|
||||
#ifndef HACTOOL_FILEPATH_H
|
||||
#define HACTOOL_FILEPATH_H
|
||||
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
|
|
4
ivfc.h
4
ivfc.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_IVFC_H
|
||||
#define NCATOOL_IVFC_H
|
||||
#ifndef HACTOOL_IVFC_H
|
||||
#define HACTOOL_IVFC_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
|
10
main.c
10
main.c
|
@ -9,12 +9,12 @@
|
|||
#include "pki.h"
|
||||
#include "nca.h"
|
||||
|
||||
static char *prog_name = "ncatool";
|
||||
static char *prog_name = "hactool";
|
||||
|
||||
/* Print usage. Taken largely from ctrtool. */
|
||||
static void usage(void) {
|
||||
fprintf(stderr,
|
||||
"ncatool (c) SciresM.\n"
|
||||
"hactool (c) SciresM.\n"
|
||||
"Built: %s %s\n"
|
||||
"\n"
|
||||
"Usage: %s [options...] <file>\n"
|
||||
|
@ -90,12 +90,12 @@ void parse_hex_key(unsigned char *key, const char *hex) {
|
|||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
ncatool_ctx_t tool_ctx;
|
||||
ncatool_ctx_t base_ctx; /* Context for base NCA, if used. */
|
||||
hactool_ctx_t tool_ctx;
|
||||
hactool_ctx_t base_ctx; /* Context for base NCA, if used. */
|
||||
nca_ctx_t nca_ctx;
|
||||
char input_name[0x200];
|
||||
|
||||
prog_name = (argc < 1) ? "ncatool" : argv[0];
|
||||
prog_name = (argc < 1) ? "hactool" : argv[0];
|
||||
|
||||
nca_init(&nca_ctx);
|
||||
memset(&tool_ctx, 0, sizeof(tool_ctx));
|
||||
|
|
8
nca.h
8
nca.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_NCA_H
|
||||
#define NCATOOL_NCA_H
|
||||
#ifndef HACTOOL_NCA_H
|
||||
#define HACTOOL_NCA_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -146,7 +146,7 @@ typedef struct {
|
|||
nca_fs_header_t *header;
|
||||
int is_decrypted;
|
||||
aes_ctx_t *aes; /* AES context for the section. */
|
||||
ncatool_ctx_t *tool_ctx;
|
||||
hactool_ctx_t *tool_ctx;
|
||||
union {
|
||||
pfs0_ctx_t pfs0_ctx;
|
||||
romfs_ctx_t romfs_ctx;
|
||||
|
@ -167,7 +167,7 @@ typedef struct nca_ctx {
|
|||
int is_decrypted;
|
||||
validity_t fixed_sig_validity;
|
||||
validity_t npdm_sig_validity;
|
||||
ncatool_ctx_t *tool_ctx;
|
||||
hactool_ctx_t *tool_ctx;
|
||||
unsigned char decrypted_keys[4][0x10];
|
||||
unsigned char title_key[0x10];
|
||||
nca_section_ctx_t section_contexts[4];
|
||||
|
|
2
npdm.c
2
npdm.c
|
@ -600,7 +600,7 @@ void fac_print(fac_t *fac, fah_t *fah) {
|
|||
}
|
||||
|
||||
|
||||
void npdm_print(npdm_t *npdm, ncatool_ctx_t *tool_ctx) {
|
||||
void npdm_print(npdm_t *npdm, hactool_ctx_t *tool_ctx) {
|
||||
printf("NPDM:\n");
|
||||
print_magic(" Magic: ", npdm->magic);
|
||||
printf(" MMU Flags: %"PRIx8"\n", npdm->mmu_flags);
|
||||
|
|
6
npdm.h
6
npdm.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_NPDM_H
|
||||
#define NCATOOL_NPDM_H
|
||||
#ifndef HACTOOL_NPDM_H
|
||||
#define HACTOOL_NPDM_H
|
||||
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
|
@ -132,6 +132,6 @@ static inline npdm_aci0_t *npdm_get_aci0(npdm_t *npdm) {
|
|||
return (npdm_aci0_t *)((char *)npdm + npdm->aci0_offset);
|
||||
}
|
||||
|
||||
void npdm_print(npdm_t *npdm, ncatool_ctx_t *tool_ctx);
|
||||
void npdm_print(npdm_t *npdm, hactool_ctx_t *tool_ctx);
|
||||
|
||||
#endif
|
||||
|
|
6
pfs0.h
6
pfs0.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_PFS0_H
|
||||
#define NCATOOL_PFS0_H
|
||||
#ifndef HACTOOL_PFS0_H
|
||||
#define HACTOOL_PFS0_H
|
||||
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
|
@ -35,7 +35,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
pfs0_superblock_t *superblock;
|
||||
FILE *file;
|
||||
ncatool_ctx_t *tool_ctx;
|
||||
hactool_ctx_t *tool_ctx;
|
||||
validity_t superblock_hash_validity;
|
||||
validity_t hash_table_validity;
|
||||
int is_exefs;
|
||||
|
|
4
pki.h
4
pki.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_PKI_H
|
||||
#define NCATOOL_PKI_H
|
||||
#ifndef HACTOOL_PKI_H
|
||||
#define HACTOOL_PKI_H
|
||||
#include <string.h>
|
||||
#include "types.h"
|
||||
#include "settings.h"
|
||||
|
|
4
rsa.h
4
rsa.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_RSA_H
|
||||
#define NCATOOL_RSA_H
|
||||
#ifndef HACTOOL_RSA_H
|
||||
#define HACTOOL_RSA_H
|
||||
|
||||
#include "mbedtls/rsa.h"
|
||||
|
||||
|
|
18
settings.h
18
settings.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_SETTINGS_H
|
||||
#define NCATOOL_SETTINGS_H
|
||||
#ifndef HACTOOL_SETTINGS_H
|
||||
#define HACTOOL_SETTINGS_H
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "filepath.h"
|
||||
|
@ -12,7 +12,7 @@ typedef enum {
|
|||
typedef enum {
|
||||
BASEFILE_ROMFS,
|
||||
BASEFILE_NCA
|
||||
} ncatool_basefile_t;
|
||||
} hactool_basefile_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char master_keys[0x20][0x10]; /* Firmware master keys. */
|
||||
|
@ -50,9 +50,9 @@ typedef struct {
|
|||
override_filepath_t romfs_path;
|
||||
override_filepath_t romfs_dir_path;
|
||||
filepath_t out_dir_path;
|
||||
} ncatool_settings_t;
|
||||
} hactool_settings_t;
|
||||
|
||||
enum ncatool_file_type
|
||||
enum hactool_file_type
|
||||
{
|
||||
FILETYPE_NCA,
|
||||
FILETYPE_PFS0
|
||||
|
@ -67,14 +67,14 @@ enum ncatool_file_type
|
|||
struct nca_ctx; /* This will get re-defined by nca.h. */
|
||||
|
||||
typedef struct {
|
||||
enum ncatool_file_type file_type;
|
||||
enum hactool_file_type file_type;
|
||||
FILE *file;
|
||||
FILE *base_file;
|
||||
ncatool_basefile_t base_file_type;
|
||||
hactool_basefile_t base_file_type;
|
||||
struct nca_ctx *base_nca_ctx;
|
||||
ncatool_settings_t settings;
|
||||
hactool_settings_t settings;
|
||||
uint32_t action;
|
||||
} ncatool_ctx_t;
|
||||
} hactool_ctx_t;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
4
sha.h
4
sha.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_SHA_H
|
||||
#define NCATOOL_SHA_H
|
||||
#ifndef HACTOOL_SHA_H
|
||||
#define HACTOOL_SHA_H
|
||||
|
||||
#include "mbedtls/md.h"
|
||||
|
||||
|
|
4
types.h
4
types.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_TYPES_H
|
||||
#define NCATOOL_TYPES_H
|
||||
#ifndef HACTOOL_TYPES_H
|
||||
#define HACTOOL_TYPES_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
|
4
utils.h
4
utils.h
|
@ -1,5 +1,5 @@
|
|||
#ifndef NCATOOL_UTILS_H
|
||||
#define NCATOOL_UTILS_H
|
||||
#ifndef HACTOOL_UTILS_H
|
||||
#define HACTOOL_UTILS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef NCATOOL_VERSION_H
|
||||
#define NCATOOL_VERSION_H
|
||||
#ifndef HACTOOL_VERSION_H
|
||||
#define HACTOOL_VERSION_H
|
||||
|
||||
/* Will become 1.0 when BKTR is implemented and I've done some refactoring... */
|
||||
#define NCATOOL_VERSION "0.8"
|
||||
#define HACTOOL_VERSION "0.9"
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue