Created
November 10, 2017 08:35
-
-
Save xerpi/3928c48ab2504084bb894eda964dd20b to your computer and use it in GitHub Desktop.
Vita NIDs json2yml.py
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
#!/usr/bin/python3 | |
import sys | |
import json | |
def main(): | |
if len(sys.argv) < 2: | |
print("Usage:\n\t", sys.argv[0], "db.json") | |
exit(1) | |
with open(sys.argv[1]) as db: | |
n = json.load(db) | |
print("version: 2") | |
print("firmware: 3.60") | |
print("modules:") | |
for module_name in n.keys(): | |
module = n[module_name] | |
mod_nid = module['nid'] | |
mod_libs = module['modules'] | |
print(" " + module_name + ":") | |
print(" nid: 0x" + format(mod_nid, '08X')) | |
print(" libraries:") | |
for lib_name in mod_libs.keys(): | |
library = mod_libs[lib_name] | |
lib_nid = library['nid'] | |
lib_kernel = False | |
if "ForKernel" in lib_name or "ForDriver" in lib_name: | |
lib_kernel = True | |
print(" " + lib_name + ":") | |
print(" nid: 0x" + format(lib_nid, '08X')) | |
print(" kernel: " + str(lib_kernel).lower()) | |
print(" functions:") | |
for func_name, func_nid in library.get('functions', {}).items(): | |
print(" " + func_name + ": 0x" + format(func_nid, '08X')) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment