Advertisement
Guest User

Untitled

a guest
Oct 11th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <vector>
  3. #include <Psapi.h>
  4.  
  5. #define gay true
  6. #define anal BOOL
  7. #define sex DllMain
  8. #define pout Sleep
  9.  
  10. #define INRANGE(x,a,b) (x >= a && x <= b)
  11. #define GET_BYTE( x ) (GET_BITS(x[0]) << 4 | GET_BITS(x[1]))
  12. #define GET_BITS( x ) (INRANGE((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (INRANGE(x,'0','9') ? x - '0' : 0))
  13.  
  14. uintptr_t find_sig(const char* module, const char* sig);
  15.  
  16. void ur_gay()
  17. {
  18. static auto set_gayness = reinterpret_cast<void(__fastcall*)(const char*, const char*)>(find_sig("engine.dll", "53 56 57 8B DA 8B F9 FF 15"));
  19. while (gay)
  20. {
  21. set_gayness("EACHAK", "EACHAK");
  22. pout(5000);
  23. }
  24. }
  25.  
  26. anal sex(HMODULE module, DWORD reason, LPVOID reserverd)
  27. {
  28. if (reason == DLL_PROCESS_ATTACH)
  29. CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)ur_gay, nullptr, NULL, nullptr);
  30. }
  31.  
  32. uintptr_t find_sig(const char* module, const char* sig)
  33. {
  34. auto pat = sig;
  35. std::vector<short> bytes;
  36. bool reached_end = false;
  37.  
  38. while (*pat)
  39. {
  40. bool short_byte = false;
  41. if (pat[0] == '\?')
  42. {
  43. if (pat[1] != '\?')
  44. short_byte = true;
  45. bytes.push_back(-1);
  46. }
  47. else
  48. bytes.push_back(GET_BYTE(pat));
  49.  
  50. if (reached_end)
  51. break;
  52.  
  53. if (short_byte)
  54. pat += 2;
  55. else
  56. pat += 3;
  57.  
  58. if (!pat[2])
  59. reached_end = true;
  60. }
  61.  
  62. auto base = (uintptr_t)GetModuleHandleA(module);
  63. MODULEINFO info;
  64. GetModuleInformation(GetCurrentProcess(), (HMODULE)base, &info, sizeof(MODULEINFO));
  65. auto end = base + info.SizeOfImage;
  66.  
  67. uintptr_t addr;
  68. auto len = bytes.size();
  69. for (auto i = base; i < end - len; i++)
  70. {
  71. bool found = true;
  72. for (auto y = 0; y < len && found; y++)
  73. if (bytes[y] >= 0 && *(BYTE*)(i + y) != bytes[y]) // if not wildcard and not matching byte, set to false to stop iterating
  74. found = false;
  75.  
  76. if (found) // if iterated through all bytes and it matched, return address
  77. {
  78. addr = i;
  79. break;
  80. }
  81. }
  82.  
  83. return addr;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement