當前位置: 首頁>>代碼示例>>Python>>正文


Python idc.get_screen_ea方法代碼示例

本文整理匯總了Python中idc.get_screen_ea方法的典型用法代碼示例。如果您正苦於以下問題:Python idc.get_screen_ea方法的具體用法?Python idc.get_screen_ea怎麽用?Python idc.get_screen_ea使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在idc的用法示例。


在下文中一共展示了idc.get_screen_ea方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def main():
    path = ida_kernwin.ask_file(False, "*", "file to load")
    if not path:
        return
        
    with open(path, "rb") as f:
        buf = tuple(f.read())
        
    if len(buf) == 0:
        print("empty file, cancelling")
        return
        
    size = idawilli.align(len(buf), 0x1000)
    print("size: 0x%x" % (len(buf)))
    print("aligned size: 0x%x" % (size))
        
    addr = ida_kernwin.ask_addr(idc.get_screen_ea(), "location to write")
    if not addr:
        return
        
    idawilli.dbg.patch_bytes(addr, buf)

    print("ok") 
開發者ID:williballenthin,項目名稱:idawilli,代碼行數:25,代碼來源:write_file.py

示例2: _onFuncButtonClicked

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def _onFuncButtonClicked(self):
        if not self.cc.PatternGenerator.graph.graph:
            print("WARNING: Unloaded CFG. Make sure to first \"Load the CFG\"")
            return

        ea = idaapi.get_screen_ea()
        if ea:
            func = idaapi.ida_funcs.get_func(ea)
            if func:
                if self.cc.PatternGenerator.rootNode is None:
                    print("[I] Adding root node as function entrypoint: %x", func.start_ea)
                    self.cc.PatternGenerator.setRootNode(func.start_ea)

                print("[I] Adding nodes to cover whole function")
                flowchart = idaapi.FlowChart(func)
                for bb in flowchart:
                    last_inst_addr = idc.prev_head(bb.end_ea)
                    self.cc.PatternGenerator.addTargetNode(last_inst_addr)

                self._render_if_real_time() 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:22,代碼來源:PatternGenerationWidget.py

示例3: function_graph_ir

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def function_graph_ir():
    # Get settings
    settings = GraphIRForm()
    ret = settings.Execute()
    if not ret:
        return

    func = ida_funcs.get_func(idc.get_screen_ea())
    func_addr = func.start_ea

    build_graph(
        func_addr,
        settings.cScope.value,
        simplify=settings.cOptions.value & OPTION_GRAPH_CODESIMPLIFY,
        dontmodstack=settings.cOptions.value & OPTION_GRAPH_DONTMODSTACK,
        loadint=settings.cOptions.value & OPTION_GRAPH_LOADMEMINT,
        verbose=False
    )
    return 
開發者ID:cea-sec,項目名稱:miasm,代碼行數:21,代碼來源:graph_ir.py

示例4: activate

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def activate(self, ctx):
        if self.action == ACTION_HX_REMOVERETTYPE:
            vdui = idaapi.get_widget_vdui(ctx.widget)
            self.remove_rettype(vdui)
            vdui.refresh_ctext()
        elif self.action == ACTION_HX_COPYEA:
            ea = idaapi.get_screen_ea()
            if ea != idaapi.BADADDR:
                copy_to_clip("0x%X" % ea)
                print("Address 0x%X has been copied to clipboard" % ea)
        elif self.action == ACTION_HX_COPYNAME:
            name = idaapi.get_highlight(idaapi.get_current_viewer())[0]
            if name:
                copy_to_clip(name)
                print("%s has been copied to clipboard" % name)
        elif self.action == ACTION_HX_GOTOCLIP:
            loc = parse_location(clip_text())
            print("Goto location 0x%x" % loc)
            idc.jumpto(loc)
        else:
            return 0

        return 1 
開發者ID:L4ys,項目名稱:LazyIDA,代碼行數:25,代碼來源:LazyIDA.py

