Fix formatting

This commit is contained in:
Maurice Heumann
2025-07-17 18:30:00 +02:00
parent 079d367792
commit 8caf724c95
3 changed files with 76 additions and 59 deletions

View File

@@ -289,38 +289,38 @@ namespace
return create_application_emulator(options, args);
}
bool run(const analysis_options& options, const std::span<const std::string_view> args)
{
analysis_context context{
.settings = &options,
};
const auto win_emu = setup_emulator(options, args);
win_emu->log.disable_output(options.concise_logging || options.silent);
context.win_emu = win_emu.get();
win_emu->log.log("Using emulator: %s\n", win_emu->emu().get_name().c_str());
// Enable TenetTracer and assign it to the context.
std::unique_ptr<TenetTracer> tenet_tracer;
if (options.tenet_trace)
bool run(const analysis_options& options, const std::span<const std::string_view> args)
{
win_emu->log.log("Tenet Tracer enabled. Output: tenet_trace.log\n");
tenet_tracer = std::make_unique<TenetTracer>(*win_emu, "tenet_trace.log");
analysis_context context{
.settings = &options,
};
// Set up the hook to call the tracer for each instruction.
win_emu->emu().hook_memory_execution([&](uint64_t address) {
if (tenet_tracer)
{
tenet_tracer->process_instruction(address);
}
});
}
const auto win_emu = setup_emulator(options, args);
win_emu->log.disable_output(options.concise_logging || options.silent);
context.win_emu = win_emu.get();
register_analysis_callbacks(context);
watch_system_objects(*win_emu, options.modules, options.verbose_logging);
win_emu->log.log("Using emulator: %s\n", win_emu->emu().get_name().c_str());
const auto& exe = *win_emu->mod_manager.executable;
// Enable TenetTracer and assign it to the context.
std::unique_ptr<TenetTracer> tenet_tracer;
if (options.tenet_trace)
{
win_emu->log.log("Tenet Tracer enabled. Output: tenet_trace.log\n");
tenet_tracer = std::make_unique<TenetTracer>(*win_emu, "tenet_trace.log");
// Set up the hook to call the tracer for each instruction.
win_emu->emu().hook_memory_execution([&](uint64_t address) {
if (tenet_tracer)
{
tenet_tracer->process_instruction(address);
}
});
}
register_analysis_callbacks(context);
watch_system_objects(*win_emu, options.modules, options.verbose_logging);
const auto& exe = *win_emu->mod_manager.executable;
const auto concise_logging = !options.verbose_logging;
@@ -434,7 +434,6 @@ bool run(const analysis_options& options, const std::span<const std::string_view
printf(" analyzer -v -e path/to/root myapp.exe\n");
printf(" analyzer -e path/to/root -p c:/analysis-sample.exe /path/to/sample.exe c:/analysis-sample.exe\n");
}
analysis_options parse_options(std::vector<std::string_view>& args)
{