def test_indirectcalls(outputFilePath=None, listAll=False): #importDepsTils() modInitFuncs = getAllModInitFuncs() if len(modInitFuncs) == 0: return parseGOTNames() #if not haveSymbol(): # return commonSeg = getSegByName("__common") if not None is commonSeg: for ea in Heads(commonSeg.start_ea, commonSeg.end_ea): deName = getDeNameAtEA(ea) if None is deName: continue if deName.endswith("::gMetaClass"): SetType(ea, deName[:-len("::gMetaClass")] + "::MetaClass") parseKernelHeadersAndSetType() rebuildAllInternalDataWOParseModInitFunc(True) AnalysisUtils.forward_analysis_intra_defined_funcs() solvedIndirectCalls, unsolvedIndirectCalls, allIndirectCalls, solveRate = AnalysisUtils.checkResolutionRate() result = {"solvedIndirectCalls": {x: list(solvedIndirectCalls[x]) for x in solvedIndirectCalls}, "unsolvedIndirectCalls":list(unsolvedIndirectCalls), "allIndirectCalls": list(allIndirectCalls)} if not None is outputFilePath: with open(outputFilePath, "w") as f: json.dump(result, f) print "solved {}, unsolved {}, rate {}".format(len(solvedIndirectCalls), len(unsolvedIndirectCalls), solveRate) if listAll: print ", ".join(["0x{:X}".format(x) for x in unsolvedIndirectCalls]) return solvedIndirectCalls, unsolvedIndirectCalls
def test_indirectcalls(kextPrefix=None, outputFilePath=None, listAll=False): loadNecessaryDataFromPersistNode() AnalysisUtils.forward_analysis_intra_defined_funcs(kextPrefix) solvedIndirectCalls, unsolvedIndirectCalls, allIndirectCalls, solveRate = AnalysisUtils.checkResolutionRate( kextPrefix) result = { "solvedIndirectCalls": {x: list(solvedIndirectCalls[x]) for x in solvedIndirectCalls}, "unsolvedIndirectCalls": list(unsolvedIndirectCalls), "allIndirectCalls": allIndirectCalls } if not None is outputFilePath: with open(outputFilePath, "w") as f: json.dump(result, f) print "solved {}, unsolved {}, rate {}".format(len(solvedIndirectCalls), len(unsolvedIndirectCalls), solveRate) if listAll: print ", ".join( ["0x{:X}".format(x) for x in sorted(unsolvedIndirectCalls)]) return solvedIndirectCalls, unsolvedIndirectCalls