| 2 | |
| 3 | hexaPattern = re.compile(r'\b0x[0-9A-F]+\b') |
| 4 | def GetAllFunctions(): # get all function in a script |
| 5 | functionFile = open("dumpedMembers.txt","w+") |
| 6 | members = inspect.getmembers(sys.modules[__name__]) # the code will take all the members in the __main__ module, the main problem is that it can't dump main code function |
| 7 | for member in members: |
| 8 | match = re.search(hexaPattern,str(member[1])) |
| 9 | if(match): |
| 10 | functionFile.write("{\"functionName\":\""+str(member[0])+"\",\"functionAddr\":\""+match.group(0)+"\"}\n") |
| 11 | else: |
| 12 | functionFile.write("{\"functionName\":\""+str(member[0])+"\",\"functionAddr\":null}\n") |
| 13 | functionFile.close() |
| 14 | |
| 15 | GetAllFunctions() |