Hacking RELEASE CertNXtractionPack - Get your Switch cert from a NAND dump!

  • Thread starter Thread starter SimonMKWii
  • Start date Start date
  • Views Views 142,936
  • Replies Replies 329
  • Likes Likes 29
Something that might be called ssl_aes_key_x or y at other places? Cause using that information then it will be an "anonymous key" a cert that everyone could use and not involve your own cert...and not risk ban...? If you get where i am going..
 
On Windows I cant install pycrypto cuz of Error:

Code:
snip


On Linux if I try to run : 00_generate" I get the following Error:

Code:
Traceback (most recent call last):
  File "00_generate_ssl_kek.py", line 21, in <module>
    rpk_key = GenerateAesKek(rsa_private_kek_generation_source, key_x_gak, master_key)
NameError: name 'key_x_gak' is not defined
 
Last edited by ehnoah,
On Windows I cant install pycrypto cuz of Error:

Code:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ "-Ic:\program files\python36\include" "-Ic:\program files\python36\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-3.6\Release\src/winrand.obj
    winrand.c
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(26): error C2061: Syntaxfehler: Bezeichner "intmax_t"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(27): error C2061: Syntaxfehler: Bezeichner "rem"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(27): error C2059: Syntaxfehler: ";"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(28): error C2059: Syntaxfehler: "}"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(30): error C2061: Syntaxfehler: Bezeichner "imaxdiv_t"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(30): error C2059: Syntaxfehler: ";"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(40): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(41): error C2146: Syntaxfehler: Fehlendes ")" vor Bezeichner "_Number"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(41): error C2061: Syntaxfehler: Bezeichner "_Number"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(41): error C2059: Syntaxfehler: ";"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(42): error C2059: Syntaxfehler: ")"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(45): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(46): error C2146: Syntaxfehler: Fehlendes ")" vor Bezeichner "_Numerator"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(46): error C2061: Syntaxfehler: Bezeichner "_Numerator"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(46): error C2059: Syntaxfehler: ";"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(46): error C2059: Syntaxfehler: ","
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(48): error C2059: Syntaxfehler: ")"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(50): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(56): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(63): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(69): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(76): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(82): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(89): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(95): error C2143: Syntaxfehler: Es fehlt "{" vor "__cdecl"
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command ""c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\lemmi\\AppData\\Local\\Temp\\pip-install-yyjwxqtq\\pycrypto\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\lemmi\AppData\Local\Temp\pip-record-1euqlnzo\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\lemmi\AppData\Local\Temp\pip-install-yyjwxqtq\pycrypto\


On Linux if I try to run : 00_generate" I get the following Error:

Code:
Traceback (most recent call last):
  File "00_generate_ssl_kek.py", line 21, in <module>
    rpk_key = GenerateAesKek(rsa_private_kek_generation_source, key_x_gak, master_key)
NameError: name 'key_x_gak' is not defined



You need Build tools for Visual studio. I would recommend to try to get it working in linux. I belive you need to enter the missing keys...
 
rsa_private_kek_generation_source = uhx
master_key = uhx
key_x_gak = uhx
rpk_key_y = uhx

You see that the last two are different then inside your file ? Switch those 2 to the ones i use.

Change ssl_aes_key_x to key_x_gak AND
Change ssl_rsa_key_y to rpk_key_y

its a mistake in the code.
 
Last edited by Addconsult,
rsa_private_kek_generation_source = uhx
master_key = uhx
key_x_gak = uhx
rpk_key_y = uhx

You see that the last two are different then inside your file ? Switch those 2 to the ones i use.

Change ssl_aes_key_x to key_x_gak AND
Change ssl_rsa_key_y to rpk_key_y

its a mistake in the code.


Yeah got it, on Linux I struggle with "no module named asn1" however I installed asn1

"pip3 install asn1"
 
Yeah got it, on Linux I struggle with "no module named asn1" however I installed asn1

"pip3 install asn1"

At terminal write : python -m pip install asn1 and it should install. If not write python -m pip install future
then python -m pip install asn1
 
At terminal write : python -m pip install asn1 and it should install. If not write python -m pip install future
then python -m pip install asn1

