能力值:
( LV4,RANK:50 )
|
-
-
2 楼
问题已解决,imports窗口的条目存储是用netnode处理,参考enum_import_names函数实现写了个py脚本:
# -----------------------------------------------------------------------
# 删除imports窗口中无效条目
# Code by Steve on 2011/08/29
#
Imports=idaapi.netnode("$ imports")
iCount=0
iIndex=0
print "import modules:%d" % (Imports.altval(idaapi.BADNODE,idaapi.atag),)
if idaapi.BADNODE!=Imports:
idx=Imports.alt1st()
while idx!=idaapi.BADNODE:
netnum=Imports.altval(idx,idaapi.atag)
module=idaapi.netnode(netnum)
nums=module.altval(idaapi.BADNODE,idaapi.atag)
if nums==0:
nums=module.altval(idaapi.BADNODE,0x4f)
if nums==0:
nums=module.altval(idaapi.BADNODE,idaapi.stag)
#print "%x %s(%d Counts)" % (netnum,idaapi.get_import_module_name(iIndex),nums)
print "%x %s(%d Counts)" % (netnum,Imports.supstr(iIndex,idaapi.stag),nums)
if idaapi.BADNODE!=module:
mod_idx=module.sup1st()
while idaapi.BADNODE!=mod_idx:
szName=Name(mod_idx)
if not szName:
szName="del"
module.supdel(mod_idx)
print " %2d %x ->%s"% (iCount,mod_idx,szName)
iCount=iCount+1
mod_idx=module.supnxt(mod_idx)
mod_idx=module.alt1st()
while idaapi.BADNODE!=mod_idx:
ea=module.altval(mod_idx)
szName=Name(ea)
if not szName:
szName="del"
module.altdel(mod_idx)
print " %2d ea:%x %s"% (iCount,ea,szName)
iCount=iCount+1
mod_idx=module.altnxt(mod_idx)
mod_idx=module.sup1st(0x4f)
while idaapi.BADNODE!=mod_idx:
szName=Name(mod_idx)
if not szName:
szName="del"
module.supdel(mod_idx,0x4f)
print " %2d %x ->%s"% (iCount,mod_idx,szName)
iCount=iCount+1
mod_idx=module.supnxt(mod_idx,0x4f)
iIndex=iIndex+1
idx=Imports.altnxt(idx)
|
|
|