Homebrew RELEASE Open source horizon nand-dumper

asdfaaasssdddfff

New Member
OP
Newbie
Joined
Sep 15, 2018
Messages
3
Trophies
0
Age
36
XP
72
Country
United States
This is an open source tool which dumps the nand from horizon. (like the reinx-toolbox)
I made this because I dislike that the reinx-toolbox is being kept close-source for no apparent reason since all the information needed to dump the nand from horizon is already public.

It's mostly a direct port of this pegaswitch-script. (github_com/reswitched/pegaswitch/blob/master/usefulscripts/DumpBIS.js)
It will dump boot0+1, prodinfo and the rawnand to the root of the sdcard, automatically splitting the file if on a fat32-sdcard.

Warning: This may or may not result in a corrupted backup, I take no responsibility whatsoever for bricks.
If you want a proper backup use hekate which has proper backup-verification.

If you want a horizon-nand-dumper, the reinx toolbox is probably better than this (idk, I can't look at the source code).

License: MIT
 

Attachments

  • source.zip
    1.4 KB · Views: 381
Last edited by asdfaaasssdddfff,

Adran_Marit

Walküre's Hacker
Member
Joined
Oct 3, 2015
Messages
3,781
Trophies
1
Location
42*South
XP
4,538
Country
Australia
This is an open source tool which dumps the nand from horizon. (like the reinx-toolbox)
I made this because I dislike that the reinx-toolbox is being kept close-source for no apparent reason since all the information needed to dump the nand from horizon is already public.

It's mostly a direct port of this pegaswitch-script. (github_com/reswitched/pegaswitch/blob/master/usefulscripts/DumpBIS.js)
It will dump boot0+1, prodinfo and the rawnand to the root of the sdcard, automatically splitting the file if on a fat32-sdcard.

Warning: This may or may not result in a corrupted backup, I take no responsibility whatsoever for bricks.
If you want a proper backup use hekate which has proper backup-verification.

If you want a horizon-nand-dumper, the reinx toolbox is probably better than this (idk, I can't look at the source code).

Cool work :)
 
Last edited by Adran_Marit,

Garou

Well-Known Member
Member
Joined
Jan 13, 2015
Messages
1,213
Trophies
0
XP
1,667
Country
Why would we use this? You are not a known dev its probably a brick code
you were complaining yet you don't even open the attachment do you?
there's no binary provided, and I'm no Switch dev but based on what I saw, it doesn't look like it (whether it's working as intended or not I don't know)
 
  • Like
Reactions: comput3rus3r

Adran_Marit

Walküre's Hacker
Member
Joined
Oct 3, 2015
Messages
3,781
Trophies
1
Location
42*South
XP
4,538
Country
Australia
  • Like
Reactions: EliseZeroTwo

wurstpistole

GBAtemp MVP
Member
Joined
Nov 19, 2015
Messages
4,646
Trophies
1
XP
5,385
Country
United Kingdom
I love how a user with an extremely random username @asdfaaasssdddfff and no other activity posts some script, then another person who also only registered yesterday and also only posted on this thread vouches for it.
This just has attention written all over it, even with the source attached.
 

palantine

Well-Known Member
Member
Joined
Oct 5, 2014
Messages
174
Trophies
0
Age
38
XP
593
Country
Italy
Good work! As the writer of the reins toolkit dumper I can say you have the right idea here. I was planning to release the source for mine at some point but just been very busy recently. While I would love to have everyone use my stuff I think its great that other people are learning to code and making contributions.

If you ever want to talk to other devs, share ideas and code why don't you consider dropping by the reiswitched discord server and talking to the people on there.

Cheers,

-caly0
 

Adran_Marit

Walküre's Hacker
Member
Joined
Oct 3, 2015
Messages
3,781
Trophies
1
Location
42*South
XP
4,538
Country
Australia
I love how a user with an extremely random username @asdfaaasssdddfff and no other activity posts some script, then another person who also only registered yesterday and also only posted on this thread vouches for it.
This just has attention written all over it, even with the source attached.

Even calypso who is one of the Reiswitched discord devs (the one who wrote their dump code) said good work and approves it. That says more than enough for me that it is legit and worth any and all attention it is given


Hmm, now I wonder which one dumps faster: the open-source version or the toolkit?
No idea, would be a nice thing to test
 
  • Like
Reactions: tiliarou

Adran_Marit

Walküre's Hacker
Member
Joined
Oct 3, 2015
Messages
3,781
Trophies
1
Location
42*South
XP
4,538
Country
Australia
Did not know the ReiNX Toolkit is closed-source, that's pretty shitty. Newfound disrespect for that project...
Good work! As the writer of the reins toolkit dumper I can say you have the right idea here. I was planning to release the source for mine at some point but just been very busy recently. While I would love to have everyone use my stuff I think its great that other people are learning to code and making contributions.

If you ever want to talk to other devs, share ideas and code why don't you consider dropping by the reiswitched discord server and talking to the people on there.

Cheers,

-caly0

no what's shitty is finding disrespect for the project when they have every intent to release the source for the toolkit.

but that's just my opinion
 
  • Like
Reactions: tiliarou

Huntereb

Well-Known Member
Member
Joined
Sep 1, 2013
Messages
3,234
Trophies
0
Website
lewd.pics
XP
2,446
Country
United States
no what's shitty is finding disrespect for the project when they have every intent to release the source for the toolkit.
No need to be brash! I missed that statement. Though, still a bit unnerving to see the release of said project without a proper source accompanying it, even if its being promised at a later date!
 
  • Like
Reactions: Meepers55

Adran_Marit

Walküre's Hacker
Member
Joined
Oct 3, 2015
Messages
3,781
Trophies
1
Location
42*South
XP
4,538
Country
Australia
No need to be brash! I missed that statement. Though, still a bit unnerving to see the release of said project without a proper source accompanying it, even if its being promised at a later date!

Sorry u.u

I understand why they delayed their release though apart from been busy, I doubt they wanted TX to instantly copy it
 

eliboa

Well-Known Member
Member
Joined
Jan 13, 2016
Messages
157
Trophies
0
XP
1,257
Country
France
I love how a user with an extremely random username @asdfaaasssdddfff and no other activity posts some script, then another person who also only registered yesterday and also only posted on this thread vouches for it.
This just has attention written all over it, even with the source attached.
Look at the code, it's pretty simple, there's nothing suspicious here...
 

ScarletDreamz

[Debug Mode]
Member
Joined
Feb 16, 2015
Messages
3,967
Trophies
1
Location
/dev/sda1
XP
4,380
Country
United States
For those LAZY to open it up and read it:
Also, Coming up on your next SX OS:

Code:
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/statvfs.h>
#include <unistd.h>
#include <switch.h>

#define MIN(x, y) (((x) < (y)) ? (x) : (y))

/*
This is basically a port of this pegaswitch-script:
https://github.com/reswitched/pegaswitch/blob/master/usefulscripts/DumpBIS.js
*/

int partitionIds[] = {0, 10, 27, 20};
char *partitionNames[] = {"BOOT0", "BOOT1", "PRODINFO", "rawnand"};

#define BufSize 0x500000

long GetAvailableSpace(const char *path)
{
    struct statvfs stat;

    if (statvfs(path, &stat) != 0)
    {
        // error happens, just quits here
        return -1;
    }

    // the available size is f_bsize * f_bavail
    return stat.f_bsize * stat.f_bavail;
}

int dumpPartition(int partitionIndex)
{
    printf("\n%s\n", partitionNames[partitionIndex]);
    int id = partitionIds[partitionIndex];

    char *buffer = malloc(BufSize);

    FsStorage partition;
    fsOpenBisStorage(&partition, id);
    u64 size = 0;
    fsStorageGetSize(&partition, &size);

    if (GetAvailableSpace("/") < size)
    {
        consoleClear();
        fsStorageClose(&partition);
        printf("Not enough space left on the sd!\n");
        while (appletMainLoop())
        {

            hidScanInput();
            u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);

            if (kDown & KEY_PLUS)
                break;

            gfxFlushBuffers();
            gfxSwapBuffers();
        }
        return -1;
    }

    int file_num = 0;

    char filename[100];
    sprintf(filename, "/%s.bin", partitionNames[partitionIndex]);

    FILE *partitionfile = fopen(filename, "wb");

    u64 curPos = 0;

    bool isFat32 = false;

    // dump loop
    while (appletMainLoop())
    {
        u64 readSize = MIN(size - curPos, BufSize);
        if (readSize == 0)
            break;

        fsStorageRead(&partition, curPos, buffer, readSize);

        u64 sucessfullyWriten = fwrite(buffer, 1, readSize, partitionfile);

        curPos += sucessfullyWriten;

        if (sucessfullyWriten < readSize)
        {
            fclose(partitionfile);
            // Filesystem doesn't support big files
            if(!isFat32) {
                char oldFilename[100];
                strcpy(oldFilename, filename);
                sprintf(filename, "/%s_%d.bin", partitionNames[partitionIndex], file_num++);
                rename(oldFilename, filename);
                isFat32 = true;
            }
            sprintf(filename, "/%s_%d.bin", partitionNames[partitionIndex], file_num++);
            partitionfile = fopen(filename, "wb");
        }


        printf("\r%lu/%lu", curPos, size);

        gfxFlushBuffers();
        gfxSwapBuffers();
    }
    fclose(partitionfile);
    fsStorageClose(&partition);
    free(buffer);

    return 0;
}

