Tutorial Extract and Decrypt games, NAND backups, and SD contents with ninfs

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
5,963
Trophies
2
XP
6,673
Country
United States
Several releases have been put up since my last post here, so here is a summary of them. Some of the notable changes are a rename to ninfs, a standalone release for macOS, support for Nintendo Switch backups, and more.

https://github.com/ihaveamac/ninfs/releases/tag/v1.6

fuse-3ds v1.3
  • Added option to skip a specific update
  • Added option to prevent checking online for updates
  • Fix detection of tkinter on Linux
fuse-3ds v1.3.1
  • New custom icon
  • First release of standalone macOS Application Bundle
  • Minor GUI text updates
ninfs v1.4
  • New feature to mount Nintendo Switch NAND images
    • This requires BIS keys, dumped with Lockpick_RCM or biskeydump.
  • New project name: ninfs
  • Fix incorrect developer common key 0
  • Many other internal changes
ninfs v1.5
  • Support split Nintendo Switch NAND backup files
    • Each part is expected to end in two digits (e.g. rawnand.bin.00, rawnand.bin.01, ...). Any part can be selected, the program will search for all parts starting with 00.
    • The command line argument -S or --split-files is used for a split backup.
    • The GUI will attempt to automatically detect this based on the filename.
  • GUI: Automatically detect Nintendo DSi NAND backups
  • GUI: Fix oversight breaking automatic detection of Nintendo 3DS NAND backups
  • ExeFS: Always show code-decompressed.bin, even if .code is not compressed
ninfs v1.6
  • CDN: Support using a tmd file to mount - #36
    • The GUI now expects a tmd file by default instead of a directory.
  • SD: Support manual SD key input
    • --sd-key reads the key as a hexstring. It cannot be used at the same time as --movable.
    • The GUI currently does not accept the key as a hexstring, only a movable.sed file.
  • CMDLINE: Support --boot9 for loading the ARM9 bootROM from any path
  • SD: Workaround write corruption bug
  • NANDHAC: Performance improvements to AES-XTSN crypto operations by @luigoalma
  • CCI: Remove useless SeedDB option
  • Stability or something, I guess.
 
  • Like
Reactions: paulloeduardo
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,855
Country
United States
Edit - Nevermind. Ignore this post. Issue's resolved with some needed patience.

After several minutes, the program finished extracting my files. :lol:



****

Original Post,

@ihaveamac, I'm using the latest ninfs v1.6.1, installed WinFsp 2019.1, and updated to Python 3.7.3 on my Windows 8.1 64-bit computer. Also have the boot9.bin and June release seeddb.bin at C:\Users\<my user's profile>\AppData\Roaming\3ds.

When trying to use the "nand.bin" option on my nand.bin (1.82 GB) dumped from [S:] SYSNAND VIRTUAL (also tried it with otpotp.bin extracted from essential.exefs), the specified empty New folder doesn't list any of the files.

I have no issues mounting CIAs or other image types. No difference when all my anti-virus programs are disabled in remedying this.

