File tree Expand file tree Collapse file tree 9 files changed +135
-0
lines changed
plugins/plugin-manager/examples/native-ida-plugin Expand file tree Collapse file tree 9 files changed +135
-0
lines changed Original file line number Diff line number Diff line change 1+ [submodule "plugins/plugin-manager/examples/native-ida-plugin/src/deps/zig-cross "]
2+ path = plugins/plugin-manager/examples/native-ida-plugin/src/deps/zig-cross
3+ url = git@github.com:mrexodia/zig-cross.git
Original file line number Diff line number Diff line change 1+ build- * /
2+ dist /
3+ build /
Original file line number Diff line number Diff line change 1+ # native-ida-plugin
2+
3+ ## Build
4+
5+ Have the following installed:
6+ - cmake
7+ - zig
8+ - just
9+ - python, with package ` build `
10+
11+ ```
12+ $ export IDASDK=~/.idapro/sdk/idasdk91/
13+ $ just build
14+ ```
15+
16+ Then find the output file in ` dist/native_ida_plugin-0.1.0-py3-none-any.whl ` .
Original file line number Diff line number Diff line change 1+ mysample.so
2+ mysample.dll
3+ mysample_x86_64.dylib
4+ mysample_aarch64.dylib
Original file line number Diff line number Diff line change 1+ _ build target :
2+ cmake -B " build-{{ target}} " -DCMAKE_TOOLCHAIN_FILE=" deps/zig-cross/{{ target}} .cmake" -S src/ -Wno-dev
3+ rm -f $IDASDK/ bin/ plugins/ mysample.*
4+ cmake --build " build-{{ target}} " --target all
5+ mv -f $IDASDK/ bin/ plugins/ mysample.* " build-{{ target}} /"
6+
7+ build-linux-x86_64 : (_build " x86_64-linux-gnu" )
8+ build-macos-x86_64 : (_build " x86_64-macos-none" )
9+ build-macos-aarch64 : (_build " aarch64-macos-none" )
10+ build-windows-x86_64 : (_build " x86_64-windows-gnu" )
11+
12+ build-wheel :
13+ cp build-x86 _64 -linux-gnu/ mysample.so bin/ native_ida_plugin/ mysample.so
14+ cp build-x86 _64 -macos-none/ mysample.dylib bin/ native_ida_plugin/ mysample_x86 _64. dylib
15+ cp build-aarch64 -macos-none/ mysample.dylib bin/ native_ida_plugin/ mysample_aarch64. dylib
16+ cp build-x86 _64 -windows-gnu/ mysample.dll bin/ native_ida_plugin/ mysample.dll
17+ python -m build --wheel
18+
19+ build : build-linux-x86_64 build-macos-x86_64 build-macos-aarch64 build-windows-x86_64 build-wheel
20+
21+ clean -wheel:
22+ rm -rf bin/ native_ida_plugin/ * build/ dist/
23+
24+ _ clean target :
25+ - cmake --build " build-{{ target}} " --target clean
26+ rm -rf " build-{{ target}} "
27+
28+ clean -linux-x86 _64 : (_clean " x86_64-linux-gnu" )
29+ clean -macos-x86 _64 : (_clean " x86_64-macos-none" )
30+ clean -macos-aarch64 : (_clean " aarch64-macos-none" )
31+ clean -windows-x86 _64 : (_clean " x86_64-windows-gnu" )
32+
33+ clean : clean -linux-x86 _64 clean -macos-x86 _64 clean -macos-aarch64 clean -windows-x86 _64 clean -wheel
Original file line number Diff line number Diff line change 1+ [project ]
2+ name = " williballenthin-native-ida-plugin"
3+ authors = [
4+ {name = " Willi Ballenthin" , email = " wballenthin@google.com" },
5+ ]
6+ description = " Example IDA Plugin (native)"
7+ version = " 0.1.0"
8+ readme = " README.md"
9+ license = " Apache-2.0"
10+ requires-python = " >=3.9"
11+ dependencies = []
12+
13+ [project .entry-points .'idapro .plugins' ]
14+ aarch64-apple-darwin = " native_ida_plugin:mysample_aarch64"
15+ x86_64-apple-darwin = " native_ida_plugin:mysample_x86_64"
16+ x86_64-unknown-linux = " native_ida_plugin:mysample"
17+ x86_64-pc-windows = " native_ida_plugin:mysample"
18+
19+ [build-system ]
20+ requires = [" setuptools>=61.0" ]
21+ build-backend = " setuptools.build_meta"
22+
23+ [tool .setuptools ]
24+ package-dir = {"" = " bin" } # Python package data is found in "bin/" directory.
25+ # "src/" is the default, but we'll use "bin/" for all this binary data.
26+
27+ [tool .setuptools .package-data ]
28+ "native_ida_plugin" = [
29+ # filenames relative to: bin/native_ida_plugin/
30+ " mysample.dll" ,
31+ " mysample.so" ,
32+ " mysample_aarch64.dylib" ,
33+ " mysample_x86_64.dylib" ,
34+ ]
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.27 FATAL_ERROR)
2+
3+ project (mysample)
4+
5+ set (CMAKE_CXX_STANDARD 17)
6+
7+ include ($ENV{IDASDK} /ida-cmake/idasdk.cmake)
8+
9+ set (PLUGIN_NAME mysample)
10+ set (PLUGIN_SOURCES mysample.cpp)
11+
12+ generate()
13+ disable_ida_warnings(mysample)
Original file line number Diff line number Diff line change 1+ #include < ida.hpp>
2+ #include < idp.hpp>
3+ #include < loader.hpp>
4+ #include < kernwin.hpp>
5+
6+ // --------------------------------------------------------------------------
7+ struct plugin_ctx_t : public plugmod_t
8+ {
9+ bool idaapi run (size_t ) override
10+ {
11+ msg (" Hello from native!\n " );
12+ return true ;
13+ }
14+ };
15+
16+ // --------------------------------------------------------------------------
17+ plugin_t PLUGIN =
18+ {
19+ IDP_INTERFACE_VERSION,
20+ PLUGIN_UNL | PLUGIN_MULTI,
21+ []()->plugmod_t * {return new plugin_ctx_t ; }, // initialize
22+ nullptr ,
23+ nullptr ,
24+ " This is an example native plugin (comment)" , // long comment about the plugin
25+ " This is an example native plugin" , // multiline help about the plugin
26+ " Example native plugin" , // the preferred short name of the plugin
27+ nullptr , // the preferred hotkey to run the plugin
28+ };
You can’t perform that action at this time.
0 commit comments