def init():
        if fDebug:
            pydevd.settrace('localhost',
                            port=31337,
                            stdoutToServer=True,
                            stderrToServer=True,
                            suspend=False)
        if not idaapi.init_hexrays_plugin():
            print "[ERROR] Failed to initialize Hex-Rays SDK"
            return idaapi.PLUGIN_SKIP
        # from HexRaysPyTools.Settings import hex_pytools_config, Config
        if Settings.hex_pytools_config is None:
            Settings.Config()
        Settings.load_settings()
        logging.basicConfig(
            format='[%(levelname)s] %(message)s\t(%(module)s:%(funcName)s)')
        logging.root.setLevel(Settings.DEBUG_MESSAGE_LEVEL)
        Cache.temporary_structure = TemporaryStructureModel()
        ArrayCorrector.load_from_persistent()
        if Settings.hex_pytools_config is None:
            Settings.hex_pytools_config = Config()
        for ac in Settings.hex_pytools_config.actions:
            if Settings.hex_pytools_config.actions[ac]:
                Actions.register(Settings.hex_pytools_config.actions_refs[ac])

        # Actions.register(Actions.CreateVtable)
        # Actions.register(Actions.ShowGraph)
        # Actions.register(Actions.ShowClasses)
        # Actions.register(Actions.GetStructureBySize)
        # Actions.register(Actions.RemoveArgument)
        # Actions.register(Actions.AddRemoveReturn)
        # Actions.register(Actions.ConvertToUsercall)
        # Actions.register(Actions.ShallowScanVariable, Cache.temporary_structure)
        # Actions.register(Actions.DeepScanVariable, Cache.temporary_structure)
        # Actions.register(Actions.DeepScanReturn, Cache.temporary_structure)
        # Actions.register(Actions.DeepScanFunctions, Cache.temporary_structure)
        # Actions.register(Actions.RecognizeShape)
        # Actions.register(Actions.CreateNewField)
        # Actions.register(Actions.SelectContainingStructure, potential_negatives)
        # Actions.register(Actions.ResetContainingStructure)
        # Actions.register(Actions.RecastItemRight)
        # Actions.register(Actions.RecastItemLeft)
        # Actions.register(Actions.RenameOther)
        # Actions.register(Actions.RenameInside)
        # Actions.register(Actions.RenameOutside)
        # Actions.register(Actions.RenameUsingAssert)
        # Actions.register(Actions.SwapThenElse)
        # Actions.register(Actions.FindFieldXrefs)
        # Actions.register(Actions.PropagateName)
        # Actions.register(Actions.GuessAllocation)

        idaapi.attach_action_to_menu('View/Open subviews/Local types',
                                     Actions.ShowClasses.name,
                                     idaapi.SETMENU_APP)
        idaapi.install_hexrays_callback(hexrays_events_callback)

        Const.init()
        XrefStorage().open()

        return idaapi.PLUGIN_KEEP
Esempio n. 2
0
 def term():
     if Helper.temporary_structure:
         Helper.temporary_structure.clear()
     # Actions.unregister(Actions.CreateVtable)
     if hex_pytools_config:
         for ac in hex_pytools_config.actions:
             if hex_pytools_config.actions[ac]:
                 Actions.unregister(hex_pytools_config.actions_refs[ac])
     # Actions.unregister(Actions.ShowGraph)
     # Actions.unregister(Actions.ShowClasses)
     # Actions.unregister(Actions.GetStructureBySize)
     # Actions.unregister(Actions.RemoveArgument)
     # Actions.unregister(Actions.AddRemoveReturn)
     # Actions.unregister(Actions.ConvertToUsercall)
     # Actions.unregister(Actions.ShallowScanVariable)
     # Actions.unregister(Actions.DeepScanVariable)
     # Actions.unregister(Actions.DeepScanReturn)
     # Actions.unregister(Actions.RecognizeShape)
     # Actions.unregister(Actions.SelectContainingStructure)
     # Actions.unregister(Actions.ResetContainingStructure)
     # Actions.unregister(Actions.RecastItemRight)
     # Actions.unregister(Actions.RecastItemLeft)
     # Actions.unregister(Actions.RenameOther)
     # Actions.unregister(Actions.RenameInside)
     # Actions.unregister(Actions.RenameOutside)
     idaapi.term_hexrays_plugin()
    def term():
        if Cache.temporary_structure:
            Cache.temporary_structure.clear()
        # Actions.unregister(Actions.CreateVtable)
        ArrayCorrector.save_to_persistent()
        if Settings.hex_pytools_config:
            for ac in Settings.hex_pytools_config.actions:
                if Settings.hex_pytools_config.actions[ac]:
                    Actions.unregister(
                        Settings.hex_pytools_config.actions_refs[ac])

        # Actions.unregister(Actions.ShowGraph)
        # Actions.unregister(Actions.ShowClasses)
        # Actions.unregister(Actions.GetStructureBySize)
        # Actions.unregister(Actions.RemoveArgument)
        # Actions.unregister(Actions.AddRemoveReturn)
        # Actions.unregister(Actions.ConvertToUsercall)
        # Actions.unregister(Actions.ShallowScanVariable)
        # Actions.unregister(Actions.DeepScanVariable)
        # Actions.unregister(Actions.DeepScanReturn)
        # Actions.unregister(Actions.DeepScanFunctions)
        # Actions.unregister(Actions.RecognizeShape)
        # Actions.unregister(Actions.CreateNewField)
        # Actions.unregister(Actions.SelectContainingStructure)
        # Actions.unregister(Actions.ResetContainingStructure)
        # Actions.unregister(Actions.RecastItemRight)
        # Actions.unregister(Actions.RecastItemLeft)
        # Actions.unregister(Actions.RenameOther)
        # Actions.unregister(Actions.RenameInside)
        # Actions.unregister(Actions.RenameOutside)
        # Actions.unregister(Actions.RenameUsingAssert)
        # Actions.unregister(Actions.SwapThenElse)
        # Actions.unregister(Actions.FindFieldXrefs)
        # Actions.unregister(Actions.PropagateName)
        # Actions.unregister(Actions.GuessAllocation)

        idaapi.term_hexrays_plugin()
        XrefStorage().close()