The problem could be something else on my main computer; no way to test ninfs on my spare 64-bit netbook with Linux Mint and Windows 7 (it's kaputt / currently saving money for a replacement mobo).

ninfs_nand.bin_empty.png
 
Last edited by TurdPooCharger,

PhotoGuyBob

New Member
Newbie
Joined
Jul 12, 2019
Messages
2
Trophies
0
Age
38
XP
16
Country
United States
IHaveAMac, thanks for all your work on this. It's so rare to find tools like this that run on MacOS! I wonder if you could help me with a bug. I have my boot9 and SeedDB dumped, and I am attempting to mount CIA files from a .3DS file.. When I do so, it fails with the following error:


File "ninfs/pyctr/types/tmd.py", line 222, in load
KeyError: 0

It's the InvalidSignatureTypeError and it also fails to handle it.

Traceback (most recent call last):
File "ninfs/_pyi_main.py", line 31, in <module>
File "ninfs/main.py", line 80, in mount
File "ninfs/mount/cia.py", line 239, in main
File "ninfs/mount/cia.py", line 68, in __init__
File "ninfs/pyctr/types/tmd.py", line 224, in load
pyctr.types.tmd.InvalidSignatureTypeError: 0x00000000

I have Fuse installed.
I thought perhaps I was using the app wrong, and designated the type to mount as .3DS, but that seems to just lock up ninfs and Finder on me..
OSX Version: 10.14.5
PYthon Version: 2.7.10
 
Last edited by PhotoGuyBob,

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
5,963
Trophies
2
XP
6,673
Country
United States
IHaveAMac, thanks for all your work on this. It's so rare to find tools like this that run on MacOS! I wonder if you could help me with a bug. I have my boot9 and SeedDB dumped, and I am attempting to mount CIA files from a .3DS file.. When I do so, it fails with the following error:


File "ninfs/pyctr/types/tmd.py", line 222, in load
KeyError: 0

It's the InvalidSignatureTypeError and it also fails to handle it.

Traceback (most recent call last):
File "ninfs/_pyi_main.py", line 31, in <module>
File "ninfs/main.py", line 80, in mount
File "ninfs/mount/cia.py", line 239, in main
File "ninfs/mount/cia.py", line 68, in __init__
File "ninfs/pyctr/types/tmd.py", line 224, in load
pyctr.types.tmd.InvalidSignatureTypeError: 0x00000000

I have Fuse installed.
I thought perhaps I was using the app wrong, and designated the type to mount as .3DS, but that seems to just lock up ninfs and Finder on me..
OSX Version: 10.14.5
PYthon Version: 2.7.10
What exactly do you mean by "I am attempting to mount CIA files from a .3DS file."? It looks like you're using the CIA mount, but you're not choosing a CIA file. Make sure you choose 'CTR Cart Image (".3ds", ".cci")'.
 

PhotoGuyBob

New Member
Newbie
Joined
Jul 12, 2019
Messages
2
Trophies
0
Age
38
XP
16
Country
United States
Thanks for the quick reply. Yeah, I think I may have been using the app incorrectly at first. Mounting it as a CTR does seem to be locking up the whole OS, though.. Gradually crashing the whole computer. Hopefully I can tinker a bit later today.
 

perkel

Well-Known Member
Member
Joined
Dec 28, 2015
Messages
247
Trophies
0
Age
34
XP
267
Country
Poland
Getting error trying to mount .ncch:

Running: ['D:\\Emulators\\Nintendo - [3DS] Nintendo 3DS\\_tools\\ninfs-1.7b1-win64\\ninfs.exe', 'ncch', '-f', 'Z:\\content0.game.ncch', 'Y:']
ninfs v1.7b1 - https://github.com/ihaveamac/ninfs
Traceback (most recent call last):
File "ninfs\pyctr\types\exefs.py", line 209, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 1: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "ninfs\_pyi_main.py", line 31, in <module>
File "ninfs\main.py", line 80, in mount
File "ninfs\mount\ncch.py", line 152, in main
File "ninfs\pyctr\types\ncch.py", line 245, in __init__
File "ninfs\pyctr\types\ncch.py", line 283, in load_sections
File "ninfs\pyctr\types\exefs.py", line 211, in __init__
pyctr.types.exefs.ExeFSNameError: could not decode from ascii: b'(\xe3\xa4N\xf0^w\xe3'
[7172] Failed to execute script _pyi_main
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
5,963
Trophies
2
XP
6,673
Country
United States
Getting error trying to mount .ncch:

Running: ['D:\\Emulators\\Nintendo - [3DS] Nintendo 3DS\\_tools\\ninfs-1.7b1-win64\\ninfs.exe', 'ncch', '-f', 'Z:\\content0.game.ncch', 'Y:']
ninfs v1.7b1 - https://github.com/ihaveamac/ninfs
Traceback (most recent call last):
File "ninfs\pyctr\types\exefs.py", line 209, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 1: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "ninfs\_pyi_main.py", line 31, in <module>
File "ninfs\main.py", line 80, in mount
File "ninfs\mount\ncch.py", line 152, in main
File "ninfs\pyctr\types\ncch.py", line 245, in __init__
File "ninfs\pyctr\types\ncch.py", line 283, in load_sections
File "ninfs\pyctr\types\exefs.py", line 211, in __init__
pyctr.types.exefs.ExeFSNameError: could not decode from ascii: b'(\xe3\xa4N\xf0^w\xe3'
[7172] Failed to execute script _pyi_main
Try the release I just put out, which has an option to support files that were decrypted with very old methods: "Assume decrypted" https://github.com/ihaveamac/ninfs/releases/tag/v1.7b2
 

ReyVGM

Game Endings Master
Member
Joined
Oct 26, 2002
Messages
695
Trophies
0
Website
www.vgmuseum.com
XP
607
Country
@ihaveamac , do you know what is this problem I'm having?

I'm trying to mount a DSI-1.MMC (DSi NAND renamed to work with no$gba). I'm using windows 7 64bit, I am NOT running as an admin, and I selected "Nintendo DSi NAND backup ("nand_dsi.bin") as the output.

If I select a drive letter ( Z: ) and mount, I can see the files inside just fine. But if I try to overwrite a file, it tells me there's no enough space. Even if I delete the same file I'm trying to overwrite (to make space), it still gives me the same message.

But if I instead create a new directory, then it will mount just fine BUT the directory will be empty.

Here's an image of what it says when I use a new directory for mounting.
Fkovanm.png


Any help would be appreciated. Thanks.
 
Last edited by ReyVGM,

locutus77

New Member
Newbie
Joined
Jan 3, 2020
Messages
2
Trophies
0
Age
40
XP
14
Country
Germany
Hey there and happy new year.

one of my (and my sons) loved 2DS just died and I am in trouble restoring my and my sons saves to a new and fresh hacked 2ds xl.
i was able to run the tool in windows 10 and mac os but getting this error:

Code:
LocutusMacBookAir:~ locutus$ python3.7 -mninfs gui
Importing dependencies...
Creating new update config...
Wrote update config to /Users/locutus/Library/Application Support/fuse-3ds/update.cfg
Setting up GUI...
Doing final setup...
UPDATE: Checking for updates... (Currently running v1.7b2)
Starting the GUI!
UPDATE: No new version. (Latest is v1.7b2)
2020-01-03 10:41:50.094 Python[5287:65134] WARNING: <NSOpenPanel: 0x7ffb83726ad0> running implicitly; please run panels using NSSavePanel rather than NSApplication.

----------------------------------------------------------------------------------------------------

Running: ['/usr/local/bin/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninfs', 'sd', '-f', '/Volumes/2DS_GELB', '/Users/locutus/Desktop/2DS_SD_CARD', '--movable', '/Volumes/2DS_GELB/gm9/out/movable.sed', '-r']

Failed to find f8fbf8f624d89e69b883e21e7cb2e5b5 in the SD dir.

----------------------------------------------------------------------------------------------------

I have no idea what this means and was not able to find more information here in that post or on github issues.
I put in the right boot9.firm and seeddb.bin and also the movable.sed.

the tool pops up an error message after hitting "mount" which say: "Failed to mount. Please check the output."
on windows both mount options aren't working, on mac os mount to folder option is the only one and is also throws this error.

the log file is empty.

Can someone please help me rescuing my and my sons saves?

kind regards from berlin
 
Last edited by locutus77,

KleinesSinchen

GBAtemp's Backup Reminder + Fearless Testing Sina
Member
GBAtemp Patron
Joined
Mar 28, 2018
Messages
2,704
Trophies
2
XP
6,305
Country
Germany
Code:
Running: ['/usr/local/bin/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninfs', 'sd', '-f', '/Volumes/2DS_GELB', '/Users/locutus/Desktop/2DS_SD_CARD', '--movable', '/Volumes/2DS_GELB/gm9/out/movable.sed', '-r']

Failed to find f8fbf8f624d89e69b883e21e7cb2e5b5 in the SD dir.
Don' try to mount 'SD:/' but 'SD:/Nintendo 3DS'
From the error output the path should probably be '/Volumes/2DS_GELB/Nintendo 3DS'

Can someone please help me rescuing my and my sons saves?
I know this is not gonna help you now but being GBAtemp's Backup Reminder I have to: Please use JKSM and/or Checkpoint and copy the backups to multiple locations from time to time! This will save you sooo much time and trouble if the SD/console fails, something get's deleted or whatever.

In general getting the saves back is possible as long as you have the SD contents and movable.sed – which you do. After obtaining the decrypted save files injecting them into the N2DSXL micro-SD may require repairing the CMACs.
 

locutus77

New Member
Newbie
Joined
Jan 3, 2020
Messages
2
Trophies
0
Age
40
XP
14
Country
Germany
Don' try to mount 'SD:/' but 'SD:/Nintendo 3DS'
From the error output the path should probably be '/Volumes/2DS_GELB/Nintendo 3DS'

oh hell YES... that was the thing ;) THX this was the one missing piece... one step further

