Python idc.Jump() Examples

The following are 20 code examples for showing how to use idc.Jump(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module idc , or try the search function .

Example 1
Project: DIE   Author: ynvb   File: FunctionViewEx.py    License: MIT License 6 votes vote down vote up
def itemDoubleClickSlot(self, index):
        """
        TreeView DoubleClicked Slot.
        @param index: QModelIndex object of the clicked tree index item.
        @return:
        """
        function = index.data(role=DIE.UI.Function_Role)
        if function is not None:

            ea = function.function_start
            if function.is_lib_func:
                ea = function.proto_ea

            if ea is not None and ea is not idc.BADADDR:
                idc.Jump(ea)
                return True

        func_context = index.data(role=DIE.UI.FunctionContext_Role)
        if func_context is not None:
            ea = func_context.calling_ea
            if ea is not None and ea is not idc.BADADDR:
                idc.Jump(ea)
                return True 
Example 2
Project: bap-ida-python   Author: BinaryAnalysisPlatform   File: bap_comments.py    License: MIT License 6 votes vote down vote up
def run(self, arg):
        comms = {}
        for addr in ida.addresses():
            comm = idaapi.get_cmt(addr, 0)
            if comm:
                try:
                    parsed = bap_comment.parse(comm)
                    if parsed:
                        for (name, data) in parsed.items():
                            comms[(addr, name)] = data
                except:
                    idc.Message("BAP> failed to parse string {0}\n{1}".
                                format(comm, str(sys.exc_info()[1])))
        comms = [(name, addr, data)
                 for ((addr, name), data) in comms.items()]
        attrs = Attributes(comms)
        choice = attrs.Show(modal=True)
        if choice >= 0:
            idc.Jump(comms[choice][1]) 
Example 3
Project: CASC   Author: Cisco-Talos   File: casc_plugin.py    License: GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, bits):
        super(IntelMask, self).__init__(bits)

        self.maskings = [('ESP Offsets', 'sp_mask'),
                        ('EBP Offsets', 'bp_mask'),
                        ('Call Offsets', 'call_mask'),
                        ('Jump Offsets', 'jmp_mask'),
                        ('Global Offsets', 'global_mask'),
                        ('Customize', 'custom_mask')]
        self.registers = [  ('EAX', 'eax_mask'), ('EBX', 'ebx_mask'),
                            ('ECX', 'ecx_mask'), ('EDX', 'edx_mask'),
                            ('ESI', 'esi_mask'), ('EDI', 'edi_mask')]
        if not is_32bit():
            self.registers = []

        self.gui = self._init_gui() 
Example 4
Project: CASC   Author: Cisco-Talos   File: casc_plugin.py    License: GNU General Public License v2.0 6 votes vote down vote up
def subsignature_selected(self, item):
        try:
            match = self.matches[item.subsignature_name]
            self.match_label.setText("Match:   EA: 0x%08x  Length: % 4d     Bytes: %s" % \
                    (match["ea"], len(match["data"]), " ".join("%02x" % ord(x) for x in match["data"])))
            idc.Jump(match["ea"])
            for ea, color in self.previous_colors:
                idc.SetColor(ea, idc.CIC_ITEM, color)
            self.previous_colors = []
            for ea in idautils.Heads(match["ea"], match["ea"] + len(match["data"])):
                self.previous_colors.append((ea, idc.GetColor(ea, idc.CIC_ITEM)))
                idc.SetColor(ea, idc.CIC_ITEM, SIGALYZER_COLOR_HIGHLIGHTED)
        except KeyError:
            self.match_label.setText("No match")
            for ea, color in self.previous_colors:
                idc.SetColor(ea, idc.CIC_ITEM, color)
            self.previous_colors = []
        except IndexError:
            log.exception("While selecting subsignature") 
Example 5
Project: idasec   Author: RobinDavid   File: TraceWidget.py    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
def go_to_instruction(self, item):
        table = self.index_map[self.traces_tab.currentIndex()]
        addr_item = table.item(item.row(), 1)
        addr_s = addr_item.text()
        try:
            addr = int(addr_s, 0)
            idc.Jump(addr)
        except Exception:
            print "Cannot jump to the selected location" 
Example 6
Project: idasec   Author: RobinDavid   File: TraceWidget.py    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
def disassemble_from_trace(self):
        try:
            index = self.traces_tab.currentIndex()
            trace = self.core.traces[self.id_map[index]]

            self.disassemble_button.setFlat(True)
            found_match = False
            for k, inst in trace.instrs.items():
                if k in trace.metas:
                    for name, arg1, arg2 in trace.metas[k]:
                        if name == "wave":
                            self.parent.log("LOG", "Wave n°%d encountered at (%s,%x) stop.." % (arg1, k, inst.address))
                            prev_inst = trace.instrs[k-1]
                            idc.MakeComm(prev_inst.address, "Jump into Wave %d" % arg1)
                            self.disassemble_button.setFlat(False)
                            return
                # TODO: Check that the address is in the address space of the program
                if not idc.isCode(idc.GetFlags(inst.address)):
                    found_match = True
                    # TODO: Add an xref with the previous instruction
                    self.parent.log("LOG", "Addr:%x not decoded as an instruction" % inst.address)
                    if idc.MakeCode(inst.address) == 0:
                        self.parent.log("ERROR", "Fail to decode at:%x" % inst.address)
                    else:
                        idaapi.autoWait()
                        self.parent.log("SUCCESS", "Instruction decoded at:%x" % inst.address)

            if not found_match:
                self.parent.log("LOG", "All instruction are already decoded")
            self.disassemble_button.setFlat(False)
        except KeyError:
            print "No trace found to use" 
Example 7
Project: win_driver_plugin   Author: FSecureLABS   File: create_tab_table.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def OnSelectLine(self, n):

		item = self.items[n]

		jump_ea = int(item[0], 16)
		# Only jump for valid addresses
		if idaapi.IDA_SDK_VERSION < 700:
			valid_addr = idc.isEnabled(jump_ea)
		else:
			valid_addr = idc.is_mapped(jump_ea)
		if valid_addr:
			idc.Jump(jump_ea) 
Example 8
Project: idapyscripts   Author: onethawt   File: dataxrefcounter.py    License: MIT License 5 votes vote down vote up
def OnJump(self, row, column):
        ea = self.tableWidget.item(row, column).text()
        if column == 0:
            idc.Jump(int(ea, 16)) 
Example 9
Project: nightmare   Author: joxeankoret   File: CallStackWalk.py    License: GNU General Public License v2.0 5 votes vote down vote up
def enter(self, n):
        o = self.list[n-1]
        idc.Jump(o.caller)

# ----------------------------------------------------------------------- 
Example 10
Project: IDASynergy   Author: CubicaLabs   File: IDASynergy.py    License: MIT License 5 votes vote down vote up
def jump_user_to(self, where):
            print "[+] Jumping to", where
            idc.Jump(int(where, 16)) 
Example 11
Project: idataco   Author: jjo-sec   File: switch_jumps.py    License: GNU General Public License v3.0 5 votes vote down vote up
def click_tree(self):
        i = self._switch_tree.currentItem()
        addr = i.text(0).strip()
        if not addr.startswith("0x"):
            addr = idaapi.get_name_ea(idc.BADADDR, str(addr))
        else:
            addr = addr[2:10]
            addr = int(addr, 16)
        idc.Jump(addr)
        return 
Example 12
Project: idataco   Author: jjo-sec   File: calls.py    License: GNU General Public License v3.0 5 votes vote down vote up
def clickRow(self):
        addr = int(self._call_table.item(self._call_table.currentRow(), 1).text(), 16)
        if addr:
            idc.Jump(addr) 
Example 13
Project: idataco   Author: jjo-sec   File: byte_strings.py    License: GNU General Public License v3.0 5 votes vote down vote up
def click_row(self):
        i = self._bytestring_table.item(self._bytestring_table.currentRow(), 0)
        bstr = self._bytestring_table.item(self._bytestring_table.currentRow(), 2)
        addr = i.text().strip()
        bstr = bstr.text()
        if not addr.startswith("0x"):
            addr = idaapi.get_name_ea(idc.BADADDR, str(addr))
        else:
            addr = addr[2:10]
            addr = int(addr, 16)
        idc.Jump(addr)
        self._clipboard.setText(bstr) 
Example 14
Project: idataco   Author: jjo-sec   File: imports.py    License: GNU General Public License v3.0 5 votes vote down vote up
def clickRow(self):
        try:
            addr = int(self._import_table.item(self._import_table.currentRow(), 0).text(), 16)
            idc.Jump(addr)
        except Exception, e:
            log.error("Exception encountered: {}".format(e)) 
Example 15
Project: idataco   Author: jjo-sec   File: interesting_xor.py    License: GNU General Public License v3.0 5 votes vote down vote up
def click_row(self):
        addr = self._interesting_xor_table.item(self._interesting_xor_table.currentRow(), 1).text().strip()
        addr= int(addr, 16)
        idc.Jump(addr) 
Example 16
Project: Reef   Author: darx0r   File: Reef.py    License: GNU General Public License v3.0 5 votes vote down vote up
def OnSelectLine( self, n ):

        row = ReefConfig.CHOOSER_ROW( *self.items[n] )
        to = row.Address
        idc.Jump( int(to, 16) )


# ------------------------------------------------------------------------------ 
Example 17
Project: GdbPlugins   Author: gatieme   File: ida_gef.py    License: GNU General Public License v3.0 5 votes vote down vote up
def Jump(self, address):
        """ Jump(int addr) => None
        Move the IDA EA pointer to the address pointed by `addr`.
        Example: ida Jump 0x4049de
        """
        addr = long(address, 16) if ishex(address) else long(address)
        return idc.Jump(addr) 
Example 18
Project: CASC   Author: Cisco-Talos   File: casc_plugin.py    License: GNU General Public License v2.0 5 votes vote down vote up
def yara_match(self, strings):
        if isinstance(self.signatures_list.currentItem().parsed_signature, LdbSignature):
            self.matches = dict((x["identifier"], x) for x in strings)
        else:
            self.matches = {}
            self.match_label.setText("Match:   EA: 0x%08x  Length: % 4d     Bytes: %s" % \
                    (strings[0]["ea"], len(strings[0]["data"]), " ".join("%02x" % ord(x) for x in strings[0]["data"])))
            idc.Jump(strings[0]["ea"])
            for ea in idautils.Heads(strings[0]["ea"], strings[0]["ea"] + len(strings[0]["data"])):
                self.previous_colors.append((ea, idc.GetColor(ea, idc.CIC_ITEM)))
                idc.SetColor(ea, idc.CIC_ITEM, SIGALYZER_COLOR_HIGHLIGHTED) 
Example 19
Project: rematch   Author: nirizr   File: widgets.py    License: GNU General Public License v3.0 5 votes vote down vote up
def label_clicked(self, checked):
    del checked
    idc.Jump(self.func.startEA) 
Example 20
Project: Stingray   Author: darx0r   File: Stingray.py    License: GNU General Public License v3.0 5 votes vote down vote up
def OnSelectLine( self, n ):

        row = ConfigStingray.CHOOSER_ROW( *self.items[n] )
        xref = row.Xref.split(':')[-1]
        idc.Jump( int(xref, 16) )


# ------------------------------------------------------------------------------