GeezerVison is showing github.com — Recognize PLT entries on x86 Linux · Vector35/binaryninja-api@a401883
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: api.pro +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,6 +29,7 @@ SOURCES += \ |
29 | 29 | tempfile.cpp \ |
30 | 30 | lowlevelil.cpp \ |
31 | 31 | type.cpp \ |
| 32 | + functionrecognizer.cpp \ |
32 | 33 | ../core/json/jsoncpp.cpp |
33 | 34 |
|
34 | 35 | HEADERS += binaryninjaapi.h |
|
Collapse file
Copy file name to clipboardExpand all lines: binaryninjaapi.h +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1260,4 +1260,16 @@ namespace BinaryNinja |
1260 | 1260 |
|
1261 | 1261 | void Finalize(); |
1262 | 1262 | }; |
| 1263 | + |
| 1264 | + class FunctionRecognizer |
| 1265 | + { |
| 1266 | + static bool RecognizeLowLevelILCallback(void* ctxt, BNBinaryView* data, BNFunction* func, BNLowLevelILFunction* il); |
| 1267 | + |
| 1268 | + public: |
| 1269 | + FunctionRecognizer(); |
| 1270 | + |
| 1271 | + static void RegisterGlobalRecognizer(FunctionRecognizer* recog); |
| 1272 | + |
| 1273 | + virtual bool RecognizeLowLevelIL(BinaryView* data, Function* func, LowLevelILFunction* il); |
| 1274 | + }; |
1263 | 1275 | } |
Collapse file
Copy file name to clipboard +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#include "binaryninjaapi.h" |
| 2 | + |
| 3 | +using namespace BinaryNinja; |
| 4 | + |
| 5 | + |
| 6 | +FunctionRecognizer::FunctionRecognizer() |
| 7 | +{ |
| 8 | +} |
| 9 | + |
| 10 | + |
| 11 | +bool FunctionRecognizer::RecognizeLowLevelILCallback(void* ctxt, BNBinaryView* data, BNFunction* func, BNLowLevelILFunction* il) |
| 12 | +{ |
| 13 | + FunctionRecognizer* recog = (FunctionRecognizer*)ctxt; |
| 14 | + Ref<BinaryView> dataObj = new BinaryView(BNNewViewReference(data)); |
| 15 | + Ref<Function> funcObj = new Function(BNNewFunctionReference(func)); |
| 16 | + Ref<LowLevelILFunction> ilObj = new LowLevelILFunction(BNNewLowLevelILFunctionReference(il)); |
| 17 | + return recog->RecognizeLowLevelIL(dataObj, funcObj, ilObj); |
| 18 | +} |
| 19 | + |
| 20 | + |
| 21 | +void FunctionRecognizer::RegisterGlobalRecognizer(FunctionRecognizer* recog) |
| 22 | +{ |
| 23 | + BNFunctionRecognizer reg; |
| 24 | + reg.context = recog; |
| 25 | + reg.recognizeLowLevelIL = RecognizeLowLevelILCallback; |
| 26 | + BNRegisterGlobalFunctionRecognizer(®); |
| 27 | +} |
| 28 | + |
| 29 | + |
| 30 | +bool FunctionRecognizer::RecognizeLowLevelIL(BinaryView*, Function*, LowLevelILFunction*) |
| 31 | +{ |
| 32 | + return false; |
| 33 | +} |