Python idc.Jump() Examples

The following are 20 code examples of idc.Jump(). 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 also want to check out all available functions/classes of the module idc , or try the search function .
Example #1
Source File: casc_plugin.py    From CASC with 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 #2
Source File: casc_plugin.py    From CASC with 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 #3
Source File: FunctionViewEx.py    From DIE with 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 #4
Source File: bap_comments.py    From bap-ida-python with 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 #5
Source File: imports.py    From idataco with 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 #6
Source File: Stingray.py    From Stingray with 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) )


# ------------------------------------------------------------------------------ 
Example #7
Source File: widgets.py    From rematch with 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 #8
Source File: casc_plugin.py    From CASC with 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 #9
Source File: ida_gef.py    From GdbPlugins with 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 #10
Source File: Reef.py    From Reef with 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 #11
Source File: interesting_xor.py    From idataco with 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 #12
Source File: TraceWidget.py    From idasec with 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 #13
Source File: byte_strings.py    From idataco with 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
Source File: calls.py    From idataco with 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 #15
Source File: switch_jumps.py    From idataco with 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 #16
Source File: IDASynergy.py    From IDASynergy with MIT License 5 votes vote down vote up
def jump_user_to(self, where):
            print "[+] Jumping to", where
            idc.Jump(int(where, 16)) 
Example #17
Source File: CallStackWalk.py    From nightmare with 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 #18
Source File: dataxrefcounter.py    From idapyscripts with 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 #19
Source File: create_tab_table.py    From win_driver_plugin with 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 #20
Source File: TraceWidget.py    From idasec with 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"