-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
110 additions
and
97 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@echo off | ||
set app=%~dp0../py/ns_verify_folder.py | ||
|
||
py "%app%" -i "%~1" --save-log | ||
|
||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import os | ||
import sys | ||
|
||
from pathlib import Path | ||
from Fs import Pfs0, Nca, Type, factory | ||
|
||
# set app path | ||
appPath = Path(sys.argv[0]) | ||
while not appPath.is_dir(): | ||
appPath = appPath.parents[0] | ||
appPath = os.path.abspath(appPath) | ||
print(f'[:INFO:] App Path: {appPath}') | ||
|
||
# set logs path | ||
# logs_dir = os.path.abspath(os.path.join(appPath, '..', 'logs')) | ||
# print(f'[:INFO:] Logs Path: {logs_dir}') | ||
|
||
import argparse | ||
parser = argparse.ArgumentParser(formatter_class = argparse.ArgumentDefaultsHelpFormatter) | ||
parser.add_argument('-i', '--input', help = 'input file') | ||
args = parser.parse_args() | ||
|
||
INCP_PATH = args.input | ||
|
||
def send_hook(message_content): | ||
try: | ||
print(message_content) | ||
except: | ||
pass | ||
|
||
def scan_file(): | ||
ipath = os.path.abspath(INCP_PATH) | ||
if not os.path.isfile(ipath): | ||
return | ||
if not ipath.lower().endswith(('.xci', '.xcz', '.nsp', '.nsz')): | ||
return | ||
|
||
container = factory(Path(ipath).resolve()) | ||
container.open(ipath, 'rb') | ||
if ipath.lower().endswith(('.xci', '.xcz')): | ||
container = container.hfs0['secure'] | ||
try: | ||
for nspf in container: | ||
if isinstance(nspf, Nca.Nca) and nspf.header.contentType == Type.Content.META: | ||
for section in nspf: | ||
if isinstance(section, Pfs0.Pfs0): | ||
Cnmt = section.getCnmt() | ||
print(Cnmt.__dict__) | ||
for entry in Cnmt.contentEntries: | ||
print(f'\n:{Cnmt.titleId} - Content.{Type.Content(entry.type)._name_}') | ||
print(f'> FILENAME: {entry.ncaId}') | ||
print(f'> HASH: {entry.hash.hex()}') | ||
finally: | ||
container.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
if INCP_PATH: | ||
scan_file() | ||
else: | ||
parser.print_help() | ||
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters