Created
November 11, 2016 23:57
-
-
Save devnoname120/3f40c2442705f4d161cf7d94eb99f9c6 to your computer and use it in GitHub Desktop.
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/env python3 | |
import json | |
""" | |
nidlist.txt: | |
0xF183726E _vshSblAimgrGetConsoleId | |
0xF1B7B34C sceBbmcTurnOn | |
0xF1C4D466 sceBtStopInquiry | |
... | |
""" | |
def hextodec(sHex): | |
return int(sHex, 0) | |
def json_find(json_object, find_name, find_NID): | |
found = [] | |
for library in json_object: | |
for module in json_object[library]['modules']: | |
for func in json_object[library]['modules'][module]['functions']: | |
NID = json_object[library]['modules'][module]['functions'][func] | |
if func.strip('_') == find_name.strip('_') or NID == find_NID: | |
if func != find_name: | |
print('Name mismatch! Found ' + func + ' looking for ' + find_name) | |
continue | |
elif NID != find_NID: | |
print('NID mismatch! Found ' + str(NID) + ' looking for ' + str(find_NID)) | |
continue | |
found.append((func, NID)) | |
if len(found) > 1: | |
print('Multiple entries found for ' + find_name + ':' + str(find_NID)) | |
if len(found) == 0: | |
pass#print('Not found: ' + find_name + ':' + str(find_NID)) | |
return found | |
def NIDlist(fNID): | |
for line in fNID: | |
elems = line.split(' ') | |
yield (hextodec(elems[0]), elems[4].strip('\r\n')) | |
with open('db.json', 'r') as fDB,\ | |
open('nidlist.txt', 'r') as fNID: | |
json_obj = json.load(fDB) | |
for NID, name in NIDlist(fNID): | |
#print('Finding ' + name + ' ' + str(NID)) | |
json_find(json_obj, name, NID) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment