コード例 #1
0
ファイル: ida_plugin.py プロジェクト: snyiu100/ipyida
def load():
    """
    Perform necessary steps to load the plugin inside IDA. If no IDB is open, it
    will wait until it is open to load it.
    """
    if idaapi.get_root_filename() is None:
        # No idb open yet
        def handler(event, old=0):
            if event == idaapi.NW_OPENIDB:
                _do_load()
            elif event == idaapi.NW_TERMIDA:
                idaapi.notify_when(
                    idaapi.NW_TERMIDA | idaapi.NW_OPENIDB | idaapi.NW_REMOVE,
                    handler)

        def _install():
            idaapi.notify_when(idaapi.NW_TERMIDA | idaapi.NW_OPENIDB, handler)
            # return -1 to remove the timer
            return -1

        # It's possible we can't use the notify_when API call yet when IDA opens
        # so try register a timer to add the event listner in the proper "state"
        idaapi.register_timer(1, _install)
    else:
        # IDA is fully loaded and an idb is open, just load the plugin.
        _do_load()
コード例 #2
0
def on_open():
    print 'revsync: file opened:', idaapi.get_root_filename()
    global auto_wait
    if autoIsOk():
        on_load()
        auto_wait = False
    else:
        auto_wait = True
        print 'revsync: waiting for auto analysis'
        if not hasattr(IDP_Hooks, 'auto_empty_finally'):
            idaapi.register_timer(1000, wait_for_analysis)
コード例 #3
0
 def _do_run(self):
     try:
         super(BapIda, self).run()
         BapIda.instances.append(self)
         idaapi.register_timer(self.poll_interval_ms, self.update)
         idc.SetStatus(idc.IDA_STATUS_THINKING)
         self.run_handlers('instance_created')
         idc.Message("BAP> created new instance with PID {0}\n".
                     format(self.proc.pid))
     except:  # pylint: disable=bare-except
         idc.Message("BAP> failed to create instance\nError: {0}\n".
                     format(str(sys.exc_info()[1])))
         traceback.print_exc()
コード例 #4
0
 def _do_run(self):
     try:
         super(BapIda, self).run()
         BapIda.instances.append(self)
         idaapi.register_timer(self.poll_interval_ms, self.update)
         idc.SetStatus(idc.IDA_STATUS_THINKING)
         self.run_handlers('instance_created')
         idc.Message("BAP> created new instance with PID {0}\n".format(
             self.proc.pid))
     except:  # pylint: disable=bare-except
         idc.Message("BAP> failed to create instance\nError: {0}\n".format(
             str(sys.exc_info()[1])))
         traceback.print_exc()
コード例 #5
0
	def run(self, arg):
		if self.timer_obj != None:
			return
		self.updateView()
		self.viewer.show()
		self.timer_obj = idaapi.register_timer(250, self.updateView)
		return
コード例 #6
0
	def init(self):
		self.timer_obj = idaapi.register_timer(250, self.updateView)
		self.viewer = PyQt5.uic.loadUi(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + "\insnt_t_ui.ui")
		self.savedcloseEvent = self.viewer.closeEvent
		self.viewer.closeEvent = self.closeEvent
		
		self.viewer.show()
		self.viewer.auxpref_tree.topLevelItem(0).setExpanded(True)	
		self.viewer.auxpref_tree.topLevelItem(1).setExpanded(True)	
		self.viewer.auxpref_tree.topLevelItem(2).setExpanded(True)				
		self.viewer.optree.topLevelItem(0).setExpanded(True)		
		self.viewer.optree.topLevelItem(1).setExpanded(True)		
		self.viewer.optree.topLevelItem(2).setExpanded(True)		
		self.viewer.optree.topLevelItem(3).setExpanded(True)		
		self.viewer.optree.topLevelItem(4).setExpanded(True)		
		self.viewer.optree.topLevelItem(5).setExpanded(True)		
		self.viewer.optree.topLevelItem(6).setExpanded(True)		
		self.viewer.optree.topLevelItem(6).child(0).setExpanded(True)
		self.viewer.optree.topLevelItem(6).child(1).setExpanded(True)
		self.viewer.optree.topLevelItem(7).setExpanded(True)		
		self.viewer.optree.topLevelItem(8).setExpanded(True)		
		self.viewer.optree.topLevelItem(9).setExpanded(True)	
		
		self.viewer.optree.topLevelItem(9).child(0).setExpanded(True)		
		self.viewer.optree.topLevelItem(9).child(1).setExpanded(True)		
		self.viewer.optree.topLevelItem(9).child(2).setExpanded(True)		
		self.viewer.optree.topLevelItem(9).child(3).setExpanded(True)	

		self.viewer.operandSelector.currentChanged.connect(self.operandSelected)		

		return self.flags
コード例 #7
0
            def register(cls, id, interval, fn):
                """register a python function as a timer"""
                if id in cls.clock:
                    idaapi.unregister_timer(cls.clock[id])

                # XXX: need to create a closure that can terminate when signalled
                cls.clock[id] = res = idaapi.register_timer(interval, fn)
                return res
コード例 #8
0
ファイル: ui.py プロジェクト: arizvisa/idascripts
    def register(cls, id, interval, callable):
        '''Register the specified `callable` with the requested `id` to be called at every `interval`.'''
        if id in cls.clock:
            idaapi.unregister_timer(cls.clock[id])

        # XXX: need to create a closure that can terminate when signalled
        cls.clock[id] = res = idaapi.register_timer(interval, callable)
        return res
コード例 #9
0
ファイル: helper.py プロジェクト: IDA-RE-things/idascripts
        def register(cls, id, interval, fn):
            """register a python function as a timer"""
            if id in cls.clock:
                idaapi.unregister_timer(cls.clock[id])

            # XXX: need to create a closure that can terminate when signalled
            cls.clock[id] = res = idaapi.register_timer(interval, fn)
            return res
コード例 #10
0
ファイル: ui.py プロジェクト: heruix/ida-minsc
    def register(cls, id, interval, callable):
        '''Register the specified `callable` with the requested `id` to be called at every `interval`.'''
        if id in cls.clock:
            idaapi.unregister_timer(cls.clock[id])

        # XXX: need to create a closure that can terminate when signalled
        cls.clock[id] = res = idaapi.register_timer(interval, callable)
        return res
コード例 #11
0
    def OnCreate(self, form):
        self.parent = self.FormToPySideWidget(form)

        # Create display of registers
        self.label = QLabel("info to go here...")

        self.detail = DetailWidget(self.db, self.parent)
        QObject.connect(self.detail, SIGNAL('databaseFileNameSelected'),
                        self.setSelectedDatabase_Slot)
        QObject.connect(self.detail, SIGNAL('searchRequested'),
                        self.searchSnapshots_Slot)

        self.search = SearchWidget(self.db, self.parent)
        QObject.connect(self.search, SIGNAL('selectedSearchInstance'),
                        self.searchClickedIndex_Slot)

        # Create list
        self.model = QStandardItemModel(0, len(self.headers), self.parent)
        for i in range(len(self.headers)):
            self.model.setHorizontalHeaderItem(i,
                                               QStandardItem(self.headers[i]))

        self.root_item = self.model.invisibleRootItem()
        self.current_selection = []
        self.selectionModel = QItemSelectionModel(self.model)
        # QObject.connect(self.selectionModel, SIGNAL('selectionChanged(const QItemSelection&, const QItemSelection&)'), self.selectionChanged_Slot)

        self.proxyModel = QSortFilterProxyModel()
        self.proxyModel.setSourceModel(self.model)

        self.treeview = QTreeView(self.parent)
        self.treeview.setRootIsDecorated(False)
        self.treeview.setAlternatingRowColors(True)
        self.treeview.setSortingEnabled(False)
        self.treeview.setModel(self.model)
        self.treeview.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.treeview.setSelectionModel(self.selectionModel)
        self.treeview.setUniformRowHeights(True)
        self.treeview.setStyleSheet(CSS_TREEVIEW)

        QObject.connect(self.treeview, SIGNAL("clicked(const QModelIndex&)"),
                        self.clickedIndex_Slot)

        self.tabWidget = QTabWidget(self.parent)
        self.tabWidget.setTabPosition(QTabWidget.South)
        self.tabWidget.addTab(self.treeview, "Nearby Trace Points")
        self.tabWidget.addTab(self.search, "Search Results")

        # Create layout
        layout = QVBoxLayout()
        layout.addWidget(self.detail)
        layout.addWidget(self.tabWidget)
        self.parent.setLayout(layout)

        # Query the DB and populate the list
        self.updateModel()
        self.timer = idaapi.register_timer(200, self.refresh)
コード例 #12
0
    def start(self):
        if self._timer is not None:
            raise Exception("IPython kernel is already running.")

        # The IPKernelApp initialization is based on the IPython source for
        # IPython.embed_kernel available here:
        # https://github.com/ipython/ipython/blob/rel-3.2.1/IPython/kernel/zmq/embed.py

        if IPKernelApp.initialized():
            app = IPKernelApp.instance()
        else:
            app = IPKernelApp.instance(outstream_class="ipyida.kernel.IDATeeOutStream")
            app.initialize()

            main = app.kernel.shell._orig_sys_modules_main_mod
            if main is not None:
                sys.modules[app.kernel.shell._orig_sys_modules_main_name] = main

            # IPython <= 3.2.x will send exception to sys.__stderr__ instead of
            # sys.stderr. IDA's console will not be able to display exceptions if we
            # don't send it to IDA's sys.stderr. To fix this, we call both the
            # ipython's and IDA's excepthook (IDA's excepthook is actually Python's
            # default).
            sys.excepthook = wrap_excepthook(sys.excepthook)

        # Load the calling scope
        (ida_module, ida_locals) = IPython.utils.frame.extract_module_locals(1)

        if "idaapi" not in ida_locals:
            raise Exception(
                "{0:s} must be called from idapythonrc.py or "
                "IDA's prompt.".format("IPythonKernel.start")
            )

        app.kernel.user_module = ida_module
        app.kernel.user_ns = ida_locals

        app.shell.set_completer_frame()

        app.kernel.start()
        app.kernel.do_one_iteration()

        self.connection_file = app.connection_file
        basename = os.path.basename(self.connection_file)
        print(
            "[IPyIDA] Connect with another client using --existing {}".format(basename)
        )

        def ipython_kernel_iteration():
            app.kernel.do_one_iteration()
            return int(1000 * app.kernel._poll_interval)

        self._timer = idaapi.register_timer(
            int(1000 * app.kernel._poll_interval), ipython_kernel_iteration
        )
コード例 #13
0
ファイル: ida_frontend.py プロジェクト: zackorndorff/revsync
def on_open():
    global auto_wait
    global fhash
    print('revsync: file opened:', idaapi.get_root_filename())
    netnode.create(NETNODE_NAME)
    try: fhash = netnode.getblob(0, 'I').decode('ascii')
    except: fhash = None
    if not fhash:
        fhash = read_fhash()
        try: ret = netnode.setblob(fhash.encode('ascii'), 0, 'I')
        except: print('saving fhash failed, this will probably break revsync')

    if auto_is_ok():
        on_load()
        auto_wait = False
    else:
        auto_wait = True
        print('revsync: waiting for auto analysis')
        if not hasattr(IDP_Hooks, 'auto_empty_finally'):
            idaapi.register_timer(1000, wait_for_analysis)