I know this is not gonna help you now but being GBAtemp's Backup Reminder I have to: Please use JKSM and/or Checkpoint and copy the backups to multiple locations from time to time! This will save you sooo much time and trouble if the SD/console fails, something get's deleted or whatever.

In general getting the saves back is possible as long as you have the SD contents and movable.sed – which you do. After obtaining the decrypted save files injecting them into the N2DSXL micro-SD may require repairing the CMACs.

you are so right... i was so stupid in not taking care of good backups... now i have the salad (like we say in german with silly english skills :D)
i will promise in doing better just in the minute I was able to recover everything i will to save game exports with Checkpoint backup those somewhere else.

thx again... you saved my life and the importent pokemon saves of my son ;)
 

Chuardo

Well-Known Member
Member
Joined
Oct 4, 2015
Messages
382
Trophies
0
Age
21
XP
830
Country
Uruguay
My 3DS died but I have my movable.sed file and my Nintendo 3DS folder, I want to transfer my savefiles to another 3DS that I got, after putting Nintendo 3DS and movable.sed on ninfs it mounts a new Drive with the exact same files and folders that Nintendo 3DS already has, how do I decrypt them into .sav files so I can inyect them in another 3DS? I want to know what to use to get my saves off the decrypted "Nintendo 3DS SD Card" mount drive
 
