Hacking [Release] CDecrypt v4.x

VitaSmith

Member
OP
Newcomer
Joined
Dec 10, 2020
Messages
10
Trophies
0
Age
42
XP
76
Country
Ireland
CDecrypt is a small application that decrypts/unpacks Wii U NUS Content.

This is an updated version of the original CDecrypt by crediar.

This updated version:
  • Has no external dependency whatsoever (no libOpenSSL or MSVC redistributable)
  • Has its releases built publicly on AppVeyor (which you can validate with the SHA-256 of the archive output in the build log, so that you can confirm that the download doesn't include anything hidden/malicious)
  • Can be compiled for Windows, Linux and macOS
  • Supports long paths on platforms that allow it
  • Supports international characters in path names
  • Does not need the executable to reside in the same directory as the content
  • Accepts either a file or directory (including non .tik/.tmd files)
  • Accepts an optional target directory for extraction
  • And is of course fully Open Source (GPLv3+) with its source on GitHub
You can download the latest Windows release HERE.

Enjoy! ^_^
 
Last edited by VitaSmith,

VitaSmith

Member
OP
Newcomer
Joined
Dec 10, 2020
Messages
10
Trophies
0
Age
42
XP
76
Country
Ireland
I'm not planning to do that for the time being, as the vast majority of people will run Windows, and recompiling for Linux is very straightforward (as opposed to compiling anything for Windows, since most Windows users don't have a toolchain available).

Also, some people will want ARM64 Linux binaries, other x86_32 bit binaries and others x86_64 binaries, which makes it a pain in the ass to satisfy everyone. It's just too much effort for too little benefit, when anybody on Linux is just a git clone https://github.com/VitaSmith/cdecrypt.git; cd cdecrypt; make away from a binary.

But if you have trouble compiling CDecrypt on Linux, please let me know (or log an issue in the issue tracker).
 
Last edited by VitaSmith,

ber71

Well-Known Member
Member
Joined
Apr 24, 2019
Messages
306
Trophies
0
Age
56
XP
1,447
Country
Spain
It compiles fine, no problem with that.

After a look at the code, you may want to not hardcode the wiiu common keys as these could get you into troubles. Old cdcrypt releases read them from a keys.txt file.

Another suggestion: missing from the old versions is the ability to set an output directory.
 

VitaSmith

Member
OP
Newcomer
Joined
Dec 10, 2020
Messages
10
Trophies
0
Age
42
XP
76
Country
Ireland
I considered what you suggest long before officially publishing the project, and rejected both options because:
  1. There are other projects on GitHub with these keys and this is a fork of the Google Code project that already had them. Considering that these have been up for years without any trouble, I don't see the caution being warranted, especially when it would make it exceedingly inconvenient for users.
  2. I don't expect there will be much demand for extraction into a custom directory, and considering that this is a very niche product, there's only so much time I want to invest adding features that few people are going to use.
 
Last edited by VitaSmith,

VitaSmith

Member
OP
Newcomer
Joined
Dec 10, 2020
Messages
10
Trophies
0
Age
42
XP
76
Country
Ireland
Well, since I needed an excuse to release a new version, now that I have added macOS compilation support, I have just added the ability to provide an optional target extraction directory (while keeping compatibility with previous versions of CDecrypt that may take both a .tmd and .tik as parameters).
 
  • Like
Reactions: ber71

Rudi Rastelli

Well-Known Member
Newcomer
Joined
Sep 15, 2007
Messages
83
Trophies
0
XP
369
Country
Gambia, The
But if you have trouble compiling CDecrypt on Linux, please let me know (or log an issue in the issue tracker).

Hi... I've tried to compile it on LInux Mint and here's the output of "make":
Code:
[C] cdecrypt.c
cdecrypt.c: In function ‘extract_file_hash’:
cdecrypt.c:241:9: error: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Werror=unused-result]
  241 |         fread(enc, sizeof(char), BLOCK_SIZE, src);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cdecrypt.c: In function ‘extract_file’:
