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

  • Thread starter Thread starter SimonMKWii
  • Start date Start date
  • Views Views 142,917
  • Replies Replies 329
  • Likes Likes 29
Hey can someone help?

I seem to be getting errors when running the script
Traceback (most recent call last):
File "C:\Users\z00363ae\Downloads\Restore CDNSP (Don't Use Yet)\CertNXtractionPack\00_generate_ssl_kek.py", line 3, in <module>
from Crypto.Cipher import AES
File "C:\Users\z00363ae\AppData\Local\Programs\Python\Python37-32\lib\site-packages\Crypto\Cipher\__init__.py", line 27, in <module>
from Crypto.Cipher._mode_ecb import _create_ecb_cipher
File "C:\Users\z00363ae\AppData\Local\Programs\Python\Python37-32\lib\site-packages\Crypto\Cipher\_mode_ecb.py", line 29, in <module>
from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
File "C:\Users\z00363ae\AppData\Local\Programs\Python\Python37-32\lib\site-packages\Crypto\Util\_raw_api.py", line 32, in <module>
from Crypto.Util.py3compat import byte_string
ImportError: cannot import name 'byte_string' from 'Crypto.Util.py3compat' (C:\Users\z00363ae\AppData\Local\Programs\Python\Python37-32\lib\site-packages\Crypto\Util\py3compat.py)
 
OK guys, I did a python re-write, so now it's only one python script!

Download python, and the attached CertNXtractionPack.zip

NOTE: The below link will have the most updated versions of the scripts...

https://gist.github.com/SocraticBliss/4410790b6e5a27161f521c45d1eb2684

PREREQUISITES
  1. Get your BIS Keys (via biskeydump)
  2. Dump your SYSNAND (via hekate)
  3. Decrypt your PRODINFO (BIS 0 Key) and Save to file - PRODINFO.bin to your working directory (via HacDiskMount)
  4. Edit keys.txt and replace ONLY the 32 F's with the correct keys!
  5. Make sure the following files are in your working directory before running the batch script:
    • CertNXtractionPack.cmd
    • CertNXtractionPack.py
    • keys.txt
    • openssl.exe
    • PRODINFO.bin
  6. Double-click on the CertNXtractionPack.cmd
  7. Enjoy!

Works perfect!! I get the files "certificate.pem" "nx_tls_client_cert.pem" "nx_tls_client_cert.pfx" and "privatekey.pem" with your script. Thanks a lot!!

There is any way to get the "certificate.cert" file with this method? :unsure:
 
Works perfect!! I get the files "certificate.pem" "nx_tls_client_cert.pem" "nx_tls_client_cert.pfx" and "privatekey.pem" with your script. Thanks a lot!!

There is any way to get the "certificate.cert" file with this method? :unsure:

just remove line 42 in the cmd file...

DEL certificate.der >NUL 2>&1

then just rename .der to cert I guess?
 
  • Like
Reactions: SrTommy
OK guys, I did a python re-write, so now it's only one python script!

Download python, and the attached CertNXtractionPack.zip

NOTE: The below link will have the most updated versions of the scripts...

https://gist.github.com/SocraticBliss/4410790b6e5a27161f521c45d1eb2684

PREREQUISITES
  1. Get your BIS Keys (via biskeydump)
  2. Dump your SYSNAND (via hekate)
  3. Decrypt your PRODINFO (BIS 0 Key) and Save to file - PRODINFO.bin to your working directory (via HacDiskMount)
  4. Edit keys.txt and replace ONLY the 32 F's with the correct keys!
  5. Make sure the following files are in your working directory before running the batch script:
    • CertNXtractionPack.cmd
    • CertNXtractionPack.py
    • keys.txt
    • openssl.exe
    • PRODINFO.bin
  6. Double-click on the CertNXtractionPack.cmd
  7. Enjoy!
I always get this

Verifying keys... Traceback (most recent call last):
File "CertNXtractionPack.py", line 178, in <module>
main()
File "CertNXtractionPack.py", line 154, in main
if (sha256(value).hexdigest().upper() != hashes[key]):
TypeError: Unicode-objects must be encoded before hashing
 
I always get this

Verifying keys... Traceback (most recent call last):
File "CertNXtractionPack.py", line 178, in <module>
main()
File "CertNXtractionPack.py", line 154, in main
if (sha256(value).hexdigest().upper() != hashes[key]):
TypeError: Unicode-objects must be encoded before hashing

Man I am always late to seeing these things... I think this is an issue with python 3, I think Python 2 doesn't have this problem, I think you can fix it by just changing line 154 to...

if (sha256(value.encode('utf-8')).hexdigest().upper() != hashes[key]):

I updated the gist as well...
 
Man I am always late to seeing these things... I think this is an issue with python 3, I think Python 2 doesn't have this problem, I think you can fix it by just changing line 154 to...

if (sha256(value.encode('utf-8')).hexdigest().upper() != hashes[key]):

I updated the gist as well...
How ?

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

Man I am always late to seeing these things... I think this is an issue with python 3, I think Python 2 doesn't have this problem, I think you can fix it by just changing line 154 to...

if (sha256(value.encode('utf-8')).hexdigest().upper() != hashes[key]):

I updated the gist as well...
I still get the same except it shows the new line instead
 
I always get this

Verifying keys... Traceback (most recent call last):
File "CertNXtractionPack.py", line 178, in <module>
main()
File "CertNXtractionPack.py", line 154, in main
if (sha256(value).hexdigest().upper() != hashes[key]):
TypeError: Unicode-objects must be encoded before hashing

I'm having simlar issue, but error is sligtly different.

Checking python module dependencies...

Verifying keys... Traceback (most recent call last):
File "CertNXtractionPack.py", line 178, in <module>
main()
File "CertNXtractionPack.py", line 154, in main
if (sha256(value.encode('utf-8')).hexdigest().upper() != hashes[key]):
AttributeError: 'bytes' object has no attribute 'encode'

Script was run on windows 7 with python 3.5 installed. But with 2.7 I've had an error too, just not sure if it was the same or different one.
 
Last edited by uniquetusk,
I always get this

Verifying keys... Traceback (most recent call last):
File "CertNXtractionPack.py", line 178, in <module>
main()
File "CertNXtractionPack.py", line 154, in main
if (sha256(value).hexdigest().upper() != hashes[key]):
TypeError: Unicode-objects must be encoded before hashing

FIND: 'python': No such file or directory
 
Is it missing character encoding ? or are you using some type of foreign editor that is messing up the unicode ?

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

I'm having simlar issue, but error is sligtly different.

Checking python module dependencies...

Verifying keys... Traceback (most recent call last):
File "CertNXtractionPack.py", line 178, in <module>
main()
File "CertNXtractionPack.py", line 154, in main
if (sha256(value.encode('utf-8')).hexdigest().upper() != hashes[key]):
AttributeError: 'bytes' object has no attribute 'encode'

Script was run on windows 7 with python 3.5 installed. But with 2.7 I've had an error too, just not sure if it was the same or different one.
you sure the DLL's on your box are pointing tot he correct key hooks in registry ? As in i would do on a clean VM, a new test with the correct builds in place .....
 

Site & Scene News

Popular threads in this forum