int main(int argc, char **argv)
{
    gfxInitDefault();
    consoleInit(NULL);

    printf("ATTENTION, DO NOT USE THIS AS YOUR PRIMARY BACKUP!\n");
    printf("I'm serious: I'll not be responsible for any bricks because of this!\n");
    printf("Press + if you want to continue\n");

    while (appletMainLoop())
    {
        hidScanInput();
        u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);

        if (kDown & KEY_PLUS)
            break;

        gfxFlushBuffers();
        gfxSwapBuffers();
    }
  
    consoleClear();

    for (int i = 0; i < (sizeof(partitionIds) / sizeof(int)); i++)
    {
        if(dumpPartition(i) != 0)
            return 0;
    }

    printf("\nDump complete!\nPress + to exit");

    while (appletMainLoop())
    {
        hidScanInput();
        u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);

        if (kDown & KEY_PLUS)
            break;

        gfxFlushBuffers();
        gfxSwapBuffers();
    }

    gfxExit();
    return 0;
}
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • ZeroT21 @ ZeroT21:
    it wasn't a question, it was fact
  • BigOnYa @ BigOnYa:
    He said he had 3 different doctors apt this week, so he prob there. Something about gerbal extraction, I don't know.
    +1
  • ZeroT21 @ ZeroT21:
    bored, guess i'll spread more democracy
  • LeoTCK @ LeoTCK:
    @K3Nv2 one more time you say such bs to @BakerMan and I'll smack you across the whole planet
  • K3Nv2 @ K3Nv2:
    Make sure you smack my booty daddy
    +1
  • LeoTCK @ LeoTCK:
    telling him that my partner is luke...does he look like someone with such big ne
    eds?
  • LeoTCK @ LeoTCK:
    do you really think I could stand living with someone like luke?
  • LeoTCK @ LeoTCK:
    I suppose luke has "special needs" but he's not my partner, did you just say that to piss me off again?
  • LeoTCK @ LeoTCK:
    besides I had bigger worries today
  • LeoTCK @ LeoTCK:
    but what do you know about that, you won't believe me anyways
  • K3Nv2 @ K3Nv2:
    @BigOnYa can answer that
  • BigOnYa @ BigOnYa:
    BigOnYa already left the chat
  • K3Nv2 @ K3Nv2:
    Biginya
  • BigOnYa @ BigOnYa:
    Auto correct got me, I'm on my tablet, i need to turn that shit off
  • K3Nv2 @ K3Nv2:
    With other tabs open you perv
  • BigOnYa @ BigOnYa:
    I'm actually in my shed, bout to cut 2-3 acres of grass, my back yard.
  • K3Nv2 @ K3Nv2:
    I use to have a guy for that thanks richard
  • BigOnYa @ BigOnYa:
    I use my tablet to stream to a bluetooth speaker when in shed. iHeartRadio, FlyNation
  • K3Nv2 @ K3Nv2:
    While the victims are being buried
  • K3Nv2 @ K3Nv2:
    Grave shovel
  • BigOnYa @ BigOnYa:
    Nuh those goto the edge of the property (maybe just on the other side of)
  • K3Nv2 @ K3Nv2:
    On the neighbors side
    +1
  • BigOnYa @ BigOnYa:
    Yup, by the weird smelly green bushy looking plants.
    K3Nv2 @ K3Nv2: https://www.the-sun.com/news/10907833/self-checkout-complaints-new-target-dollar-general-policies...