Esempio n. 4
0
    def init():
        if fDebug:
            pydevd.settrace('localhost', port=31337, stdoutToServer=True, stderrToServer=True,suspend=False)
        if not idaapi.init_hexrays_plugin():
            print "[ERROR] Failed to initialize Hex-Rays SDK"
            return idaapi.PLUGIN_SKIP

        Helper.temporary_structure = TemporaryStructureModel()
        hex_pytools_config = Config()
        for ac in hex_pytools_config.actions:
            if hex_pytools_config.actions[ac]:
                Actions.register(hex_pytools_config.actions_refs[ac])
        # Actions.register(Actions.CreateVtable)
        # Actions.register(Actions.ShowGraph)
        # Actions.register(Actions.ShowClasses)
        # Actions.register(Actions.GetStructureBySize)
        # Actions.register(Actions.RemoveArgument)
        # Actions.register(Actions.AddRemoveReturn)
        # Actions.register(Actions.ConvertToUsercall)
        # Actions.register(Actions.ShallowScanVariable, Helper.temporary_structure)
        # Actions.register(Actions.DeepScanVariable, Helper.temporary_structure)
        # Actions.register(Actions.RecognizeShape)
        # Actions.register(Actions.SelectContainingStructure, potential_negatives)
        # Actions.register(Actions.ResetContainingStructure)
        # Actions.register(Actions.RecastItemRight)
        # Actions.register(Actions.RecastItemLeft)
        # Actions.register(Actions.RenameInside)
        # Actions.register(Actions.RenameOutside)

        idaapi.attach_action_to_menu('View/Open subviews/Local types', Actions.ShowClasses.name, idaapi.SETMENU_APP)
        idaapi.install_hexrays_callback(hexrays_events_callback)

        Helper.touched_functions.clear()
        Const.init()

        return idaapi.PLUGIN_KEEP
    def init():
        if not idaapi.init_hexrays_plugin():
            print "[ERROR] Failed to initialize Hex-Rays SDK"
            return idaapi.PLUGIN_SKIP

        Helper.temporary_structure = TemporaryStructureModel()

        # Actions.register(Actions.CreateVtable)
        Actions.register(Actions.ShowGraph)
        Actions.register(Actions.ShowClasses)
        Actions.register(Actions.GetStructureBySize)
        Actions.register(Actions.RemoveArgument)
        Actions.register(Actions.AddRemoveReturn)
        Actions.register(Actions.ConvertToUsercall)
        Actions.register(Actions.ShallowScanVariable, Helper.temporary_structure)
        Actions.register(Actions.DeepScanVariable, Helper.temporary_structure)
        Actions.register(Actions.DeepScanReturn, Helper.temporary_structure)
        Actions.register(Actions.RecognizeShape)
        Actions.register(Actions.SelectContainingStructure, potential_negatives)
        Actions.register(Actions.ResetContainingStructure)
        Actions.register(Actions.RecastItemRight)
        Actions.register(Actions.RecastItemLeft)
        Actions.register(Actions.RenameOther)
        Actions.register(Actions.RenameInside)
        Actions.register(Actions.RenameOutside)

        idaapi.attach_action_to_menu('View/Open subviews/Local types', Actions.ShowClasses.name, idaapi.SETMENU_APP)
        idaapi.install_hexrays_callback(hexrays_events_callback)

        Helper.touched_functions.clear()
        Const.init()

        return idaapi.PLUGIN_KEEP
