summaryrefslogtreecommitdiff
path: root/basedetection.cpp
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2024-04-11 10:40:09 -0400
committerBrandon Miller <bkmiller89@icloud.com>2024-04-25 10:56:18 -0400
commit465a8d5d7afd5a5648338009e0fb8dbe4f199347 (patch)
treef3ead9b2b65a291fd7a97b2ddbbda2f10a5462ac /basedetection.cpp
parent4b2b3d561b92a01f4d29b86d5510d39e4d1accf3 (diff)
Querying candidate base address reasons
Querying vector of reason information for a candidate base address using the new core API
Diffstat (limited to 'basedetection.cpp')
-rw-r--r--basedetection.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/basedetection.cpp b/basedetection.cpp
index 4389f1b7..e994ede5 100644
--- a/basedetection.cpp
+++ b/basedetection.cpp
@@ -21,7 +21,6 @@
#include "binaryninjaapi.h"
using namespace BinaryNinja;
-using namespace std;
BaseAddressDetection::BaseAddressDetection(Ref<BinaryView> bv)
@@ -65,13 +64,29 @@ bool BaseAddressDetection::IsAborted()
}
-std::set<std::pair<size_t, uint64_t>> BaseAddressDetection::GetScores(BaseAddressDetectionConfidence* confidence)
+std::set<std::pair<size_t, uint64_t>> BaseAddressDetection::GetScores(BNBaseAddressDetectionConfidence* confidence,
+ uint64_t *lastTestedBaseAddress)
{
std::set<std::pair<size_t, uint64_t>> result;
BNBaseAddressDetectionScore scores[10];
- size_t numCandidates = BNGetBaseAddressDetectionScores(m_object, scores, 10,
- (BNBaseAddressDetectionConfidence *)confidence);
+ size_t numCandidates = BNGetBaseAddressDetectionScores(m_object, scores, 10, confidence, lastTestedBaseAddress);
for (size_t i = 0; i < numCandidates; i++)
result.insert(std::make_pair(scores[i].Score, scores[i].BaseAddress));
return result;
}
+
+
+std::vector<BNBaseAddressDetectionReason> BaseAddressDetection::GetReasonsForBaseAddress(uint64_t baseAddress)
+{
+ std::vector<BNBaseAddressDetectionReason> result;
+ size_t count;
+ BNBaseAddressDetectionReason *reasons = BNGetBaseAddressDetectionReasons(m_object, baseAddress, &count);
+ if (!reasons)
+ return result;
+
+ for (size_t i = 0; i < count; i++)
+ result.push_back(reasons[i]);
+
+ free(reasons);
+ return result;
+}