-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI.hpp
More file actions
62 lines (52 loc) · 1.74 KB
/
API.hpp
File metadata and controls
62 lines (52 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include "scanner.hpp"
#include <string>
#include <vector>
#include "pattern.hpp"
class EasyScanner {
public:
EasyScanner() : scanner(std::make_unique<MemoryScanner>()) {}
// pattern scan
std::vector<uintptr_t> ScanPattern(const std::string& pattern) {
Pattern p(pattern);
if (!p.IsValid()) {
return {};
}
return scanner->PerformScan(p);
}
// string search
std::vector<uintptr_t> ScanString(const std::string& str, bool caseSensitive = true) {
std::vector<std::string> strings = { str };
auto results = scanner->ScanStrings(strings, caseSensitive);
std::vector<uintptr_t> addresses;
for (const auto& result : results) {
addresses.push_back(result.second);
}
return addresses;
}
//multi scan
std::vector<std::pair<std::string, uintptr_t>>
ScanMultiple(const std::vector<std::string>& patterns) {
std::vector<std::pair<std::string, uintptr_t>> allResults;
for (const auto& patternStr : patterns) {
Pattern pattern(patternStr);
if (pattern.IsValid()) {
auto results = scanner->PerformScan(pattern);
for (auto addr : results) {
allResults.emplace_back(patternStr, addr);
}
}
}
return allResults;
}
//extern
void SetTargetProcess(HANDLE processHandle) {
scanner = std::make_unique<MemoryScanner>(processHandle);
}
//auto scan all when loaded
void EnableAutoScan(bool enable) {
scanner->EnableDllAutoScan(enable);
}
private:
std::unique_ptr<MemoryScanner> scanner;
};