Esempio n. 6
0
 def term():
     if Cache.temporary_structure:
         Cache.temporary_structure.clear()
     # Actions.unregister(Actions.CreateVtable)
     Actions.unregister(Actions.ShowGraph)
     Actions.unregister(Actions.ShowClasses)
     Actions.unregister(Actions.GetStructureBySize)
     Actions.unregister(Actions.RemoveArgument)
     Actions.unregister(Actions.AddRemoveReturn)
     Actions.unregister(Actions.ConvertToUsercall)
     Actions.unregister(Actions.ShallowScanVariable)
     Actions.unregister(Actions.DeepScanVariable)
     Actions.unregister(Actions.DeepScanReturn)
     Actions.unregister(Actions.DeepScanFunctions)
     Actions.unregister(Actions.RecognizeShape)
     Actions.unregister(Actions.CreateNewField)
     Actions.unregister(Actions.SelectContainingStructure)
     Actions.unregister(Actions.ResetContainingStructure)
     Actions.unregister(Actions.RecastItemRight)
     Actions.unregister(Actions.RecastItemLeft)
     Actions.unregister(Actions.RenameOther)
     Actions.unregister(Actions.RenameInside)
     Actions.unregister(Actions.RenameOutside)
     Actions.unregister(Actions.RenameUsingAssert)
     Actions.unregister(Actions.SwapThenElse)
     Actions.unregister(Actions.FindFieldXrefs)
     Actions.unregister(Actions.PropagateName)
     Actions.unregister(Actions.GuessAllocation)
     idaapi.term_hexrays_plugin()
     XrefStorage().close()
Esempio n. 7
0
    def init():
        if not idaapi.init_hexrays_plugin():
            print "[ERROR] Failed to initialize Hex-Rays SDK"
            return idaapi.PLUGIN_SKIP

        Cache.temporary_structure = TemporaryStructureModel()
        # Actions.register(Actions.CreateVtable)
        Actions.register(Actions.ShowGraph)
        Actions.register(Actions.ShowClasses)
        Actions.register(Actions.GetStructureBySize)
        Actions.register(Actions.RemoveArgument)
        Actions.register(Actions.AddRemoveReturn)
        Actions.register(Actions.ConvertToUsercall)
        Actions.register(Actions.ShallowScanVariable,
                         Cache.temporary_structure)
        Actions.register(Actions.DeepScanVariable, Cache.temporary_structure)
        Actions.register(Actions.DeepScanReturn, Cache.temporary_structure)
        Actions.register(Actions.DeepScanFunctions, Cache.temporary_structure)
        Actions.register(Actions.RecognizeShape)
        Actions.register(Actions.CreateNewField)
        Actions.register(Actions.SelectContainingStructure,
                         potential_negatives)
        Actions.register(Actions.ResetContainingStructure)
        Actions.register(Actions.RecastItemRight)
        Actions.register(Actions.RecastItemLeft)
        Actions.register(Actions.RenameOther)
        Actions.register(Actions.RenameInside)
        Actions.register(Actions.RenameOutside)
        Actions.register(Actions.RenameUsingAssert)
        Actions.register(Actions.SwapThenElse)
        Actions.register(Actions.FindFieldXrefs)
        Actions.register(Actions.PropagateName)
        Actions.register(Actions.GuessAllocation)

        idaapi.attach_action_to_menu('View/Open subviews/Local types',
                                     Actions.ShowClasses.name,
                                     idaapi.SETMENU_APP)
        idaapi.install_hexrays_callback(hexrays_events_callback)

        Const.init()
        XrefStorage().open()

        return idaapi.PLUGIN_KEEP
Esempio n. 8
0
 def term():
     if Helper.temporary_structure:
         Helper.temporary_structure.clear()
     Actions.unregister(Actions.CreateVtable)
     Actions.unregister(Actions.ShowGraph)
     Actions.unregister(Actions.ShowClasses)
     Actions.unregister(Actions.GetStructureBySize)
     Actions.unregister(Actions.RemoveArgument)
     Actions.unregister(Actions.AddRemoveReturn)
     Actions.unregister(Actions.ConvertToUsercall)
     Actions.unregister(Actions.ShallowScanVariable)
     Actions.unregister(Actions.DeepScanVariable)
     Actions.unregister(Actions.DeepScanReturn)
     Actions.unregister(Actions.DeepScanFunctions)
     Actions.unregister(Actions.RecognizeShape)
     Actions.unregister(Actions.CreateNewField)
     Actions.unregister(Actions.SelectContainingStructure)
     Actions.unregister(Actions.ResetContainingStructure)
     Actions.unregister(Actions.RecastItemRight)
     Actions.unregister(Actions.RecastItemLeft)
     Actions.unregister(Actions.RenameOther)
     Actions.unregister(Actions.RenameInside)
     Actions.unregister(Actions.RenameOutside)
     Actions.unregister(Actions.SwapThenElse)
     idaapi.term_hexrays_plugin()