summaryrefslogtreecommitdiff
path: root/plugins/warp/api/warpcore.h
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-01-31 12:59:42 -0500
committerMason Reed <mason@vector35.com>2025-07-02 01:58:31 -0400
commit110c06851bbbd09f78a3e87979d529d6e09df851 (patch)
tree7849015b26a14cd2b7be2d87fc1e0d5c101ef457 /plugins/warp/api/warpcore.h
parent7b1e8bbdb971aed21b6d889aa4a46f9ef54829c1 (diff)
WARP 1.0
- Added FFI - Added a sidebar to the UI - Added project, directory and archive processing - Added generic `Container` interface for extensible stores of WARP data - Fixed type references being constructed and pulled incorrectly - Added HTML, Markdown and JSON report generation - Made the WARP information added as an analysis activity - Flattened the signatures directory, the target information is stored in the file now - Matched function information is stored as function metadata in the database to reliably persist, alongside the function GUID - Split the matching out from the application, allowing you to match on a given function without applying it - Added more/better tests - Added support for binaries with multiple architectures, the functions are now also queried based off the Target, see WARP spec for more details - Greatly improved support for RISC architectures, see WARP spec for more details - Greatly improved UX when loading files after the fact, will now sanely rerun the matcher - Omitted the function type if not a user type, this greatly reduces file size - Improved support for functions that reference a page aligned base pointer, see WARP spec for more details - Removed some extra cache structures that were causing erroneous behavior - Fixed edge-case in LLIL traversal missing some constant pointers, this was a bug in the Rust bindings - Added support for function comments - Made long running tasks, such as generating, matching and loading signatures, cancellable where possible - Made function constraints more versatile, allowing for easy extensions in the future, see WARP spec for details - Added options to signature generation, such as what data to store, and whether to compress the data or not - Made all long running tasks prompt the user for required information before the task starts, allowing users to "set it and forget it" and not have to baby sit the finalization of the task - Myriad of other changes to the actual WARP format that impact performance, file size and general feature set, see https://github.com/Vector35/warp for more details
Diffstat (limited to 'plugins/warp/api/warpcore.h')
-rw-r--r--plugins/warp/api/warpcore.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/plugins/warp/api/warpcore.h b/plugins/warp/api/warpcore.h
new file mode 100644
index 00000000..d12c6b98
--- /dev/null
+++ b/plugins/warp/api/warpcore.h
@@ -0,0 +1,143 @@
+#pragma once
+
+#ifndef BN_TYPE_PARSER
+#ifdef __cplusplus
+#include <cstdint>
+#include <cstddef>
+#include <cstdlib>
+#else
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <stdlib.h>
+#endif
+#endif
+
+#ifdef __GNUC__
+ #ifdef WARP_LIBRARY
+ #define WARP_FFI_API __attribute__((visibility("default")))
+ #else // WARP_LIBRARY
+ #define WARP_FFI_API
+ #endif // WARP_LIBRARY
+#else // __GNUC__
+ #ifdef _MSC_VER
+ #ifndef DEMO_VERSION
+ #ifdef WARP_LIBRARY
+ #define WARP_FFI_API __declspec(dllexport)
+ #else // WARP_LIBRARY
+ #define WARP_FFI_API __declspec(dllimport)
+ #endif // WARP_LIBRARY
+ #else
+ #define WARP_FFI_API
+ #endif
+ #else // _MSC_VER
+ #define WARP_FFI_API
+ #endif // _MSC_VER
+#endif // __GNUC__C
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct BNArchitecture BNArchitecture;
+ typedef struct BNBinaryView BNBinaryView;
+ typedef struct BNPlatform BNPlatform;
+ typedef struct BNBasicBlock BNBasicBlock;
+ typedef struct BNLowLevelILFunction BNLowLevelILFunction;
+ typedef struct BNFunction BNFunction;
+ typedef struct BNSymbol BNSymbol;
+ typedef struct BNType BNType;
+
+ struct BNWARPUUID
+ {
+ uint8_t uuid[16];
+ };
+
+ struct BNWARPFunctionComment
+ {
+ char* text;
+ int64_t offset;
+ };
+
+ char* BNWARPUUIDGetString(const BNWARPUUID* uuid);
+ bool BNWARPUUIDEqual(const BNWARPUUID* a, const BNWARPUUID* b);
+ void BNWARPFreeUUIDList(BNWARPUUID* uuids, size_t count);
+
+ typedef BNWARPUUID BNWARPSource;
+ typedef BNWARPUUID BNWARPBasicBlockGUID;
+ typedef BNWARPUUID BNWARPConstraintGUID;
+ typedef BNWARPUUID BNWARPFunctionGUID;
+ typedef BNWARPUUID BNWARPTypeGUID;
+
+ typedef struct BNWARPTarget BNWARPTarget;
+ typedef struct BNWARPContainer BNWARPContainer;
+ typedef struct BNWARPFunction BNWARPFunction;
+ typedef struct BNWARPConstraint BNWARPConstraint;
+
+ struct BNWARPConstraint
+ {
+ BNWARPConstraintGUID guid;
+ int64_t offset;
+ };
+
+ WARP_FFI_API void BNWARPRunMatcher(BNBinaryView* view);
+
+ WARP_FFI_API bool BNWARPGetBasicBlockGUID(BNBasicBlock* basicBlock, BNWARPBasicBlockGUID* result);
+ WARP_FFI_API bool BNWARPGetAnalysisFunctionGUID(BNFunction* analysisFunction, BNWARPFunctionGUID* result);
+ WARP_FFI_API bool BNWARPIsLiftedInstructionVariant(BNLowLevelILFunction* liftedFunction, size_t idx);
+ WARP_FFI_API bool BNWARPIsLiftedInstructionBlacklisted(BNLowLevelILFunction* liftedFunction, size_t idx);
+
+ WARP_FFI_API BNWARPFunction* BNWARPGetFunction(BNFunction* analysisFunction);
+ WARP_FFI_API BNWARPFunction* BNWARPGetMatchedFunction(BNFunction* analysisFunction);
+ WARP_FFI_API BNWARPContainer** BNWARPGetContainers(size_t* count);
+
+ WARP_FFI_API char* BNWARPContainerGetName(BNWARPContainer* container);
+
+ WARP_FFI_API BNWARPSource* BNWARPContainerGetSources(BNWARPContainer* container, size_t* count);
+ WARP_FFI_API bool BNWARPContainerAddSource(BNWARPContainer* container, const char* sourcePath, BNWARPSource* result);
+ WARP_FFI_API bool BNWARPContainerCommitSource(BNWARPContainer* container, const BNWARPSource* source);
+ WARP_FFI_API bool BNWARPContainerIsSourceUncommitted(BNWARPContainer* container, const BNWARPSource* source);
+ WARP_FFI_API bool BNWARPContainerIsSourceWritable(BNWARPContainer* container, const BNWARPSource* source);
+ WARP_FFI_API char* BNWARPContainerGetSourcePath(BNWARPContainer* container, const BNWARPSource* source);
+
+ WARP_FFI_API bool BNWARPContainerAddFunctions(BNWARPContainer* container, const BNWARPTarget* target, const BNWARPSource* source, BNWARPFunction** functions, size_t count);
+ WARP_FFI_API bool BNWARPContainerAddTypes(BNBinaryView* view, BNWARPContainer* container, const BNWARPSource* source, BNType** types, size_t count);
+
+ WARP_FFI_API bool BNWARPContainerRemoveFunctions(BNWARPContainer* container, const BNWARPTarget* target, const BNWARPSource* source, BNWARPFunction** functions, size_t count);
+ WARP_FFI_API bool BNWARPContainerRemoveTypes(BNWARPContainer* container, const BNWARPSource* source, BNWARPTypeGUID* types, size_t count);
+
+ WARP_FFI_API BNWARPSource* BNWARPContainerGetSourcesWithFunctionGUID(BNWARPContainer* container, const BNWARPTarget* target, const BNWARPFunctionGUID* guid, size_t* count);
+ WARP_FFI_API BNWARPSource* BNWARPContainerGetSourcesWithTypeGUID(BNWARPContainer* container, const BNWARPTypeGUID* guid, size_t* count);
+ WARP_FFI_API BNWARPFunction** BNWARPContainerGetFunctionsWithGUID(BNWARPContainer* container, const BNWARPTarget* target, const BNWARPSource* source, const BNWARPFunctionGUID* guid, size_t* count);
+ WARP_FFI_API BNType* BNWARPContainerGetTypeWithGUID(BNArchitecture* arch, BNWARPContainer* container, const BNWARPSource* source, const BNWARPTypeGUID* guid);
+ WARP_FFI_API BNWARPTypeGUID* BNWARPContainerGetTypeGUIDsWithName(BNWARPContainer* container, const BNWARPSource* source, const char* name, size_t* count);
+
+ WARP_FFI_API BNWARPContainer* BNWARPNewContainerReference(BNWARPContainer* container);
+ WARP_FFI_API void BNWARPFreeContainerReference(BNWARPContainer* container);
+ WARP_FFI_API void BNWARPFreeContainerList(BNWARPContainer** containers, size_t count);
+
+ WARP_FFI_API void BNWARPFunctionApply(BNWARPFunction* function, BNFunction* analysisFunction);
+ WARP_FFI_API BNWARPFunctionGUID BNWARPFunctionGetGUID(BNWARPFunction* function);
+ WARP_FFI_API BNSymbol* BNWARPFunctionGetSymbol(BNWARPFunction* function, BNFunction* analysisFunction);
+ WARP_FFI_API char* BNWARPFunctionGetSymbolName(BNWARPFunction* function);
+ WARP_FFI_API BNType* BNWARPFunctionGetType(BNWARPFunction* function, BNFunction* analysisFunction);
+ WARP_FFI_API BNWARPConstraint* BNWARPFunctionGetConstraints(BNWARPFunction* function, size_t* count);
+ WARP_FFI_API BNWARPFunctionComment* BNWARPFunctionGetComments(BNWARPFunction* function, size_t* count);
+ WARP_FFI_API bool BNWARPFunctionsEqual(BNWARPFunction* functionA, BNWARPFunction* functionB);
+
+ WARP_FFI_API void BNWARPFreeFunctionCommentList(BNWARPFunctionComment* comments, size_t count);
+ WARP_FFI_API void BNWARPFreeConstraintList(BNWARPConstraint* constraints, size_t count);
+
+ WARP_FFI_API BNWARPFunction* BNWARPNewFunctionReference(BNWARPFunction* function);
+ WARP_FFI_API void BNWARPFreeFunctionReference(BNWARPFunction* function);
+ WARP_FFI_API void BNWARPFreeFunctionList(BNWARPFunction** functions, size_t count);
+
+ WARP_FFI_API BNWARPTarget* BNWARPGetTarget(BNPlatform* platform);
+
+ WARP_FFI_API BNWARPTarget* BNWARPNewTargetReference(BNWARPTarget* target);
+ WARP_FFI_API void BNWARPFreeTargetReference(BNWARPTarget* target);
+
+#ifdef __cplusplus
+}
+#endif