本文整理汇总了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")
示例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()
示例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
示例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
示例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)
示例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')
'''
示例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()
示例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()
示例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()
示例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()
示例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
示例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)