File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,10 +45,9 @@ def scan_file():
4545 for section in nspf :
4646 if isinstance (section , Pfs0 .Pfs0 ):
4747 Cnmt = section .getCnmt ()
48- print (Cnmt .__dict__ )
4948 for entry in Cnmt .contentEntries :
5049 print (f'\n :{ Cnmt .titleId } - Content.{ Type .Content (entry .type )._name_ } ' )
51- print (f'> FILENAME : { entry .ncaId } ' )
50+ print (f'> NCA ID : { entry .ncaId } ' )
5251 print (f'> HASH: { entry .hash .hex ()} ' )
5352 finally :
5453 container .close ()
Original file line number Diff line number Diff line change 1+ import os
2+ import sys
3+
4+ from pathlib import Path
5+ from Fs import Ticket , factory
6+
7+ # set app path
8+ appPath = Path (sys .argv [0 ])
9+ while not appPath .is_dir ():
10+ appPath = appPath .parents [0 ]
11+ appPath = os .path .abspath (appPath )
12+ print (f'[:INFO:] App Path: { appPath } ' )
13+
14+ # set logs path
15+ # logs_dir = os.path.abspath(os.path.join(appPath, '..', 'logs'))
16+ # print(f'[:INFO:] Logs Path: {logs_dir}')
17+
18+ import argparse
19+ parser = argparse .ArgumentParser (formatter_class = argparse .ArgumentDefaultsHelpFormatter )
20+ parser .add_argument ('-i' , '--input' , help = 'input file' )
21+ args = parser .parse_args ()
22+
23+ INCP_PATH = args .input
24+
25+ def send_hook (message_content ):
26+ try :
27+ print (message_content )
28+ except :
29+ pass
30+
31+ def scan_file ():
32+ ipath = os .path .abspath (INCP_PATH )
33+ if not os .path .isfile (ipath ):
34+ return
35+ if not ipath .lower ().endswith (('.nsp' , '.nsz' )):
36+ return
37+
38+ container = factory (Path (ipath ).resolve ())
39+ container .open (ipath , 'rb' )
40+
41+ try :
42+ for nspf in container :
43+ if isinstance (nspf , Ticket .Ticket ):
44+ nspf .printInfo ()
45+ finally :
46+ container .close ()
47+
48+
49+ if __name__ == "__main__" :
50+ if INCP_PATH :
51+ scan_file ()
52+ else :
53+ parser .print_help ()
54+ print ()
You can’t perform that action at this time.
0 commit comments