コード例 #14
0
ファイル: ida-pin.py プロジェクト: Debug-Orz/runtime-tracer
    def OnCreate(self, form):
        self.parent = self.FormToPySideWidget(form)

        # Create display of registers
        self.label = QLabel("info to go here...")

        self.detail = DetailWidget(self.db, self.parent)
        QObject.connect(self.detail, SIGNAL('databaseFileNameSelected'), self.setSelectedDatabase_Slot)
        QObject.connect(self.detail, SIGNAL('searchRequested'), self.searchSnapshots_Slot)

        self.search = SearchWidget(self.db, self.parent)
        QObject.connect(self.search, SIGNAL('selectedSearchInstance'), self.searchClickedIndex_Slot)

        # Create list
        self.model = QStandardItemModel(0, len(self.headers), self.parent)
        for i in range(len(self.headers)):
            self.model.setHorizontalHeaderItem(i, QStandardItem(self.headers[i]))

        self.root_item = self.model.invisibleRootItem()
        self.current_selection = []
        self.selectionModel = QItemSelectionModel(self.model)
        # QObject.connect(self.selectionModel, SIGNAL('selectionChanged(const QItemSelection&, const QItemSelection&)'), self.selectionChanged_Slot)

        self.proxyModel = QSortFilterProxyModel()
        self.proxyModel.setSourceModel(self.model)

        self.treeview = QTreeView(self.parent)
        self.treeview.setRootIsDecorated(False)
        self.treeview.setAlternatingRowColors(True)
        self.treeview.setSortingEnabled(False)
        self.treeview.setModel(self.model)
        self.treeview.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.treeview.setSelectionModel(self.selectionModel)
        self.treeview.setUniformRowHeights(True)
        self.treeview.setStyleSheet(CSS_TREEVIEW)

        QObject.connect(self.treeview, SIGNAL("clicked(const QModelIndex&)"), self.clickedIndex_Slot)


        self.tabWidget = QTabWidget(self.parent)
        self.tabWidget.setTabPosition(QTabWidget.South) 
        self.tabWidget.addTab(self.treeview, "Nearby Trace Points")
        self.tabWidget.addTab(self.search, "Search Results")

        # Create layout
        layout = QVBoxLayout()
        layout.addWidget(self.detail)
        layout.addWidget(self.tabWidget)
        self.parent.setLayout(layout)

        # Query the DB and populate the list
        self.updateModel()
        self.timer = idaapi.register_timer(200, self.refresh)
コード例 #15
0
ファイル: ida_ipython.py プロジェクト: NyaMisty/ida_ipython
    def start_kernel(self):
        argv = None
        if self.connection_file:
            argv = ['-f', self.connection_file]

        kernel_iteration = self.start(argv)

        def timer_callback():
            kernel_iteration()
            return int(1000 * self.kernel_app.kernel._poll_interval)

        self.timer = idaapi.register_timer(
            int(1000 * self.kernel_app.kernel._poll_interval), timer_callback)
コード例 #16
0
ファイル: ida_plugin.py プロジェクト: IamSpid3r/ipyida
def load():
    """
    Perform necessary steps to load the plugin inside IDA. If no IDB is open, it
    will wait until it is open to load it.
    """
    if idaapi.get_root_filename() is None:
        # No idb open yet
        def handler(event, old=0):
            if event == idaapi.NW_OPENIDB:
                _do_load()
            elif event == idaapi.NW_TERMIDA:
                idaapi.notify_when(idaapi.NW_TERMIDA | idaapi.NW_OPENIDB | idaapi.NW_REMOVE, handler)
        def _install():
            idaapi.notify_when(idaapi.NW_TERMIDA | idaapi.NW_OPENIDB, handler)
            # return -1 to remove the timer
            return -1
        # It's possible we can't use the notify_when API call yet when IDA opens
        # so try register a timer to add the event listner in the proper "state"
        idaapi.register_timer(1, _install)
    else:
        # IDA is fully loaded and an idb is open, just load the plugin.
        _do_load()
