MCPcopy Create free account
hub / github.com/Hagrid29/PELoader / encryptFile

Function encryptFile

PELoader/PELoader/util.cpp:210–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210void encryptFile(const char* payloadPath, char* outputPath) {
211
212 size_t payloadSize = 0;
213
214 BYTE* payloadBuf = peconv::load_file(payloadPath, payloadSize);
215 if (payloadBuf == NULL) {
216 std::cerr << "Cannot read payload!" << std::endl;
217 return;
218 }
219
220 unsigned char* lpszEncryptedString = nullptr;
221 DWORD dwEncryptedSize = EncryptString(payloadBuf, "Hagrid29", lpszEncryptedString, payloadSize);
222 char outputPath2[sizeof(payloadPath) + 5];
223 if (outputPath == nullptr) {
224 const char* suffix = ".enc";
225 strcpy(outputPath2, payloadPath);
226 strcat(outputPath2, suffix);
227 outputPath = outputPath2;
228 }
229 FILE* file = fopen(outputPath, "wb");
230 fwrite(lpszEncryptedString, 1, dwEncryptedSize, file);
231}
232
233BYTE* decryptFile(const char* payloadPath, OUT size_t& r_size) {
234

Callers 1

mainFunction · 0.85

Calls 1

EncryptStringFunction · 0.85

Tested by

no test coverage detected