iniitl;a commit
This commit is contained in:
commit
492c079215
86 changed files with 225 additions and 0 deletions
42
tools/Filesystem/SEGA_Decryption_Guide.txt
Normal file
42
tools/Filesystem/SEGA_Decryption_Guide.txt
Normal file
|
@ -0,0 +1,42 @@
|
|||
╔═════════════════════╗
|
||||
SEGA Decryption Guide
|
||||
╚═════════════════════╝
|
||||
|
||||
╭─────────╮
|
||||
app files
|
||||
╰─────────╯
|
||||
|
||||
1. create a new file titled <PCB CODE>.bin
|
||||
|
||||
2. fill in the first 16 bytes of <PCB CODE>.bin with
|
||||
the AES key. (e.g. 9D 0B BA 20 D1 E8 4F 24 59 39 9F 53 83 BE EE 72)
|
||||
|
||||
3. the next 16 bytes will be the NTFS header (EB 52 90 4E 54 46 53 20 20 20 20 00 10 01 00 00)
|
||||
the NTFS header is always the same
|
||||
|
||||
4. save this file, then decrypt the app files with the following command:
|
||||
fsdecrypt <PCB CODE>.bin 0x200000 <path/to/app> <out.vhd>
|
||||
|
||||
5. once it finishes decrypting, run the calculate_iv.py script
|
||||
save the output of key 1. script is found here: https://discord.com/channels/162861213309599744/243895668790394882/995170669329391706
|
||||
|
||||
6. open <PCB CODE>.bin inside the hex editor once more, replace the NTFS header with
|
||||
the key 1
|
||||
|
||||
7. run "fsdecrypt <PCB CODE>.bin 0x200000 <path/to/app> <out.vhd>" once more
|
||||
|
||||
8. your app is now decrypted, you can extract the internal_0 with poweriso or any other tool
|
||||
|
||||
╭─────────╮
|
||||
opt files
|
||||
╰─────────╯
|
||||
|
||||
1. decrypt the opt file using fstools with the following command:
|
||||
fstool dec OPT.bin in.opt out.vhd
|
||||
|
||||
2. run the calculate_iv.py script and save key 3
|
||||
script is found here: https://discord.com/channels/162861213309599744/243895668790394882/995170669329391706
|
||||
|
||||
3. replace the IV key of the OPT.bin with key 3, the IV key of OPT.bin are the second 16 bytes
|
||||
|
||||
4. decrypt the opt file once more with the new key
|
39
tools/Filesystem/calculate_iv/calculate_iv.py
Normal file
39
tools/Filesystem/calculate_iv/calculate_iv.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Get the IV key from OPT.bin (this is the second 16 bytes of the file)
|
||||
# decrypt the .opt using OPT.bin and get the first 16 bytes of the vhd. this is key1
|
||||
# key1 xor EB769045584641542020200000000000 (exfat file header) this will give you key2
|
||||
# key2 xor OPT IV key -> key3
|
||||
# replace OPT.bin's IV with key3 and decrypt
|
||||
import os
|
||||
import glob
|
||||
|
||||
#function for taking bytes and xor'ing them
|
||||
def byte_xor(ba1, ba2):
|
||||
return bytes([_a ^ _b for _a, _b in zip(ba1, ba2)])
|
||||
|
||||
print("You must decrypt the opt first using fstools and the OPT.bin\nPlace everything in the same directory\nONLY HAVE ONE VHD IN THE DIRECTORY AT A TIME")
|
||||
cwd = os.getcwd()
|
||||
|
||||
#necessary because i couldn't figure out how else to do this, it's the exfat header duh
|
||||
with open(str(cwd) + "/exfat.bin", "rb") as f:
|
||||
exfat_HEADER = f.read(-1)
|
||||
print("exFAT Header = " + str(exfat_HEADER.hex()))
|
||||
|
||||
#reads all bytees from OPT.bin then saves bytes (17, 32) and converts it to hexadecimal
|
||||
with open(str(cwd) + "/OPT.bin", "rb") as f:
|
||||
opt_IV = f.read(-1)
|
||||
opt_IV = opt_IV[16:]
|
||||
print("OPT IV = " + str(opt_IV.hex()))
|
||||
|
||||
#puts all files with .vhd extension in a list, then pulls the first one in the list, will read first 16 bytes and convert to hexadecimal
|
||||
placeholder = glob.glob("*.vhd")
|
||||
vhd = str(placeholder[0])
|
||||
with open(str(cwd) + "/" + vhd, "rb") as f:
|
||||
key1 = f.read(16)
|
||||
print("key1 =" + str(key1.hex()))
|
||||
|
||||
#calculates key 2 and key 3 then converts to hex
|
||||
key2 = byte_xor(key1, exfat_HEADER)
|
||||
print("key2 = " + str(key2.hex()))
|
||||
key3 = byte_xor(key2, opt_IV)
|
||||
print("key3 = " + str(key3.hex()))
|
||||
|
2
tools/Filesystem/calculate_iv/calculate_iv.txt
Normal file
2
tools/Filesystem/calculate_iv/calculate_iv.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
i saw some of you guys were struggling with calculating the key3 so i went ahead and wrote a script for you all that does it for you. no external libraries are used, everything is just python3
|
||||
exfat.bin is necessary, it stores the exfat header within it
|
BIN
tools/Filesystem/calculate_iv/exfat.bin
Normal file
BIN
tools/Filesystem/calculate_iv/exfat.bin
Normal file
Binary file not shown.
BIN
tools/Filesystem/fsdecrypt.exe
Normal file
BIN
tools/Filesystem/fsdecrypt.exe
Normal file
Binary file not shown.
BIN
tools/Filesystem/fstool.exe
Normal file
BIN
tools/Filesystem/fstool.exe
Normal file
Binary file not shown.
6
tools/Filesystem/sega_iv_chinese.txt
Normal file
6
tools/Filesystem/sega_iv_chinese.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
1.Create SDDT.bin with 16 bytes of 0 written in the iv key
|
||||
2.Decrypt only the first 16 bytes once with fsdecrypt or fstool
|
||||
3.The first 16 bytes of the decrypted file is the iv key
|
||||
1.创建SDDT.bin,在iv键中写入16个字节的0
|
||||
2.用fsdecrypt或fstool只对前16个字节进行一次解密
|
||||
3.解密后的文件的前16个字节是iv密钥
|
Loading…
Add table
Add a link
Reference in a new issue