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

Pottsy292

Member
Newcomer
Joined
Apr 24, 2018
Messages
20
Trophies
0
Age
30
XP
236
Country
United Kingdom
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)
 

SrTommy

Member
Newcomer
Joined
Jun 18, 2013
Messages
16
Trophies
1
Age
42
XP
587
Country
Argentina
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:
 

SocraticBliss

Well-Known Member
Member
Joined
Jun 3, 2017
Messages
130
Trophies
0
Age
36
XP
273
Country
United States
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

Burorī

Well-Known Member
Member
Joined
Mar 23, 2018
Messages
323
Trophies
0
Age
28
XP
2,103
Country
Belgium
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
 

SocraticBliss

Well-Known Member
Member
Joined
Jun 3, 2017
Messages
130
Trophies
0
Age
36
XP
273
Country
United States
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...
 

Burorī

Well-Known Member
Member
Joined
Mar 23, 2018
Messages
323
Trophies
0
Age
28
XP
2,103
Country
Belgium
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
 

uniquetusk

Member
Newcomer
Joined
Oct 22, 2018
Messages
9
Trophies
0
Age
32
XP
76
Country
Gaza Strip
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,

yyoossk

Well-Known Member
Member
Joined
Oct 18, 2017
Messages
200
Trophies
0
XP
2,418
Country
Japan
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
 

DaveLister

Well-Known Member
Member
Joined
Apr 27, 2018
Messages
720
Trophies
0
Age
123
Location
lv426
XP
1,295
Country
Afghanistan
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

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: