当前位置: 首页>>代码示例>>Python>>正文


Python idaapi.read_selection方法代码示例

本文整理汇总了Python中idaapi.read_selection方法的典型用法代码示例。如果您正苦于以下问题:Python idaapi.read_selection方法的具体用法?Python idaapi.read_selection怎么用?Python idaapi.read_selection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idaapi的用法示例。


在下文中一共展示了idaapi.read_selection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setMatchType

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import read_selection [as 别名]
def setMatchType(self, type):
        try:
            selection, begin, end = None, None, None
            err = idaapi.read_selection(selection, begin, end)
            if err and selection:
                for ea in range(begin, end+1):
                    self.cc.PatternGenerator.setMatchType(ea, type)
            else:
                self.cc.PatternGenerator.setMatchType(idc.get_screen_ea(), type)  
        except:
            self.cc.PatternGenerator.setMatchType(idc.ScreenEA(), type)

        self._render_if_real_time() 
开发者ID:AirbusCyber,项目名称:grap,代码行数:15,代码来源:PatternGenerationWidget.py

示例2: finish_populating_widget_popup

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import read_selection [as 别名]
def finish_populating_widget_popup(self, form, popup):
        form_type = idaapi.get_widget_type(form)

        if form_type == idaapi.BWN_DISASM or form_type == idaapi.BWN_DUMP:
            t0, t1, view = idaapi.twinpos_t(), idaapi.twinpos_t(), idaapi.get_current_viewer()
            if idaapi.read_selection(view, t0, t1) or idc.get_item_size(idc.get_screen_ea()) > 1:
                idaapi.attach_action_to_popup(form, popup, ACTION_XORDATA, None)
                idaapi.attach_action_to_popup(form, popup, ACTION_FILLNOP, None)
                for action in ACTION_CONVERT:
                    idaapi.attach_action_to_popup(form, popup, action, "Convert/")

        if form_type == idaapi.BWN_DISASM and (ARCH, BITS) in [(idaapi.PLFM_386, 32),
                                                               (idaapi.PLFM_386, 64),
                                                               (idaapi.PLFM_ARM, 32),]:
            idaapi.attach_action_to_popup(form, popup, ACTION_SCANVUL, None) 
开发者ID:L4ys,项目名称:LazyIDA,代码行数:17,代码来源:LazyIDA.py

示例3: selection

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import read_selection [as 别名]
def selection(cls):
        '''Return the current address range of whatever is selected'''
        view = idaapi.get_current_viewer()
        left, right = idaapi.twinpos_t(), idaapi.twinpos_t()
        ok = idaapi.read_selection(view, left, right)
        if not ok:
            raise internal.exceptions.DisassemblerError(u"{:s}.selection() : Unable to read the current selection.".format('.'.join((__name__, cls.__name__))))
        pl_l, pl_r = left.place(view), right.place(view)
        ea_l, ea_r = internal.interface.address.inside(pl_l.ea, pl_r.ea)
        return internal.interface.bounds_t(ea_l, ea_r) 
开发者ID:arizvisa,项目名称:ida-minsc,代码行数:12,代码来源:ui.py

示例4: getrange

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import read_selection [as 别名]
def getrange(args):
    """
    Determines a address range.

    @param  args:  the argument list passed to the caller

    @return: a pair of addresses

    args can contain one of the following:

    1) a tuple containing (first, last)
    2) an area_t, containing  (start_ea, end_ea)
    3) nothing
       * if the user made a selection ( using Alt-L ), that selection is returned
       * otherwise from the cursor line until endoffile
    4) one address: from address until the end of file
    5) two addresses: the range between those addresses

    The range is specified as (first,last)
    meaning all addresses satisfying  first <= addr < last

    """
    selection, selfirst, sellast = idaapi.read_selection()

    if isinstance(args, idaapi.area_t):
        return (args.start_ea, args.end_ea)
    if len(args) and type(args[0])==types.TupleType:
        return args[0]
    if len(args) and isinstance(args[0], idaapi.area_t):
        return (args[0].start_ea, args[0].end_ea)

    argfirst = args[0] if len(args)>0 and type(args[0])==types.IntType else None
    arglast  = args[1] if len(args)>1 and type(args[1])==types.IntType else None
    """
        afirst  alast    sel 
          None   None     0    ->  here, BADADDR
          None   None     1    ->    selection
          None    +       0    ->  here, BADADDR
          None    +       1    ->    selection
           +     None     0    ->  afirst, BADADDR
           +     None     1    ->  afirst, BADADDR
           +      +       0    ->  afirst, alast
           +      +       1    ->  afirst, alast
    """
    if argfirst is None:
        if selection:
            return (selfirst, sellast)
        else:
            return (idc.here(), BADADDR)
    if arglast is None:
        return (argfirst, BADADDR)
    else:
        return (argfirst, arglast) 
开发者ID:nlitsme,项目名称:idascripts,代码行数:55,代码来源:enumerators.py

示例5: main

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import read_selection [as 别名]
def main():
    is_selected, sel_start, sel_end = idaapi.read_selection()
    if not is_selected:
        logger.error('range must be selected')
        return -1

    sel_end = idc.NextHead(sel_end)

    buf = ida_bytes.get_bytes(sel_start, sel_end - sel_start)
    if buf is None:
        logger.error('failed to fetch instruction bytes')
        return -1

    f = idaapi.get_func(sel_start)
    if f != idaapi.get_func(sel_end):
        logger.error('range must be within a single function')
        return -1

    # find mappings from "$localN" to "custom_name"
    regvars = {}
    for i in range(0x1000):
        regvar = idaapi.find_regvar(f, sel_start, '$local%d' % (i))
        if regvar is None:
            continue
        regvars[regvar.canon] = regvar.user

        if len(regvars) >= f.regvarqty:
            break

    globals_ = {}
    for i, offset in netnode.Netnode('$ wasm.offsets').get('globals', {}).items():
        globals_['$global' + i] = ida_name.get_name(offset)

    frame = {}
    if f.frame != idc.BADADDR:
        names = set([])
        for i in range(idc.GetStrucSize(f.frame)):
            name = idc.GetMemberName(f.frame, i)
            if not name:
                continue
            if name in names:
                continue
            frame[i] = name
            names.add(name)

    emu = Emulator(buf)
    emu.run()
    print(emu.render(ctx={
        'regvars': regvars,
        'frame': frame,
        'globals': globals_,
    })) 
开发者ID:fireeye,项目名称:idawasm,代码行数:54,代码来源:wasm_emu.py


注:本文中的idaapi.read_selection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。