C++ API Reference
Maat's C++ documentation is automatically generated by Doxygen. The native C++ API is intended rather for developpers or advanced users that seek optimal performance. If you are relatively new to the framework, make yourself a favour and get started with our tutorials, they use the Python API.
Get started
#include "maat.hpp"
using namespace maat;
using namespace maat::loader;
using namespace maat::event;
// Create a symbolic engine for Linux X86-32bits
MaatEngine engine(Arch::Type::X86, env::OS::LINUX);
// Load a binary a offset 0x08001000 with a 20-chars symbolic command line argument
vector args{
CmdlineArg(engine.vars->new_symbolic_buffer("some_arg", 20))
};
engine.load("./some_binary", Format::ELF32, 0x08001000, args, "", {}, {});
// Get current eax value
engine.cpu.ctx().get(X86::EAX);
// Read 4 bytes at the top of the stack
engine.mem->read(engine.cpu.ctx().get(X86::ESP), 4)
// Set a callback displaying every memory read
Action show_mem_access(MaatEngine& engine)
{
cout << *(engine->info.mem_access);
return Action::CONTINUE;
}
engine.hooks.add(Event::MEM_R, When::BEFORE, EventCallback(show_mem_access))
// Take and restore snapshots
auto snap = engine.take_snapshot()
engine.restore_snapshot(snap)
// Run the binary
maat.run()