def createFunctionsFile(): funcDict = {} funcs = list(filter(isGameFunction, getSymbols())) for f in funcs: address = f["address"] info = { "commit": None, # commit that this was decompiled in. "lines": f["size"], # lines of code "name": f["name"], # the name of the function } funcDict[address] = info open("json/functions.json", "w").write(json.dumps(funcDict, indent=2)) # createFunctionsFile()
from symbols import getSymbols asm = "../bfbbdecomp/asm/Game/zGameExtras.s" syms = getSymbols() def processFile(path): text = open(path).read() print(text) processFile(asm)
def gensignal(actsyms): global conf app_json = 'Test' global priceRank global volRank global combinedRank global fireList global r global mktOpen global activesym dataList = {} startime = time.time() print('MktOpen:', mktOpen) print(actsyms) if actsyms is not None and len(actsyms) > 0: activesym = actsyms.split(",") symbolList = [] symbolList = getSymbols() if len(symbolList) < 1: symbols = "symbols" symList = r.smembers(symbols) for sym in symList: symbolList.append(str(sym, 'utf-8')) #print(symbolList) symCount = len(symbolList) print('symbolList:{}'.format(symCount)) symList = list(symbolList)[:100] #symList=['ORCL'] print('Running gensignal') with ThreadPoolExecutor(max_workers=50) as executor: # for sym in symList: # symbol=str(sym, 'utf-8') # symbol=sym # print(symbol) for sym in executor.map(runForEachSymbol, symList): pass n = conf.finalList if n == None: n = 12 priceRank = dict( sorted(priceRank.items(), key=operator.itemgetter(1), reverse=True)) volRank = dict( sorted(volRank.items(), key=operator.itemgetter(1), reverse=True)) combinedRank = dict( sorted(combinedRank.items(), key=operator.itemgetter(1), reverse=True)) #print(priceRank) #print(volRank) #print(combinedRank) key_list = list(fireList.keys()) print('print list') print(len(fireList)) #print(key_list) #print(fireList) for key in key_list: rec = fireList[key] mx = rec["mp"] #print(mx) if mx < 0.0: del fireList[key] continue if key in priceRank: rank = list(priceRank).index(key) rec["pRank"] = rank fireList.update(key=rec) #print(key,(list(priceRank).index(key))) if key in volRank: rec["vRank"] = list(volRank).index(key) #print(key, (list(volRank).index(key))) fireList.update(key=rec) if key in combinedRank: rec["cRank"] = list(combinedRank).index(key) #print(key, (list(combinedRank).index(key))) fireList.update(key=rec) key1_list = list(fireList.keys()) for key in key1_list: rec = fireList[key] if ((rec["pRank"] >= 0 and rec["pRank"] < 12) or (rec["vRank"] > 0 and rec["vRank"] < 12) or (rec["cRank"] > 0 and rec["cRank"] < 24) or (rec["type"] == "active")): a = 1 else: if key in fireList.keys(): del fireList[key] app_json = json.dumps(fireList) # print('Volume:{} Price:{} Combined{}'.format(len(volList),len(priceList),len(combineList))) #print(app_json) #print(len(fireList)) endtime = time.time() print(app_json) print('Time taken to finish run:{}'.format(int(endtime - startime))) return app_json #gensignal("") #getYestPrice() #getSymbols()
import glob from pathlib import Path from symbols import getSymbols import json typeMap = {} syms = list( filter( lambda x: x["name"] != None and x["type"] == "FUNC" and x["scope"] == "GLOBAL", getSymbols())) def getType(lines, name): found = 0 for l in lines: if name in l and found == 0: found = 1 if found: found += 1 if found == 3 and "Start address" not in l: break if found > 3: return l.strip() return name typeDict = {} for cpp in Path('types').rglob('*.cpp'): data = open(cpp).read()
def getFunctionsBetween(first, last): syms = getSymbols() funcs = list(filter(lambda x: symbolBetween(x, first, last), syms)) funcs.sort(key=lambda x: int(x["address"], 16)) return funcs