GreenMs02

Untitled

Feb 12th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "VMProtectSDK.h"
  3. #include <Windows.h>
  4. #include <string>
  5. #include <iostream>
  6. #include <istream>
  7. #include <ostream>
  8.  
  9. // Below are the virtual tables of many verb classes.
  10. // Roblox has a big structure called "CommonVerbs" which contains every single
  11. // verb on the client, but sadly it was declared with __declspec(novtable) so
  12. // we cannot scan for it. Well, we could get a CommonVerb instance in the
  13. // DataModel but I didn't calculate the offset for it... yet.
  14.  
  15. // By the way, those are TToolVerbs, which is a verb class specifically used
  16. // to make tools (like hopperbins!).
  17. #define ANCHORTOOL 0x121E61C
  18. #define ROTATETOOL 0x121E45C
  19. #define HAMMERTOOL 0x121E71C
  20. #define CLONETOOL 0x121E6FC
  21. #define GRABTOOL 0x121E6DC
  22.  
  23. // This is the virtual method that calls ttoolverb->doIt.
  24. #define MOUSETOOL_DOIT 0xA37E10
  25.  
  26. DWORD rBase = (DWORD)(GetModuleHandleA(NULL));
  27.  
  28. typedef int(__thiscall* _HammerTool_doIt)(DWORD HammerTool, DWORD Unk);
  29. _HammerTool_doIt MouseTool_doIt = (_HammerTool_doIt)(MOUSETOOL_DOIT - 0x400000 + rBase);
  30.  
  31. namespace Memory {
  32. bool Compare(const BYTE *pData, const BYTE *bMask, const char *szMask)
  33. {
  34. for (; *szMask; ++szMask, ++pData, ++bMask)
  35. if (*szMask == 'x' && *pData != *bMask) return 0;
  36. return (*szMask) == NULL;
  37. }
  38.  
  39. DWORD FindPattern(DWORD dwAddress, DWORD dwLen, BYTE *bMask, char *szMask)
  40. {
  41. for (int i = 0; i<(int)dwLen; i++)
  42. if (Compare((BYTE*)(dwAddress + (int)i), bMask, szMask)) return (int)(dwAddress + i);
  43. return 0;
  44. }
  45.  
  46. int Scan(DWORD mode, char* content, char* mask, DWORD Offset = 0)
  47. {
  48. DWORD PageSize;
  49. SYSTEM_INFO si;
  50. GetSystemInfo(&si);
  51. PageSize = si.dwPageSize;
  52. MEMORY_BASIC_INFORMATION mi;
  53. for (DWORD lpAddr = (DWORD)GetModuleHandleA(0) + Offset; lpAddr<0x7FFFFFFF; lpAddr += PageSize)
  54. {
  55. DWORD vq = VirtualQuery((void*)lpAddr, &mi, PageSize);
  56. if (vq == ERROR_INVALID_PARAMETER || vq == 0) break;
  57. if (mi.Type == MEM_MAPPED) continue;
  58. if (mi.Protect == mode)
  59. {
  60. int addr = FindPattern(lpAddr, PageSize, (PBYTE)content, mask);
  61. if (addr != 0)
  62. {
  63. return addr;
  64. }
  65. }
  66. }
  67. }
  68.  
  69. int QuickScan(DWORD Mode, char* content, char* mask)
  70. {
  71. DWORD PageSize;
  72. SYSTEM_INFO si;
  73. GetSystemInfo(&si);
  74. PageSize = si.dwPageSize;
  75. MEMORY_BASIC_INFORMATION mi;
  76. for (DWORD lpAddr = (DWORD)GetModuleHandleA(0); lpAddr<0x7FFFFFFF; lpAddr += PageSize)
  77. {
  78. int addr = FindPattern(lpAddr, PageSize, (PBYTE)content, mask);
  79. if (addr != 0)
  80. {
  81. return addr;
  82. }
  83. }
  84. }
  85. }
  86.  
  87. void OpenConsole(const char* title)
  88. {
  89. DWORD nOldProtect;
  90. VirtualProtect(&FreeConsole, 1, PAGE_EXECUTE_READWRITE, &nOldProtect);
  91. *(BYTE*)(&FreeConsole) = 0xC3;
  92. VirtualProtect(&FreeConsole, 1, nOldProtect, &nOldProtect);
  93.  
  94. AllocConsole();
  95. SetConsoleTitleA(title);
  96. freopen("CONOUT$", "w", stdout);
  97. freopen("CONIN$", "r", stdin);
  98. }
  99.  
  100. int main()
  101. {
  102. VMProtectBeginUltra("verbhaxx main");
  103. OpenConsole("verbhaxx - by Louka @ V3rmillion");
  104.  
  105. // Calculate the offset.
  106. // I obtain addresses in IDA Pro so the base is 0x400000.
  107. // I just substract IDA's base from the address then add in
  108. // Roblox's actual base, which gives us an integer to scan for.
  109. DWORD AnchorTool_ScanFor = (ANCHORTOOL - 0x400000 + rBase);
  110. DWORD RotateTool_ScanFor = (ROTATETOOL - 0x400000 + rBase);
  111. DWORD HammerTool_ScanFor = (HAMMERTOOL - 0x400000 + rBase);
  112. DWORD CloneTool_ScanFor = (CLONETOOL - 0x400000 + rBase);
  113. DWORD GrabTool_ScanFor = (GRABTOOL - 0x400000 + rBase);
  114.  
  115. // Scan the verbs.
  116. printf("Verb Table (please wait ~10 seconds): \n-> HammerTool: ");
  117. DWORD HammerTool = Memory::Scan(PAGE_READWRITE, (char*)&HammerTool_ScanFor, "xxxx");
  118. printf("OK (%x)\n-> CloneTool: ", HammerTool);
  119. DWORD CloneTool = Memory::Scan(PAGE_READWRITE, (char*)&CloneTool_ScanFor, "xxxx");
  120. printf("OK (%x)\n-> GrabTool: ", CloneTool);
  121. DWORD GrabTool = Memory::Scan(PAGE_READWRITE, (char*)&GrabTool_ScanFor, "xxxx");
  122. printf("OK (%x)\n-> RotateTool: ", GrabTool);
  123. DWORD RotateTool = Memory::Scan(PAGE_READWRITE, (char*)&RotateTool_ScanFor, "xxxx");
  124. printf("OK (%x)\n-> AnchorTool: ", RotateTool);
  125. DWORD AnchorTool = Memory::Scan(PAGE_READWRITE, (char*)&AnchorTool_ScanFor, "xxxx");
  126. printf("OK (%x)\n");
  127.  
  128. while (FindWindowW(NULL, L"ROBLOX"))
  129. {
  130. printf(">");
  131. std::string VerbIn;
  132. std::getline(std::cin, VerbIn);
  133. if (VerbIn == "HammerTool")
  134. {
  135. MouseTool_doIt(HammerTool, NULL);
  136. continue;
  137. }
  138.  
  139. if (VerbIn == "CloneTool")
  140. {
  141. MouseTool_doIt(CloneTool, NULL);
  142. continue;
  143. }
  144.  
  145. if (VerbIn == "GrabTool")
  146. {
  147. MouseTool_doIt(GrabTool, NULL);
  148. continue;
  149. }
  150.  
  151. if (VerbIn == "RotateTool")
  152. {
  153. MouseTool_doIt(RotateTool, NULL);
  154. continue;
  155. }
  156.  
  157. if (VerbIn == "AnchorTool")
  158. {
  159. MouseTool_doIt(AnchorTool, NULL);
  160. continue;
  161. }
  162.  
  163. printf("Invalid verb!\n");
  164. }
  165. VMProtectEnd();
  166. return TRUE;
  167. }
Add Comment
Please, Sign In to add comment