diff --git a/page/src/components/settings-menu.tsx b/page/src/components/settings-menu.tsx index 07ae18be..e49f6be0 100644 --- a/page/src/components/settings-menu.tsx +++ b/page/src/components/settings-menu.tsx @@ -84,6 +84,17 @@ export class SettingsMenu extends React.Component { +
+ { + this.setState({ execAccess: checked }); + }} + /> + +
+
emu().read_instruction_pointer(); + if (!win_emu->mod_manager.executable->is_within(rip)) + { + return; + } + + if (concise_logging) + { + static uint64_t count{0}; + ++count; + if (count > 100 && count % 100000 != 0) + { + return; + } + } + + win_emu->log.print(color::green, + "Reading from executable section %s at 0x%" PRIx64 " via 0x%" PRIx64 "\n", + section.name.c_str(), address, rip); + }; + + const auto write_handler = [&, section, concise_logging](const uint64_t address, const void*, size_t) { + const auto rip = win_emu->emu().read_instruction_pointer(); + if (!win_emu->mod_manager.executable->is_within(rip)) + { + return; + } + + if (concise_logging) + { + static uint64_t count{0}; + ++count; + if (count > 100 && count % 100000 != 0) + { + return; + } + } + + win_emu->log.print(color::blue, + "Writing to executable section %s at 0x%" PRIx64 " via 0x%" PRIx64 "\n", + section.name.c_str(), address, rip); + }; + + win_emu->emu().hook_memory_read(section.region.start, section.region.length, std::move(read_handler)); + win_emu->emu().hook_memory_write(section.region.start, section.region.length, std::move(write_handler)); } - - auto read_handler = [&, section, concise_logging](const uint64_t address, const void*, size_t) { - const auto rip = win_emu->emu().read_instruction_pointer(); - if (!win_emu->mod_manager.executable->is_within(rip)) - { - return; - } - - if (concise_logging) - { - static uint64_t count{0}; - ++count; - if (count > 100 && count % 100000 != 0) - { - return; - } - } - - win_emu->log.print(color::green, - "Reading from executable section %s at 0x%" PRIx64 " via 0x%" PRIx64 "\n", - section.name.c_str(), address, rip); - }; - - const auto write_handler = [&, section, concise_logging](const uint64_t address, const void*, size_t) { - const auto rip = win_emu->emu().read_instruction_pointer(); - if (!win_emu->mod_manager.executable->is_within(rip)) - { - return; - } - - if (concise_logging) - { - static uint64_t count{0}; - ++count; - if (count > 100 && count % 100000 != 0) - { - return; - } - } - - win_emu->log.print(color::blue, "Writing to executable section %s at 0x%" PRIx64 " via 0x%" PRIx64 "\n", - section.name.c_str(), address, rip); - }; - - win_emu->emu().hook_memory_read(section.region.start, section.region.length, std::move(read_handler)); - win_emu->emu().hook_memory_write(section.region.start, section.region.length, std::move(write_handler)); } return run_emulation(context, options); @@ -391,6 +396,7 @@ namespace printf(" -v, --verbose Verbose logging\n"); printf(" -b, --buffer Buffer stdout\n"); printf(" -c, --concise Concise logging\n"); + printf(" -x, --exec Log r/w access to executable memory\n"); printf(" -m, --module Specify module to track\n"); printf(" -e, --emulation Set emulation root path\n"); printf(" -a, --snapshot Load snapshot dump from path\n");