cdecrypt.c:327:9: error: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Werror=unused-result]
  327 |         fread(enc, sizeof(char), BLOCK_SIZE, src);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:33: cdecrypt.o] Fehler 1

Next i removed '-Werror' option from the CFLAGS line in "Makefile". Now it compiled fine but when i use it i get an error after a while:
Code:
.
.
.
ERROR: Could not open: '/home/rudi/Arbeit/RetroBat/roms/wiiu/Yoshi/0000000A'

Is this because Linux is case sensitive ? ("/home/rudi/Arbeit/RetroBat/roms/wiiu/Yoshi/0000000a.app" exists, but not "0000000A.app")


EDIT 1:
Because i had a lot of games to convert i switched over to Windows (to avoid the probs described above) and made a small script to batch process all Games in my WiiU-games-folder.

If anyone likes to use iit....
Download "Batch_cdecrypt.txt", place it beside "cdecrypt.exe" and rename it to "Batch_cdecrypt.bat".
Now drag and drop the folder which holds your encrypted games/updates/dlcs into "Batch_cdecrypt.bat" to start the batch decryption.
You'll find decrypted games in same folder where "cdecrypt.exe" is.

EDIT 2:
Fixed a small bug in "Batch_cdecrypt.bat"... so pls re-download it
 

Attachments

  • Batch_cdecrypt.txt
    136 bytes · Views: 187
Last edited by Rudi Rastelli,
  • Like
Reactions: andreiarturo

ber71

Well-Known Member
Member
Joined
Apr 24, 2019
Messages
306
Trophies
0
Age
56
XP
1,447
Country
Spain
For some reason, cdecrypt cant unpack 99seconds (titleid=0005000010182700). Not a bad internet dump, but from funkiiu.
That title can be correctly extracted with the wiiu-things scripts.
 

EliteMario97

Member
Newcomer
Joined
Mar 8, 2018
Messages
6
Trophies
0
Location
Somewhere
XP
75
Country
Guinea-Bissau
I compiled on Linux, no problems with that but when trying to use the command 'cdecrypt' it says that it isn't a command.
Edit: I got it working, I had to include the "./" before cdecrypt
 
Last edited by EliteMario97,

dojafoja

life elevated
Member
Joined
Jan 2, 2014
Messages
684
Trophies
0
XP
2,180
Country
I compiled on Linux, no problems with that but when trying to use the command 'cdecrypt' it says that it isn't a command.
Edit: I got it working, I had to include the "./" before cdecrypt
In Linux environments ./ is used to execute a file in the current directory. Using ../ will execute a file in the parent directory. Without using ./ or ../ or giving a full or relative path, it is assumed that the file can be found in $PATH.
 

Rashka

Well-Known Member
Newcomer
Joined
Dec 22, 2014
Messages
66
Trophies
0
Age
41
XP
170
Country
Gambia, The
Hey guys.
I "googled" a lot, but I can't find anything regarding to my needs.
How can i use a parameter to decrypt to another target folder?

Code:
cdecrypt "path to game\title.tik" "path to game\title.tmd"
works fine but extracts the files within the source folder.

On GitHub it says
Code:
cdecrypt <NUS file or directory> [<target directory or existing file>]

But if I use something like
Code:
cdecrypt "path to game\title.tik" "path to game\title.tmd" "C:\temp"
Code:
cdecrypt "path to game\" "C:\temp"
Code:
cdecrypt "path to game\title.tik" "C:\temp"
Code:
cdecrypt "path to game\title.tik" [C:\temp]
or similar, it does nothing.

I think i missed something, but I don't get what
[btw.: I'm on Win10]
 
Last edited by Rashka,
General chit-chat
Help Users
  • No one is chatting at the moment.
    KenniesNewName @ KenniesNewName: https://youtube.com/shorts/gsT4LItG_kU?feature=share Serious George