| 156 | } |
| 157 | |
| 158 | std::vector<uintptr_t> KittyScannerMgr::findIdaPatternAll(const uintptr_t start, |
| 159 | const uintptr_t end, |
| 160 | const std::string &pattern) |
| 161 | { |
| 162 | std::vector<uintptr_t> list; |
| 163 | |
| 164 | if (!_pMem || start >= end) |
| 165 | return list; |
| 166 | |
| 167 | std::string mask; |
| 168 | std::vector<char> bytes; |
| 169 | |
| 170 | const size_t pattren_len = pattern.length(); |
| 171 | for (std::size_t i = 0; i < pattren_len; i++) |
| 172 | { |
| 173 | if (pattern[i] == ' ') |
| 174 | continue; |
| 175 | |
| 176 | if (pattern[i] == '?') |
| 177 | { |
| 178 | bytes.push_back(0); |
| 179 | mask += '?'; |
| 180 | } |
| 181 | else if (pattren_len > i + 1 && std::isxdigit(pattern[i]) && std::isxdigit(pattern[i + 1])) |
| 182 | { |
| 183 | bytes.push_back(std::stoi(pattern.substr(i++, 2), nullptr, 16)); |
| 184 | mask += 'x'; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | if (bytes.empty() || mask.empty() || bytes.size() != mask.size()) |
| 189 | return list; |
| 190 | |
| 191 | list = findBytesAll(start, end, bytes.data(), mask); |
| 192 | return list; |
| 193 | } |
| 194 | |
| 195 | uintptr_t KittyScannerMgr::findIdaPatternFirst(const uintptr_t start, const uintptr_t end, const std::string &pattern) |
| 196 | { |