コード例 #17
0
ファイル: kernel.py プロジェクト: IamSpid3r/ipyida
    def start(self):
        if self._timer is not None:
            raise Exception("IPython kernel is already running.")

        # The IPKernelApp initialization is based on the IPython source for
        # IPython.embed_kernel available here:
        # https://github.com/ipython/ipython/blob/rel-3.2.1/IPython/kernel/zmq/embed.py

        if IPKernelApp.initialized():
            app = IPKernelApp.instance()
        else:
            app = IPKernelApp.instance(
                outstream_class='ipyida.kernel.IDATeeOutStream'
            )
            app.initialize()

            main = app.kernel.shell._orig_sys_modules_main_mod
            if main is not None:
                sys.modules[app.kernel.shell._orig_sys_modules_main_name] = main
        
            # IPython <= 3.2.x will send exception to sys.__stderr__ instead of
            # sys.stderr. IDA's console will not be able to display exceptions if we
            # don't send it to IDA's sys.stderr. To fix this, we call both the
            # ipython's and IDA's excepthook (IDA's excepthook is actually Python's
            # default).
            sys.excepthook = wrap_excepthook(sys.excepthook)

        # Load the calling scope
        (ida_module, ida_locals) = IPython.utils.frame.extract_module_locals(1)

        if 'idaapi' not in ida_locals:
            raise Exception("{0:s} must be called from idapythonrc.py or "
                            "IDA's prompt.".format("IPythonKernel.start"))

        app.kernel.user_module = ida_module
        app.kernel.user_ns = ida_locals

        app.shell.set_completer_frame()

        app.kernel.start()
        app.kernel.do_one_iteration()
    
        self.connection_file = app.connection_file

        def ipython_kernel_iteration():
            app.kernel.do_one_iteration()
            return int(1000 * app.kernel._poll_interval)
        self._timer = idaapi.register_timer(int(1000 * app.kernel._poll_interval), ipython_kernel_iteration)
コード例 #18
0
    def start(self):
        if self._timer is not None:
            raise Exception("IPython kernel is already running.")

        # The IPKernelApp initialization is based on the IPython source for
        # IPython.embed_kernel available here:
        # https://github.com/ipython/ipython/blob/rel-3.2.1/IPython/kernel/zmq/embed.py

        if IPKernelApp.initialized():
            app = IPKernelApp.instance()
        else:
            # Load IPyIDA's user init file into the user namespace if it exists.
            if os.path.exists(IPYIDARC_PATH):
                IPKernelApp.exec_files = [IPYIDARC_PATH]

            app = IPKernelApp.instance(
                outstream_class='ipyida.kernel.IDATeeOutStream')
            app.initialize()

            main = app.kernel.shell._orig_sys_modules_main_mod
            if main is not None:
                sys.modules[
                    app.kernel.shell._orig_sys_modules_main_name] = main

            # IPython <= 3.2.x will send exception to sys.__stderr__ instead of
            # sys.stderr. IDA's console will not be able to display exceptions if we
            # don't send it to IDA's sys.stderr. To fix this, we call both the
            # ipython's and IDA's excepthook (IDA's excepthook is actually Python's
            # default).
            sys.excepthook = wrap_excepthook(sys.excepthook)

        app.shell.set_completer_frame()

        app.kernel.start()

        self.connection_file = app.connection_file

        if not is_using_ipykernel_5():
            app.kernel.do_one_iteration()

            def ipython_kernel_iteration():
                app.kernel.do_one_iteration()
                return int(1000 * app.kernel._poll_interval)

            self._timer = idaapi.register_timer(
                int(1000 * app.kernel._poll_interval),
                ipython_kernel_iteration)