Last edited by Chuardo,

KleinesSinchen

GBAtemp's Backup Reminder + Fearless Testing Sina
Member
GBAtemp Patron
Joined
Mar 28, 2018
Messages
2,704
Trophies
2
XP
6,305
Country
Germany
My 3DS died but I have my movable.sed file and my Nintendo 3DS folder, I want to transfer my savefiles to another 3DS that I got, after putting Nintendo 3DS and movable.sed on ninfs it mounts a new Drive with the exact same files and folders that Nintendo 3DS already has, how do I decrypt them into .sav files so I can inyect them in another 3DS? I want to know what to use to get my saves off the decrypted "Nintendo 3DS SD Card" mount drive
No, not exactly the same files and folders; ninfs decrypts anything you read from the newly mounted drive on the fly (and encrypts everything you write to the drive if writing is allowed).

You really should have backed up your saves with Checkpoint and/or JKSM from time to time. This would have saved a lot of trouble.


============
I'm currently not able to do any tests because my test console is partially disassembled. I was able to mass backup the saves with

cd /mnt/<ID_Number>
rsync -av title /home/username/savebackup/ --exclude=*.app --exclude *.tmd --exclude=*.cmd


This copies the folder structure and omits any files but the saves. Copy+paste of the decyrpted backup into the ninfs or GodMode9 mounted "Nintendo 3DS" directory of the new console (into the correct subfolder of course) should work. Don't forget fix CMACs for the drive in GodMode9 and deleting "Secure Value" for games using anti-savegame restore.
  • Install games on the new console first because installing a .CIA overwrites the save.
  • Create a backup of the SD content from the new console before writing the saves in there – just in case it does not work as intended.
 
Last edited by KleinesSinchen,

Kwyjor

Well-Known Member
Member
Joined
May 23, 2018
Messages
1,954
Trophies
1
XP
2,419
Country
Canada
how do I decrypt them into .sav files so I can inyect them in another 3DS?
Copy the files from the mounted drive to anywhere else on your hard drive, and they will automatically be decrypted.

To get files you can import using JKSM or Checkpoint, you will need to run 3ds-save-tool on each of the .sav files after you decrypt them. 3ds-save-tool is a command-line Python program. Or you can mount your new SD card (with its new movable.sed), re-encrypt the .sav files by copying them to the appropriate subfolders, and then fix the CMACs, as suggested by KleinesSinchen.

Alternatively, I see save3ds has a Windows binary now, but that is also command-line only and I don't think it would be much easier to deal with that than it would be to use ninfs+3ds-save-tool.

There's also threeSD. It is supposed to be used for decrypting SD card data for use in Citra and not really for recovering data from the SD card of a dead 3DS. I haven't poked at it at all, but if you configure it correctly it might help you get decrypted and unpacked .sav files with slightly less hassle than using ninfs+3ds-save-tool.
 
  • Like
Reactions: Chuardo

Equanzo

New Member
Newbie
Joined
Aug 14, 2021
Messages
3
Trophies
0
Age
21
XP
27
Country
United States
Copy the files from the mounted drive to anywhere else on your hard drive, and they will automatically be decrypted.

To get files you can import using JKSM or Checkpoint, you will need to run 3ds-save-tool on each of the .sav files after you decrypt them. 3ds-save-tool is a command-line Python program.

How do you run the 3ds-save-tool?
 

T0biasCZe

Well-Known Member
Newcomer
Joined
Oct 4, 2019
Messages
99
Trophies
0
Age
16
XP
436
Country
Czech Republic
For SD, you can browse the decrypted contents, and use something like the titledir mount to browse the installed games. You can also write to it, and the files you write will be re-encrypted.
how to re-encrypt the decrypted files for different 3DS console ?
 

Kwyjor

Well-Known Member
Member
Joined
May 23, 2018
Messages
1,954
Trophies
1
XP
2,419
Country
Canada
how to re-encrypt the decrypted files for different 3DS console ?
Exactly like it says: mount the SD card using ninfs, and copy files to the mounted SD card. This automatically encrypts files, just like copying files off the mounted SD card automatically decrypts them.

This may not be an especially useful function since in some cases you will still have to fix the CMACs of the encrypted files using godmode9, and if you are dealing with save data, you may need to worry about Anti Savegame Restore. This is discussed in the post above.
 
Last edited by Kwyjor,
  • Like
Reactions: KleinesSinchen
General chit-chat
Help Users
  • No one is chatting at the moment.
    Veho @ Veho: https://i.imgur.com/wUVjgO3.mp4