That worked, however now I get: It seems I fucked up my Linux :D


Code:
python 02_convert_to_der.py
Traceback (most recent call last):
  File "02_convert_to_der.py", line 144, in <module>
    main()
  File "02_convert_to_der.py", line 100, in main
    E, N = get_pubk(clcert)
  File "02_convert_to_der.py", line 58, in get_pubk
    clcert_decoder.enter() # Seq, 3 elem
  File "/home/pega/.local/lib/python2.7/site-packages/asn1.py", line 448, in enter
    raise Error('Cannot enter a non-constructed tag.')
asn1.Error: Cannot enter a non-constructed tag.
 
He said he used Linux and i use Linux atm. So ofcourse i should give him the correct linux command...
there have been Windows users in this thread suggesting the use of "python" and "pip" on their own, which are unreliable (don't know if they exist, or what version they point to), so I need to point it out.
 
  • Like
Reactions: Addconsult
That worked, however now I get: It seems I fucked up my Linux :D


Code:
python 02_convert_to_der.py
Traceback (most recent call last):
  File "02_convert_to_der.py", line 144, in <module>
    main()
  File "02_convert_to_der.py", line 100, in main
    E, N = get_pubk(clcert)
  File "02_convert_to_der.py", line 58, in get_pubk
    clcert_decoder.enter() # Seq, 3 elem
  File "/home/pega/.local/lib/python2.7/site-packages/asn1.py", line 448, in enter
    raise Error('Cannot enter a non-constructed tag.')
asn1.Error: Cannot enter a non-constructed tag.

I dont know :) I think Simon has to answer this. I did not write the scripts. Too Lazy to read all the code since i have not touched programming in 4+ years.

--------------------- MERGED ---------------------------

there have been Windows users in this thread suggesting the use of "python" and "pip" on their own, which are unreliable (don't know if they exist, or what version they point to), so I need to point it out.

True and a good point!
 
I dont know :) I think Simon has to answer this. I did not write the scripts. Too Lazy to read all the code since i have not touched programming in 4+ years.

--------------------- MERGED ---------------------------



True and a good point!


on Windows I also installed the Build Tools (had them before) but he still throw the Errors, dunno I prob. stay with Linux, but it is quite anoying. At least I have the *.der File :D

--------------------- MERGED ---------------------------

if you're on Windows, stop suggesting "python" please, use "py -3" in place. py -3 -m pip install pycryptodome


That actually solved the pycrypto issue on Windows, thanks :P
However, Windows has the same Issue as above. "Cannot enter a non-constructed tag."
 
Last edited by ehnoah,
there have been Windows users in this thread suggesting the use of "python" and "pip" on their own, which are unreliable (don't know if they exist, or what version they point to), so I need to point it out.

Valid point... I have just had the most luck with those commands, I used Python 2.7 for all of this anyways, as I ensured it was backwards compatible...

https://stackoverflow.com/questions...-from-command-line-using-py-instead-of-python

Edit: As a heads up, you have to have a distribution of Python3.x installed in order to use the py command natively, so people with Python2.7 can't do this unfortunately...
 
Last edited by SocraticBliss,
Valid point... I have just had the most luck with those commands, I used Python 2.7 for all of this anyways, as I ensured it was backwards compatible...

https://stackoverflow.com/questions...-from-command-line-using-py-instead-of-python

Edit: As a heads up, you have to have a distribution of Python3.x installed in order to use the py command natively, so people with Python2.7 can't do this unfortunately...
once you install 3.3+ you will get the "py" command, which will work for 2.x ("py -2", "py -2.7")
 
once you install 3.3+ you will get the "py" command, which will work for 2.x ("py -2", "py -2.7")

Maybe I should have been more explicit and said that the users who are ONLY a member of the Python2.7 greater beings, will not be able to rely on this :P
 
Maybe I should have been more explicit and said that the users who are ONLY a member of the Python2.7 greater beings, will not be able to rely on this :P
well it won't ever be added to 2.7 only (which by the way its EOL is january 1, 2020), so this is the only way you'll get it. it's better than just "python" on Windows so I always suggest it over that.
 

Site & Scene News

Popular threads in this forum