Homebrew Could Someone Make This Script..?

mondul

Well-Known Member
Member
Joined
Aug 8, 2018
Messages
115
Trophies
0
Age
37
Location
Barranquilla
XP
742
Country
Colombia
Here you have a short python3 (3.5 onwards) script for finding the eMMC CID and the console ID:
Code:
#!/usr/local/bin/python3

import sys
from os import path

# Initialize NAND filename, path and the default exit code
nand_file = 'nand.bin'
nand_path = ''
exit_code = 0

# Try to get the NAND file from the command line
if len(sys.argv) > 1:
    nand_path, nand_file = path.split(sys.argv[1])

# Read the NAND file
try:
    with open(path.join(nand_path, nand_file), 'rb') as f:
        # Go to the No$GBA footer offset
        f.seek(0xF000000)
        # Read the footer's header :-)
        bstr = f.read(0x10)

        if bstr == b'DSi eMMC CID/CPU':
            # Read the CID
            bstr = f.read(0x10)
            cid =  bytearray(bstr).hex().upper()
            print('eMMC CID  : ' + cid)
            # Save it to a text file at the same NAND location
            with open(path.join(nand_path, 'CID.txt'), 'w') as ftxt:
                ftxt.write(cid)

            # Read the console ID
            bstr = f.read(8)
            console_id = bytearray(reversed(bstr)).hex().upper()
            print('Console ID: ' + console_id)
            # Save it to a text file at the same NAND location
            with open(path.join(nand_path, 'ConsoleID.txt'), 'w') as ftxt:
                ftxt.write(console_id)

        else:
            print('ERROR: No$GBA footer not found')
            exit_code = 1

except FileNotFoundError:
    print('ERROR: Could not open the file ' + nand_file)
    exit_code = 1

sys.exit(exit_code)

EDiT: Updated code
 
Last edited by mondul,
  • Like
Reactions: Sha8q

mondul

Well-Known Member
Member
Joined
Aug 8, 2018
Messages
115
Trophies
0
Age
37
Location
Barranquilla
XP
742
Country
Colombia
could you somehow make it save the consoleid and CID directly to a file?
Updated the script with the following features:
  • The NAND file can now be specified from the command line. If not, nand.bin will be used.
  • It will save CID.txt and ConsoleID.txt at the same location as the NAND file.
  • Added an exit code in case of errors.
  • Added comments.
 
  • Like
Reactions: Sha8q

mondul

Well-Known Member
Member
Joined
Aug 8, 2018
Messages
115
Trophies
0
Age
37
Location
Barranquilla
XP
742
Country
Colombia
Anyone able to make a script that can remove the NO$ fooster from a NAND image? Also is there one that can download the 00000002.app launcher from the CDN and decrypt it?
First one already coded and working, tested withNo$GBA, but on Mac it is not removing the read-only flag, that's why I haven't included it yet in my helper script.

I'm working on the second one on my free time, will let you know when it's done EDiT: @Sha8q Here it is: https://gist.github.com/mondul/a4705c32de1687a7756173596372345c
 
Last edited by mondul,
  • Like
Reactions: Sha8q
General chit-chat
Help Users
    AkiraKurusu @ AkiraKurusu: There were 86 Pokémon introduced in Gen 7. Not 88; Meltan and Melmetal were GO and...