-
Notifications
You must be signed in to change notification settings - Fork 0
/
ps3iso_decrypt.py
executable file
·47 lines (41 loc) · 1.98 KB
/
ps3iso_decrypt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#Batch decrypt ps3 iso's
import subprocess
import os
import glob
import re
def is_valid_key(decryption_key):
pattern = re.compile(r'^[0-9a-fA-F]{32}$')
return bool(pattern.match(decryption_key))
def decrypt_iso(decryption_key, encrypted_iso_path, decrypted_iso_path, ps3dec):
command_args = [ps3dec, 'd', 'key', decryption_key, encrypted_iso_path, decrypted_iso_path]
try:
subprocess.run(command_args, check=True)
except subprocess.CalledProcessError as e:
print("Command execution failed:", e)
def main():
#path to ps3dec executable
ps3dec = '/path/to/your/PS3Dec'
#path to all your decryption key files (.dkey). must be the same name as your iso files.
decryption_key_path = '/path/to/your/decryptionkeys'
#path to all your encrypted iso's (.iso)
encrypted_isos_path = '/path/to/your/encryptedisos'
##destionation folder for decrypted iso's
decrypted_isos_path = '/path/to/your/decryptedisos'
for filename in glob.iglob(encrypted_isos_path + '**/*.iso', recursive=True):
filename_without_extension = os.path.splitext(os.path.basename(filename))[0]
filename_dkey = filename_without_extension + '.dkey'
fullpath_iso_encrypted = filename
fullpath_dkey = os.path.join(decryption_key_path, filename_dkey)
fullpath_iso_decrypted = os.path.join(decrypted_isos_path, filename_without_extension + '.iso')
if not os.path.isfile(fullpath_iso_decrypted):
if os.path.exists(fullpath_dkey):
with open(fullpath_dkey, "r") as f:
decryption_key = f.read().strip()
if is_valid_key(decryption_key):
decrypt_iso(decryption_key, fullpath_iso_encrypted, fullpath_iso_decrypted, ps3dec)
else:
print(f"Invalid decryption key in {filename_dkey}")
else:
print(f"Decryption key not found for {filename_without_extension}")
if __name__ == "__main__":
main()