-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.py
More file actions
61 lines (48 loc) · 1.71 KB
/
util.py
File metadata and controls
61 lines (48 loc) · 1.71 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
import os
import binascii
from untangle import parse
from xml.etree import ElementTree
def find_biggest():
objects = os.listdir('game_files/nca')
sofar = 0
name = ""
for file in objects:
size = os.path.getsize(os.path.join('game_files/nca', file))
if size > sofar:
sofar = size
name = file
return name, sofar
def find_biggest_xci():
objects = os.listdir('game_files/secure')
sofar = 0
name = ""
for file in objects:
size = os.path.getsize(os.path.join('game_files/secure', file))
if size > sofar:
sofar = size
name = file
return name, sofar
def find_tik():
name = []
for file in os.listdir("game_files/nca"):
if file.endswith(".tik"):
name = file
return name
def find_titlekey(tik):
os.listdir('game_files/nca')
with open('game_files/nca/' + tik,"rb") as f:
f.seek(0x180)
val = f.read(16)
return binascii.hexlify(bytearray(val))
def xml_check():
xml = []
for file in os.listdir('game_files/nca'):
if file.endswith('.xml'):
xml = os.path.join('game_files/nca', file)
obj = parse(xml)
tf = obj.ContentMeta.Content[0].Type.cdata
nca = obj.ContentMeta.Content[0].Id.cdata
if tf == 'Program':
return nca + '.nca'
else:
return False