本文整理汇总了Python中idaapi.Form方法的典型用法代码示例。如果您正苦于以下问题:Python idaapi.Form方法的具体用法?Python idaapi.Form怎么用?Python idaapi.Form使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idaapi
的用法示例。
在下文中一共展示了idaapi.Form方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import Form [as 别名]
def __init__(self):
"""Create the starting configuration form."""
# dialog content
dialog_content = """%s
Please insert the path to configuration directory that holds the *.json files
to match against the current binary.
<#Select a *.json configs directory for %s exported libraries #Configs Directory :{_config_path}>
<#Enable this option for binaries compiled for Windows #Is Windows binary :{_is_windows}>{_check_group}>
""" % (LIBRARY_NAME, LIBRARY_NAME)
# argument parsing
args = {
'_config_path': idaapi.Form.DirInput(swidth=65),
'_check_group': idaapi.Form.ChkGroupControl(("_is_windows",)),
}
idaapi.Form.__init__(self, dialog_content, args)
示例2: __init__
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import Form [as 别名]
def __init__(self, expr):
"@expr: Expr instance"
# Init
self.languages = list(Translator.available_languages())
self.expr = expr
# Initial translation
text = Translator.to_language(self.languages[0]).from_expr(self.expr)
# Create the Form
idaapi.Form.__init__(self, r"""STARTITEM 0
Python Expression
{FormChangeCb}
<Language:{cbLanguage}>
<Translation:{result}>
""", {
'result': idaapi.Form.MultiLineTextControl(text=text,
flags=translatorForm.flags),
'cbLanguage': idaapi.Form.DropdownListControl(
items=self.languages,
readonly=True,
selval=0),
'FormChangeCb': idaapi.Form.FormChangeCb(self.OnFormChange),
})
示例3: __init__
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import Form [as 别名]
def __init__(self, ioctl, driver):
idaapi.Form.__init__(
self,
"""Send IOCTL
{form_change}
<#Input Buffer#~I~nput Buffer:{in_buf}>
<#Input Buffer Size#~I~nput Buffer Size:{in_size}>
<#Output Buffer#~O~utput Buffer:{out_buf}>
<#Output Buffer Size#~O~utput Buffer Size:{out_size}>
<#Send IOCTL#~S~end IOCTL:{sendIOCTL}>
""", {
"form_change": idaapi.Form.FormChangeCb(self.form_change),
"in_buf": idaapi.Form.MultiLineTextControl(),
"out_buf": idaapi.Form.MultiLineTextControl(),
"in_size": idaapi.Form.NumericInput(),
"out_size": idaapi.Form.NumericInput(),
"sendIOCTL": idaapi.Form.ButtonInput(self.send_ioctl)
}
)
self.driver = driver
global ioctl_tracker
for inst in ioctl_tracker.ioctl_locs:
value = get_operand_value(inst)
function = ioctl_decoder.get_function(value)
if function == int(ioctl[1],16):
self.ioctl = value
self.Compile()
self.in_size.value = 0x20
self.out_size.value = 0x20
self.in_buf.value = "\\x41" * 0x20
self.Execute()
示例4: __init__
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import Form [as 别名]
def __init__( self, title, chooser ):
self.chooser = chooser
template_instance = PLUGIN_CHOOSER_FORM_TEMPLATE % title
Form.__init__(self, template_instance, {
'Chooser' : Form.EmbeddedChooserControl(chooser)
})
# ------------------------------------------------------------------------------
示例5: prompt_for_segment
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import Form [as 别名]
def prompt_for_segment():
''' :returns: a Segment instance, or raises BadInputError '''
class MyForm(idaapi.Form):
def __init__(self):
idaapi.Form.__init__(self, """STARTITEM 0
add segment by buffer
<##buffer path:{path}>
<##segment name:{name}>
<##segment start address:{addr}>
""",
{
'path': idaapi.Form.FileInput(open=True),
'name': idaapi.Form.StringInput(),
'addr': idaapi.Form.NumericInput(tp=Form.FT_ADDR),
})
def OnFormChange(self, fid):
return 1
f = MyForm()
f.Compile()
f.path.value = ""
f.name.value = ""
f.addr.value = 0x0
ok = f.Execute()
if ok != 1:
raise BadInputError('user cancelled')
path = f.path.value
if path == "" or path is None:
raise BadInputError('bad path provided')
if not os.path.exists(path):
raise BadInputError('file doesn\'t exist')
name = f.name.value
if name == "" or name is None:
raise BadInputError('bad name provided')
addr = f.addr.value
f.Free()
return Segment(path, name, addr)
示例6: kernelcache_find_virtual_method_overrides
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import Form [as 别名]
def kernelcache_find_virtual_method_overrides(classname=None, method=None):
import idc
import idaapi
import ida_kernelcache as kc
# Define the form to ask for the arguments.
class MyForm(idaapi.Form):
def __init__(self):
swidth = 40
idaapi.Form.__init__(self, r"""STARTITEM 0
Find virtual method overrides
<#The class#Class :{classname}>
<#The virtual method#Method:{method}>""", {
'classname': idaapi.Form.StringInput(tp=idaapi.Form.FT_IDENT, swidth=swidth),
'method': idaapi.Form.StringInput(tp=idaapi.Form.FT_IDENT, swidth=swidth),
})
def OnFormChange(self, fid):
return 1
kc.collect_class_info()
if any(arg is None for arg in (classname, method)):
f = MyForm()
f.Compile()
f.classname.value = classname or ''
f.method.value = method or ''
ok = f.Execute()
if ok != 1:
print 'Cancelled'
return False
classname = f.classname.value
method = f.method.value
f.Free()
if classname not in kc.class_info:
print 'Not a valid class: {}'.format(classname)
return False
print 'Subclasses of {} that override {}:'.format(classname, method)
baseinfo = kc.class_info[classname]
found = False
for classinfo in baseinfo.descendants():
for _, override, _ in kc.vtable.class_vtable_overrides(classinfo, superinfo=baseinfo,
methods=True):
name = idc.NameEx(idc.BADADDR, override)
demangled = idc.Demangle(name, idc.GetLongPrm(idc.INF_SHORT_DN))
name = demangled if demangled else name
if method in name:
print '{:#x} {}'.format(override, classinfo.classname)
found = True
if not found:
print 'No subclass of {} overrides {}'.format(classname, method)
return found