コード例 #19
0
    def init(self):

        self.kernel_app = None
        self.menu_items = []
        self.qtconsole_processes = []

        argv = None
        connection_file = os.environ.get("JUPYTER_CONNECTION", None)
        if connection_file:
            argv = ['-f', connection_file]

        kernel_iteration = self.start(argv)

        def timer_callback():
            kernel_iteration()
            return int(1000 * self.kernel_app.kernel._poll_interval)

        self.timer = idaapi.register_timer(
            int(1000 * self.kernel_app.kernel._poll_interval), timer_callback)

        return idaapi.PLUGIN_KEEP
コード例 #20
0
ファイル: ida.py プロジェクト: IDA-RE-things/toolbag
 def registerTimer(self, interval, obj):
     return idaapi.register_timer(interval, obj)
コード例 #21
0
 def ts_setup_timer():
     """
         Thread safe wrapper for setting up
         the sync callback
     """
     idaapi.register_timer(self.delay, update)
コード例 #22
0
 def hook(self, *args):
     self.timer = idaapi.register_timer(self.timer_freq, self.check_thread)
     super(DbgHooks, self).hook(*args)
コード例 #23
0
ファイル: idaref.py プロジェクト: nologic/idaref
    def create(self):
        if(idaapi.find_tform(self.title) == None):
            if(not idaapi.simplecustviewer_t.Create(self, self.title)):
                print "Unable to open"
                return False
            
            if idaapi.IDA_SDK_VERSION >= 700:
                self.menu_update = 1
                self.menu_lookup = 2
                self.menu_autorefresh = 3
                self.change_arch = 4
                
                class Hooks(idaapi.UI_Hooks):
                    class PopupActionHandler(idaapi.action_handler_t):
                        def __init__(self, owner, menu_id):
                            self.owner = owner
                            self.menu_id = menu_id
                        
                        def activate(self, ctx):
                            self.owner.OnPopupMenu(self.menu_id)
                            
                        def update(self, ctx):
                            return idaapi.AST_ENABLE_ALWAYS
                            
                    def __init__(self, form):
                        idaapi.UI_Hooks.__init__(self)
                        self.form = form
                    def finish_populating_widget_popup(self, widget, popup):
                        if self.form.title == idaapi.get_widget_title(widget):
                            idaapi.attach_dynamic_action_to_popup(widget, popup, idaapi.action_desc_t(None, "Update View", self.PopupActionHandler(self.form, self.form.menu_update),   None, None, -1))
                            idaapi.attach_dynamic_action_to_popup(widget, popup, idaapi.action_desc_t(None, "Lookup Instruction", self.PopupActionHandler(self.form, self.form.menu_lookup),   None, None, -1))
                            idaapi.attach_dynamic_action_to_popup(widget, popup, idaapi.action_desc_t(None, "Toggle Auto-refresh", self.PopupActionHandler(self.form, self.form.menu_autorefresh),   None, None, -1))
                            idaapi.attach_action_to_popup(widget, popup, "-", None)
                            idaapi.attach_dynamic_action_to_popup(widget, popup, idaapi.action_desc_t(None, "Change Architecture", self.PopupActionHandler(self.form, self.form.change_arch),  None, None, -1))
                            idaapi.attach_action_to_popup(widget, popup, "-", None)        
                self.hooks = Hooks(self)
                self.hooks.hook()
            else:
                self.menu_update = self.AddPopupMenu("Update View")
                self.menu_lookup = self.AddPopupMenu("Lookup Instruction")
                self.menu_autorefresh = self.AddPopupMenu("Toggle Auto-refresh")
                self.change_arch = self.AddPopupMenu("Change Architecture")

            self.Show()

            def update():
                if (self.destroying == True or idaapi.find_tform(self.title) == None):
                    return -1
                else:
                    if(self.do_auto):
                        self.update()

                    return 200

            if('register_timer' in dir(idaapi)):
                idaapi.register_timer(200, update)

                self.is_loaded = True
            else:
                print "Sorry I can't support auto-refresh in your version of IDA."
                print "Use 'ref.update()' to get documentation for your instruction."
        else:
            print "Already loaded. Please close old instance first."
