mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Adds PE section extraction and pattern scanning
Adds functionality to extract a specific section from a PE file and scan for a given pattern within that section. Introduces `extract_section_from_pe_file` to isolate a section, enabling more targeted pattern searches. Overhauls `scan_for_pattern_in_file` to utilize extracted section data and improve accuracy.
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <filesystem>
|
||||
namespace omath
|
||||
{
|
||||
class PePatternScanner final
|
||||
@@ -17,6 +17,11 @@ namespace omath
|
||||
const std::string_view& pattern);
|
||||
|
||||
[[nodiscard]]
|
||||
static std::optional<std::uintptr_t> scan_for_pattern_in_file(const std::filesystem::path& path_to_file);
|
||||
static std::optional<std::uintptr_t> scan_for_pattern_in_file(const std::filesystem::path& path_to_file,
|
||||
const std::string_view& pattern);
|
||||
|
||||
[[nodiscard]]
|
||||
static std::optional<std::vector<std::byte>>
|
||||
extract_section_from_pe_file(const std::filesystem::path& path_to_file, const std::string_view& section_name);
|
||||
};
|
||||
} // namespace omath
|
||||
Reference in New Issue
Block a user