写ida脚本也有一段时间了,一直有个痛点是找不到比较好的方法热重载脚本来实时改动生效,导致开发效率老慢了。固总结下比较友好的环境搭配
mac or linux 环境
windows 环境
选择cpp插件的原因肯定是性能了,毕竟开发起来麻烦,但是c++默认比py快20倍,在某些场景很难不用吧,比如一个混淆代码的块有上千个,测试用python的d810跑这种大型函数+单规则处理,耗时5分多钟,电脑cpu i9了
ida-win 7.7下载: https://bbs.kanxue.com/thread-276531.htm
/
/
1.
下载 ida
-
cmake
cd
/
path
/
to
/
ida
/
idasdk
/
plugins && git clone https:
/
/
github.com
/
0xeb
/
ida
-
cmake
/
/
2.
下载 ida
-
qscripts
cd
/
path
/
to
/
ida
/
idasdk
/
plugins && git clone https:
/
/
github.com
/
0xeb
/
ida
-
qscripts
/
/
3.
下载idax
cd
/
path
/
to
/
ida
/
idasdk
/
plugins
/
ida
-
qscripts &&
git clone https:
/
/
github.com
/
0xeb
/
idax
/
/
1.
下载 ida
-
cmake
cd
/
path
/
to
/
ida
/
idasdk
/
plugins && git clone https:
/
/
github.com
/
0xeb
/
ida
-
cmake
/
/
2.
下载 ida
-
qscripts
cd
/
path
/
to
/
ida
/
idasdk
/
plugins && git clone https:
/
/
github.com
/
0xeb
/
ida
-
qscripts
/
/
3.
下载idax
cd
/
path
/
to
/
ida
/
idasdk
/
plugins
/
ida
-
qscripts &&
git clone https:
/
/
github.com
/
0xeb
/
idax
/
/
1.
环境变量添加 IDASDK
/
/
mac
or
linux
export IDASDK
=
/
path
/
to
/
ida
/
idasdk
/
/
2.clion
直接打开 ida
-
qscripts
/
/
3.clion
-
-
settings
-
-
build,execution,deployment 中 新增配置,并设置 cmake ida插件变量(
64
位的需要)
/
/
4.
将编译出来的 qscripts.dylib qscripts64.dylib
or
qscripts.so qscripts.so 手动复制到
/
path
/
to
/
ida
/
plugins 中,重启ida即生效
/
/
1.
环境变量添加 IDASDK
/
/
mac
or
linux
export IDASDK
=
/
path
/
to
/
ida
/
idasdk
/
/
2.clion
直接打开 ida
-
qscripts
/
/
3.clion
-
-
settings
-
-
build,execution,deployment 中 新增配置,并设置 cmake ida插件变量(
64
位的需要)
/
/
4.
将编译出来的 qscripts.dylib qscripts64.dylib
or
qscripts.so qscripts.so 手动复制到
/
path
/
to
/
ida
/
plugins 中,重启ida即生效
/
/
1.
设置环境变量
setx IDASDK
/
path
/
to
/
ida
/
idasdk
/
/
2.
使用visual studio打开,测试环境为vs2022,打开后在cmakefile中看情况设置
/
/
3.vs
点击 项目
-
-
> qscripts的 CMake设置,在下面设置才能编译
64
位的dll
/
/
1.
设置环境变量
setx IDASDK
/
path
/
to
/
ida
/
idasdk
/
/
2.
使用visual studio打开,测试环境为vs2022,打开后在cmakefile中看情况设置
/
/
3.vs
点击 项目
-
-
> qscripts的 CMake设置,在下面设置才能编译
64
位的dll
/
/
4.
将 qscripts.dll qscripts64.dll 复制到
/
path
/
to
/
ida
/
plugins
/
/
4.
将 qscripts.dll qscripts64.dll 复制到
/
path
/
to
/
ida
/
plugins
#include <ida.hpp>
#include <idp.hpp>
#include <loader.hpp>
#include <kernwin.hpp>
plugmod_t *idaapi init(
void
)
{
msg(
"Plugin initialized!\n"
);
return
PLUGIN_OK;
}
void
idaapi term(
void
)
{
msg(
"Plugin term()\n"
);
}
bool
idaapi run(
size_t
arg)
{
msg(
"Plugin run()\n"
);
return
true
;
}
plugin_t PLUGIN =
{
IDP_INTERFACE_VERSION,
PLUGIN_UNL,
init,
term,
run,
""
,
""
,
"Sample plugin"
,
""
};
#include <ida.hpp>
#include <idp.hpp>
#include <loader.hpp>
#include <kernwin.hpp>
plugmod_t *idaapi init(
void
)
{
msg(
"Plugin initialized!\n"
);
return
PLUGIN_OK;
}
void
idaapi term(
void
)
{
msg(
"Plugin term()\n"
);
}
bool
idaapi run(
size_t
arg)
{
msg(
"Plugin run()\n"
);
return
true
;
}
plugin_t PLUGIN =
{
IDP_INTERFACE_VERSION,
PLUGIN_UNL,
init,
term,
run,
""
,
""
,
"Sample plugin"
,
""
};
/
/
cmakefile 配置
cmake_minimum_required(VERSION
3.26
)
project(ByeObf)
set
(CMAKE_CXX_STANDARD
20
)
include_directories(
/
Applications
/
IDAPro
/
ida.app
/
Contents
/
MacOS
/
plugins
/
hexrays_sdk
/
include
/
)
include_directories(
/
Applications
/
IDAPro
/
ida.app
/
Contents
/
MacOS
/
idasdk_pro
/
include
/
)
set
(PLUGIN_NAME byeobf)
set
(PLUGIN_SOURCES library.h library.cpp)
set
(PLUGIN_OUTPUT_NAME ${PLUGIN_NAME})
set
(PLUGIN_RUN_ARGS
"-t"
)
include($ENV{IDASDK}
/
ida
-
cmake
/
addons.cmake)
/
/
cmakefile 配置
cmake_minimum_required(VERSION
3.26
)
project(ByeObf)
set
(CMAKE_CXX_STANDARD
20
)
include_directories(
/
Applications
/
IDAPro
/
ida.app
/
Contents
/
MacOS
/
plugins
/
hexrays_sdk
/
include
/
)
include_directories(
/
Applications
/
IDAPro
/
ida.app
/
Contents
/
MacOS
/
idasdk_pro
/
include
/
)
set
(PLUGIN_NAME byeobf)
set
(PLUGIN_SOURCES library.h library.cpp)
set
(PLUGIN_OUTPUT_NAME ${PLUGIN_NAME})
set
(PLUGIN_RUN_ARGS
"-t"
)
include($ENV{IDASDK}
/
ida
-
cmake
/
addons.cmake)
编译64位插件定义EA64即可
import
time
import
idaapi
time.sleep(
1
)
idaapi.load_and_run_plugin(
'byeobf'
,
0
)
import
time
import
idaapi
time.sleep(
1
)
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
最后于 2023-12-26 11:06
被初恒编辑
,原因: 1.修改clion 热重载的文件配置名,之前打错字了。2.验证了该插件在idacpp + clion开发的时候是可以热重载并且一直附加调试的,就是可以带着debug信息修改插件逻辑,而不是通过日志一直使劲猜,我没那么多头发可以掉。