コード例 #24
0
ファイル: skelenox.py プロジェクト: ANSSI-FR/polichombr
 def ts_setup_timer():
     """
         Thread safe wrapper for setting up
         the sync callback
     """
     idaapi.register_timer(self.delay, update)
コード例 #25
0
ファイル: highlight_calls.py プロジェクト: ababook/Sark
 def init(self):
     # self.ui_hooks = UiHooks()
     # self.ui_hooks.hook()
     highlighter = CallHighlighter(100)
     self.timer = idaapi.register_timer(highlighter.interval, highlighter.run)
     return idaapi.PLUGIN_KEEP
コード例 #26
0
    def create(self):
        if (idaapi.find_tform(self.title) == None):
            if (not idaapi.simplecustviewer_t.Create(self, self.title)):
                print "Unable to open"
                return False

            if idaapi.IDA_SDK_VERSION >= 700:
                self.menu_update = 1
                self.menu_lookup = 2
                self.menu_autorefresh = 3
                self.change_arch = 4

                class Hooks(idaapi.UI_Hooks):
                    class PopupActionHandler(idaapi.action_handler_t):
                        def __init__(self, owner, menu_id):
                            self.owner = owner
                            self.menu_id = menu_id

                        def activate(self, ctx):
                            self.owner.OnPopupMenu(self.menu_id)

                        def update(self, ctx):
                            return idaapi.AST_ENABLE_ALWAYS

                    def __init__(self, form):
                        idaapi.UI_Hooks.__init__(self)
                        self.form = form

                    def finish_populating_widget_popup(self, widget, popup):
                        if self.form.title == idaapi.get_widget_title(widget):
                            idaapi.attach_dynamic_action_to_popup(
                                widget, popup,
                                idaapi.action_desc_t(
                                    None, "Update View",
                                    self.PopupActionHandler(
                                        self.form, self.form.menu_update),
                                    None, None, -1))
                            idaapi.attach_dynamic_action_to_popup(
                                widget, popup,
                                idaapi.action_desc_t(
                                    None, "Lookup Instruction",
                                    self.PopupActionHandler(
                                        self.form, self.form.menu_lookup),
                                    None, None, -1))
                            idaapi.attach_dynamic_action_to_popup(
                                widget, popup,
                                idaapi.action_desc_t(
                                    None, "Toggle Auto-refresh",
                                    self.PopupActionHandler(
                                        self.form, self.form.menu_autorefresh),
                                    None, None, -1))
                            idaapi.attach_action_to_popup(
                                widget, popup, "-", None)
                            idaapi.attach_dynamic_action_to_popup(
                                widget, popup,
                                idaapi.action_desc_t(
                                    None, "Change Architecture",
                                    self.PopupActionHandler(
                                        self.form, self.form.change_arch),
                                    None, None, -1))
                            idaapi.attach_action_to_popup(
                                widget, popup, "-", None)

                self.hooks = Hooks(self)
                self.hooks.hook()
            else:
                self.menu_update = self.AddPopupMenu("Update View")
                self.menu_lookup = self.AddPopupMenu("Lookup Instruction")
                self.menu_autorefresh = self.AddPopupMenu(
                    "Toggle Auto-refresh")
                self.change_arch = self.AddPopupMenu("Change Architecture")

            self.Show()

            def update():
                if (self.destroying == True
                        or idaapi.find_tform(self.title) == None):
                    return -1
                else:
                    if (self.do_auto):
                        self.update()

                    return 200

            if ('register_timer' in dir(idaapi)):
                idaapi.register_timer(200, update)

                self.is_loaded = True
            else:
                print "Sorry I can't support auto-refresh in your version of IDA."
                print "Use 'ref.update()' to get documentation for your instruction."
        else:
            print "Already loaded. Please close old instance first."
