Exemple #1
0
def main():
    print("Starting ClassInformerPython")
    if autoIsOk():
        classes = run_gcc() if isGcc() else run_msvc()
        print(classes)
        show_classes(classes)
    else:
        print("Take it easy, man")
    print("Done")
def main():
    idc.Wait()
    if autoIsOk():
        classes = run_msvc()
        print classes
    else:
        print "Take it easy, man"
    print "Done"
    idc.Exit(0)
Exemple #3
0
def main():
    print "Starting ClassInformerPython"
    if autoIsOk():
        vtables = {}

        if isGcc():
          classes = run_gcc()
        else:
          classes, vtables = run_msvc()

        print "VTables:"
        print vtables
        print "Classes:"
        print classes

        show_classes(classes, vtables)
    else:
        print "Take it easy, man"
    print "Done"
Exemple #4
0
 def debug_event(self, text):
     auto_display = idaapi.auto_display_t()
     logger.debug(
         "event: auto=%d, AA_type=%d, AA_state=%d, text='%s'" %
         (idaapi.autoIsOk(), auto_display.type, auto_display.state, text))
Exemple #5
0
    def run(self, arg):
        if not idaapi.autoIsOk():
            if idaapi.askyn_c(
                    ASKBTN_CANCEL, "HIDECANCEL\n",
                    "The autoanalysis has not finished yet.\n",
                    "The result might be incomplete. Do you want to continue?"
            ) < ASKBTN_NO:
                return

        form_title = "ETM trace"
        form = idaapi.find_tform(form_title)

        if form != None:
            print "ETM trace window already open. Switching to it."
            idaapi.switchto_tform(form, True)
            return

        trace_file_name = idaapi.askfile_c(0, "",
                                           "Select a trace to display...")
        if len(trace_file_name) < 1:
            return

        image_name = idaapi.get_root_filename()

        f = open(trace_file_name, "r")

        #trace format: filename[0] id[1] type[2] description[3] src_addr[4] src_func_offset[5] src_image[6] =>[7] dst_addr[8] dst_func_offset[9] dst_image[10]
        start_branch = f.readline().split()

        if not start_branch:
            return

        while len(start_branch) != 11:
            start_branch = f.readline().split()
            if not start_branch:
                return

        self.c = EtmTraceChoose2(form_title, modal=False)

        self.c.callgraph.append("start")

        while True:
            next_branch = f.readline().split()
            if not next_branch:
                break

            start_branch[10] = start_branch[10].replace("(",
                                                        "").replace(")", "")
            start_branch[6] = start_branch[6].replace("(", "").replace(")", "")

            if start_branch[10].split("/")[-1] != image_name and start_branch[
                    6].split("/")[-1] != image_name:
                start_branch = next_branch
                continue

            if start_branch[10].split("/")[-1] != image_name:
                #to external lib
                self.c.add_jump_to_external(start_branch[1], start_branch[8],
                                            start_branch[10])
                start_branch = next_branch
                continue

            if start_branch[6].split("/")[-1] != image_name:
                #from external lib
                self.c.add_jump_from_external(start_branch[1], start_branch[4],
                                              start_branch[6])

            self.c.add_instruction_range(start_branch[1],
                                         [start_branch[8], next_branch[4]])
            start_branch = next_branch

        self.c.show()