MCPcopy Create free account
hub / github.com/MJx0/KittyMemoryEx / findBytesAll

Method findBytesAll

KittyMemoryEx/KittyScanner.cpp:53–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53std::vector<uintptr_t> KittyScannerMgr::findBytesAll(const uintptr_t start,
54 const uintptr_t end,
55 const char *bytes,
56 const std::string &mask) const
57{
58 std::vector<uintptr_t> local_list;
59
60 if (!_pMem || start >= end || !bytes || mask.empty())
61 return local_list;
62
63 std::vector<char> buf(end - start, 0);
64 if (!_pMem->Read(start, &buf[0], buf.size()))
65 {
66 KITTY_LOGE("findBytesAll: Failed to read into buffer.");
67 return local_list;
68 }
69
70 uintptr_t curr_search_address = (uintptr_t)&buf[0];
71 uintptr_t search_end = (uintptr_t(&buf[0]) + buf.size());
72 do
73 {
74 uintptr_t found = findInRange(curr_search_address,
75 search_end,
76 reinterpret_cast<const uint8_t *>(bytes),
77 mask.data());
78 if (!found)
79 break;
80
81 local_list.push_back(found);
82 curr_search_address = found + 1;
83 } while (true);
84
85 if (local_list.empty())
86 return local_list;
87
88 std::vector<uintptr_t> remote_list;
89 for (auto &it : local_list)
90 {
91 remote_list.push_back((it - (uintptr_t(&buf[0]))) + start);
92 }
93
94 return remote_list;
95}
96
97uintptr_t KittyScannerMgr::findBytesFirst(const uintptr_t start,
98 const uintptr_t end,

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls 2

findInRangeFunction · 0.85
ReadMethod · 0.80

Tested by

no test coverage detected