コード例 #27
0
ファイル: bcplugin.py プロジェクト: zan00789/bincat
 def __init__(self, qprocess):
     self.interval = 500  # ms
     self.qprocess = qprocess
     self.timer = idaapi.register_timer(self.interval, self)
     if self.timer is None:
         raise RuntimeError, "Failed to register timer"
コード例 #28
0
def start_plugin():
    idaapi.register_timer(1000, wait_ready)
コード例 #29
0
 def registerTimer(self, interval, obj):
     return idaapi.register_timer(interval, obj)
コード例 #30
0
	def __init__(self):
		self.interval = 1000 # 1 second
		self.obj = idaapi.register_timer(self.interval, self)
		if self.obj is None:
			raise RuntimeError("Failed to register timer")
		self.times = WAIT_TIME_NO_UI
コード例 #31
0
### Replace sys.displayhook with our own so that IDAPython can't tamper with
### our __repr__ implementations.
__import__('sys').displayhook = ui.DisplayHook().displayhook

### Construct a priority notification handler, and inject into IDA because it
### needs to exist for everything to initialize/deinitialize properly.

__notification__ = __import__('internal').interface.prioritynotification()
idaapi.__notification__ = __notification__

### Now we can install our hooks that initialize/uninitialize MINSC
try:
    idaapi.__notification__.add(idaapi.NW_INITIDA, __import__('hooks').make_ida_not_suck_cocks, -1000)

# If installing that hook failed, then register our hook with a timer, and warn
# the user about this.
except NameError:
    TIMEOUT = 5
    __import__('logging').warning("Unable to add notification for idaapi.NW_INITIDA ({:d}). Registering a {:.1f} second timer to setup hooks...".format(idaapi.NW_INITIDA, TIMEOUT))
    idaapi.register_timer(TIMEOUT, __import__('hooks').ida_is_busy_sucking_cocks)
    del(TIMEOUT)

# If we were able to hook NW_INITIDA, then the NW_TERMIDA hook should also work.
else:
    try:
        idaapi.__notification__.add(idaapi.NW_TERMIDA, __import__('hooks').make_ida_suck_cocks, +1000)

    # Installing the termination hook failed, but it's not really too important...
    except NameError:
        __import__('logging').warning("Unable to add notification for idaapi.NW_TERMIDA ({:d}).".format(idaapi.NW_TERMIDA))
コード例 #32
0
hook3 = UIHooks()


def eventhook(event, old=0):
    if event == idaapi.NW_OPENIDB:
        on_open()
    elif event in (idaapi.NW_CLOSEIDB, idaapi.NW_TERMIDA):
        on_close()
    if event == idaapi.NW_TERMIDA:
        # remove hook on way out
        idaapi.notify_when(
            idaapi.NW_OPENIDB | idaapi.NW_CLOSEIDB | idaapi.NW_TERMIDA
            | idaapi.NW_REMOVE, eventhook)


def setup():
    if idaapi.get_root_filename():
        on_open()
    else:
        idaapi.notify_when(
            idaapi.NW_OPENIDB | idaapi.NW_CLOSEIDB | idaapi.NW_TERMIDA,
            eventhook)
    return -1


hook1.hook()
hook2.hook()
hook3.hook()
idaapi.register_timer(1000, setup)
print 'revsync: starting setup timer'
コード例 #33
0
ファイル: ex_timer.py プロジェクト: AmesianX/src
 def __init__(self):
     self.interval = 1000
     self.obj = idaapi.register_timer(self.interval, self)
     if self.obj is None:
         raise RuntimeError("Failed to register timer")
     self.times = 5
コード例 #34
0
 def __init__(self):
     self.interval = 1000
     self.obj = idaapi.register_timer(self.interval, self)
     if self.obj is None:
         raise RuntimeError("Failed to register timer")
     self.times = 5
コード例 #35
0
def start_plugin():
    global start_time
    start_time = time.time()
    idaapi.register_timer(1000, wait_ready)