Files
BinaryHardening-cfgrip/loader/binary.hpp
T
x86byte 6c2dca78ab Function boundary detection: multi-pass prolog, tail-call, .pdata, data pointers
- Extended prolog patterns: MSVC x64 callee-saves, sub rsp >= 0x20, enter
- Tail-call detection: jmp to prolog candidates seeds new functions
- endbr64/endbr32 CET skipping at function starts
- PE .pdata exception table parsing for precise start/end boundaries
- Data-section function pointer scanning (vtables, callbacks)
- PLT stub detection with is_thunk tag
- end_address and is_thunk fields in Function struct and JSON output
- getDataRanges() and getRuntimeFunctions() in Binary interface
- README docs for all new features + research paper reference
2026-06-30 10:04:56 +01:00

48 lines
1.1 KiB
C++

#pragma once
#include "types.hpp"
enum class BinaryFormat
{
PE,
ELF,
UNKNOWN
};
enum class Arch
{
X86,
X64,
UNKNOWN
};
class Binary
{
public:
virtual ~Binary() = default;
virtual bool load(const string& path) = 0;
virtual BinaryFormat getFormat() const = 0;
virtual Arch getArch() const = 0;
virtual addr_t getEntryPoint() const = 0;
virtual addr_t getImageBase() const = 0;
virtual vector<uint8_t> readBytes(addr_t vaddr, size_t size) const = 0;
virtual vector<pair<addr_t, addr_t>> getExecutableRanges() const = 0;
virtual vector<pair<addr_t, addr_t>> getDataRanges() const
{
return {};
}
virtual vector<pair<addr_t, addr_t>> getRuntimeFunctions() const
{
return {};
}
virtual vector<pair<addr_t, string>> getExportedFunctions() const = 0;
virtual vector<ImportEntry> getImportedFunctions() const
{
return {};
}
virtual const string& getPath() const = 0;
static unique_ptr<Binary> create(const string& path);
};