IDA python列表通过命令行脚本

时间:2015-11-13 13:45:30

标签: python

我编写了一个IDAPython脚本,它通过IDA Pro GUI执行并列出DLL中的函数。但是,通过命令提示符执行时相同的脚本不会列出DLL中存在的函数。 以下是代码:

from idautils import *
from idaapi import *
import idc
ea = BeginEA()
dll_functions=[]
fp=open(r"C:\Users\xxx\Documents\check\fun_output.txt","w")
fp.write("check")
for funcea in Functions(SegStart(ea), SegEnd(ea)):
    functionName = GetFunctionName(funcea)
    dll_functions.append(functionName)
    fp.write(functionName)
    print(functionName)
idc.Exit(0)

当通过cmd提示符执行时,它不会列出函数:

idaq -A -S"C:\Users\XXX\Documents\script\ida_total_fun.py" "C:\Users\xxx\Documents\output\sample.dll"

1 个答案:

答案 0 :(得分:1)

AFAIK,该脚本需要打开IDA DB才能获得所需的内容。 根据IDA的帮助:

 -S###  Execute a script file when the database is opened.

您可以尝试而不是发送url dll,只需发送IDB文件路径或尝试使用选项-c创建数据库。

 -c     disassemble a new file (delete the old database)

您还可以在此处http://www.hexblog.com/?p=128查看有关该主题的非常好的条目

IDA的帮助, https://www.hex-rays.com/products/ida/support/idadoc/417.shtml

相关问题