-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcdecrypt-wrapper.py
More file actions
executable file
·33 lines (28 loc) · 987 Bytes
/
cdecrypt-wrapper.py
File metadata and controls
executable file
·33 lines (28 loc) · 987 Bytes
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
#!/usr/bin/env python3
import argparse
import binascii
from pathlib import Path
import subprocess
import tempfile
def get_dummy_tik_data(titlekey):
return binascii.unhexlify(('00' * 0x1BF) + titlekey + '00')
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('-k', '--titlekey', type=str)
parser.add_argument('tmd')
return parser.parse_args()
def main():
args = get_args()
title_dir_path = Path(args.tmd).parent
titlekey = args.titlekey
tmd_path = args.tmd
with tempfile.NamedTemporaryFile(dir=title_dir_path) as ticket_file:
ticket_file.write(get_dummy_tik_data(titlekey))
ticket_file.flush()
mysubprocess = subprocess.run(['cdecrypt',
tmd_path,
ticket_file.name],
cwd=title_dir_path,
check=True)
if __name__ == '__main__':
main()