示例5: search_function_with_wildcards

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def search_function_with_wildcards():
    addr_current = idc.get_screen_ea()
    addr_func = idaapi.get_func(addr_current)

    if not addr_func:
      logging.error('[VT Plugin] Current address doesn\'t belong to a function')
      ida_kernwin.warning('Point the cursor in an area beneath a function.')
    else:
      search_vt = vtgrep.VTGrepSearch(
          addr_start=addr_func.start_ea,
          addr_end=addr_func.end_ea
          )
      search_vt.search(True, False) 
開發者ID:VirusTotal,項目名稱:vt-ida-plugin,代碼行數:15,代碼來源:plugin_loader.py

示例6: main

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def main():
    va = idc.get_screen_ea()
    fva = get_function(va)
    print(('-' * 80))
    rule = create_yara_rule_for_function(fva)
    print(rule)

    '''
    if test_yara_rule(rule):
        print('success: validated the generated rule')
    else:
        print('error: failed to validate generated rule')
    ''' 
開發者ID:williballenthin,項目名稱:idawilli,代碼行數:15,代碼來源:yara_fn.py

示例7: _onSetRootNode

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def _onSetRootNode(self):
        try:
            self.cc.PatternGenerator.setRootNode(idc.get_screen_ea())
        except:
            self.cc.PatternGenerator.setRootNode(idc.ScreenEA())

        self._render_if_real_time() 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:9,代碼來源:PatternGenerationWidget.py

示例8: _onAddTargetNode

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def _onAddTargetNode(self):
        try:
            self.cc.PatternGenerator.addTargetNode(idc.get_screen_ea())
        except:
            self.cc.PatternGenerator.addTargetNode(idc.ScreenEA())

        self._render_if_real_time() 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:9,代碼來源:PatternGenerationWidget.py

示例9: setMatchType

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [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

示例10: _onRemoveTargetNode

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def _onRemoveTargetNode(self):
        try:
            self.cc.PatternGenerator.removeTargetNode(idc.get_screen_ea())
        except:
            self.cc.PatternGenerator.removeTargetNode(idc.ScreenEA())

        self._render_if_real_time() 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:9,代碼來源:PatternGenerationWidget.py

示例11: symbolic_exec

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [as 別名]
def symbolic_exec():
    from miasm.ir.symbexec import SymbolicExecutionEngine
    from miasm.core.bin_stream_ida import bin_stream_ida

    from utils import guess_machine

    start, end = idc.read_selection_start(), idc.read_selection_end()

    bs = bin_stream_ida()
    machine = guess_machine(addr=start)

    mdis = machine.dis_engine(bs)

    if start == idc.BADADDR and end == idc.BADADDR:
        start = idc.get_screen_ea()
        end = idc.next_head(start) # Get next instruction address

    mdis.dont_dis = [end]
    asmcfg = mdis.dis_multiblock(start)
    ira = machine.ira(loc_db=mdis.loc_db)
    ircfg = ira.new_ircfg_from_asmcfg(asmcfg)

    print("Run symbolic execution...")
    sb = SymbolicExecutionEngine(ira, machine.mn.regs.regs_init)
    sb.run_at(ircfg, start)
    modified = {}

    for dst, src in sb.modified(init_state=machine.mn.regs.regs_init):
        modified[dst] = src

    view = symbolicexec_t()
    all_views.append(view)
    if not view.Create(modified, machine, mdis.loc_db,
                       "Symbolic Execution - 0x%x to 0x%x"
                       % (start, idc.prev_head(end))):
        return

    view.Show()


# Support ida 6.9 and ida 7 
開發者ID:cea-sec,項目名稱:miasm,代碼行數:43,代碼來源:symbol_exec.py

示例12: finish_populating_widget_popup

# 需要導入模塊: import idc [as 別名]
# 或者: from idc import get_screen_ea [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


注:本文中的idc.get_screen_ea方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。