[Release] 3DSFAT16tool - dump/inject the fat16 partition from nand dumps

Discussion in '3DS - Flashcards & Custom Firmwares' started by cearp, Jan 29, 2015.

  1. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,777
    May 26, 2008
    Tuvalu
    I wanted a better/faster way to extract the fat16 partition from the nand dump, so I made a python tool to do it. Opening up a hex editor and doing it like that is possible, but some hex editors are better than others and difficult to use for some people, but this tool I made is nice and easy to use.
    It supports dumping and injecting it, and supports the 'normal' 3ds nand and new3ds nand.
    I'm sure I could detect it automatically, but for new3ds you need to add '-n3ds' as an argument. (although this is not useful for n3ds right now because we don't have public nand access, but later it will be useful)

    Naturally you need to xor the fat16 partition to make it readable, so xor is after dumping, and re-xor it before injecting.

    For browsing/editing the fat16 file, instead of relying on something weird like 'WinImage' - just rename the fat16 file as '.iso', then I simply double click it and it mounts just like any other drive/volume on my computer - easy editing! I'm on mac so it is very easy for me to do. I'm not sure how easy it is to mount disks on windows...
     

    Attached Files:



  2. Kakkoii

    Kakkoii Old fart

    Member
    621
    282
    Sep 14, 2007
    Canada
    For Windows users, WinCDEmu is a great tool that simply adds the functionality directly into Windows to mount ISOs and a few other formats by simply right clicking and mounting.
    Or you can just open the ISO with 7Zip or Winrar, they both browse ISO files fine and can modify them.
     
    cearp likes this.
  3. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,777
    May 26, 2008
    Tuvalu
    i thought i read windows 7 had 'iso' support, or something like that? not sure if it does, or 8, etc. (even so it might not make it writeable etc, on mac at least it treats it just like a flash drive/etc)
    i remember when i used to use daemon tools etc, but that many many years ago :)
     
  4. Kakkoii

    Kakkoii Old fart

    Member
    621
    282
    Sep 14, 2007
    Canada
    Yeah that would be Windows 8 hehe. And I am glad to be rid of Daemon Tools... it funked with system files too much and took up active resources.
     
    Margen67 and cearp like this.
  5. mid-kid

    mid-kid GBAtemp spamBOT

    Member
    879
    962
    Aug 2, 2012
    How would I go about "xoring"?
     
  6. mvmiranda

    mvmiranda GBAtemp Maniac

    Member
    1,212
    419
    Oct 29, 2013
    Brazil
    Brazil, Sao Paulo
    using Python 2.7.9 for windows I get one error:

    \3DSFAT16tool>python 3DSFAT16tool.py -d emuNAND_94_Based_on_4.5.bin emuNAND_94_Based_on_4.5_FAT16.bin
    *******
    3DSFAT16tool
    *******

    Dumping... please wait
    Traceback (most recent call last):
    File "3DSFAT16tool.py", line 57, in <module>
    fat16 = nand[start:end]
    MemoryError

    \3DSFAT16tool>
     
  7. mid-kid

    mid-kid GBAtemp spamBOT

    Member
    879
    962
    Aug 2, 2012
    MemoryError usually means you lack RAM.
     
  8. Dartz150

    Dartz150 GBATemp Official Lolicon Onii-chan™

    Member
    1,406
    844
    May 5, 2010
    Mexico
    On a Strange Journey
    So the step of the another tutorial where I need to copy and paste the content of test.bin to emuNAND.bin with the hex editor, is basically this? I[f so, it should be replaced in the tutorial as well, that copy/paste was a pain in the ass for me.
     
  9. mvmiranda

    mvmiranda GBAtemp Maniac

    Member
    1,212
    419
    Oct 29, 2013
    Brazil
    Brazil, Sao Paulo
    Wow!
    Isn't 8gb enough?
     
  10. mid-kid

    mid-kid GBAtemp spamBOT

    Member
    879
    962
    Aug 2, 2012
    It should be, for me it works with my 2gb (I'm on linux tho).
    Try running it again, MemoryError is a weird error.
    BTW: Are you running python 64bit?
     
  11. mvmiranda

    mvmiranda GBAtemp Maniac

    Member
    1,212
    419
    Oct 29, 2013
    Brazil
    Brazil, Sao Paulo
    Hmmm, nope...
    It's 32bits... That's probably the issue here.
     
  12. Michunio

    Michunio Member

    Newcomer
    45
    43
    Jan 17, 2014
    Poland
    awesome, thank you for your work
     
    cearp likes this.
  13. mvmiranda

    mvmiranda GBAtemp Maniac

    Member
    1,212
    419
    Oct 29, 2013
    Brazil
    Brazil, Sao Paulo
    Changed to Python 2.7.9 64bits and it worked.
     
    urherenow, Margen67 and cearp like this.
  14. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,777
    May 26, 2008
    Tuvalu
    yeah, i was wondering about there being any issues, i was not sure if the whole file would be loaded into ram, and if i should do it in chunks, but, i think it is ok how it is.
    there is probably a nicer way to do it, but as you can see from the python code, it is simple and basic :) -- and it works :)

    yes, i hated that part too :) this does it for you.
    i could have added the xor process to this too, but, at least for now i will keep it separate.
     
    Dartz150 likes this.
  15. swarzesherz

    swarzesherz Member

    Newcomer
    12
    21
    Apr 12, 2014
    Mexico
    Hi, upload new version of script from cearp. This use only mem of fat16
     

    Attached Files:

    Dartz150 and cearp like this.
  16. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,777
    May 26, 2008
    Tuvalu
    so this edited version is more efficient? :) thanks - can i update the first post with it?
     
    Margen67 likes this.
  17. swarzesherz

    swarzesherz Member

    Newcomer
    12
    21
    Apr 12, 2014
    Mexico
    Yea a little bit, to use lower memory as you comment need process file in chunks
     
    Margen67 and cearp like this.
  18. Codename

    Codename GREEN BRO IS BEST BRO

    Member
    365
    85
    Feb 21, 2012
    Canada
    This looks interesting... I suppose it could be used to modify the EmuNAND filesystem? Could we do that without having an actual 3DS flashcart? I'm using 4.2 SysNAND, which I downgraded to using Gateway's downgrading files, and 9.4 EmuNAND using the MT-Card Launcher. What exactly could I modify with this tool?
     
  19. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,777
    May 26, 2008
    Tuvalu
    this tool just gets out the fat16 parition from the nand. if you can xor it to unencrypt it (and re-xor it to re-encrypt it when you want to write it back) - you can edit your nand.
    yes you can do this without gw. sysnand or emunand, it doesn't matter.
     
    Codename likes this.
  20. Codename

    Codename GREEN BRO IS BEST BRO

    Member
    365
    85
    Feb 21, 2012
    Canada
    Just wondering, my fat16 partition is 757 mb out of my 943 mb EmuNAND partition. What's the other ~200 mb of EmuNAND partition? Anything interesting?