-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoffset.hpp
203 lines (179 loc) · 6.49 KB
/
offset.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#include <Windows.h>
#include <iostream>
#include <string>
#include <cstdint>
#include <vector>
#include <iterator>
#include <sstream>
#include "Retcheck.hpp"
#include "Roblox_Address.h"
using namespace std;
#define ASLRBypass(x) (x - 0x400000 + (DWORD)GetModuleHandleA(0))
#define RBXState RobloxState
#define GetGlobal -10002 // LUA_GLOBALSINDEX
DWORD RBXState;
DWORD RLuaState(DWORD SContext)
{
return *(DWORD*)(SContext + 228) ^ (SContext + 228);
}
DWORD RSetIdentity(static int Id)
{
static int Id1 = 116;
static int Id2 = 24;
*(DWORD*)(*(DWORD*)(RBXState + Id1) + Id2) = Id;
return 0;
}
namespace ROffsets
{
DWORD ScriptContextA = ASLRBypass(Adresses::scriptcontext/*0x020FDF14*/);
using getfield_def = int(lua_getfield_CCV*)(DWORD a, int b, const char* c);
getfield_def getfield = (getfield_def)unprotect(ASLRBypass(Adresses::lua_getfield_addr));
void getglobal(DWORD a, const char* b) // way of accessing getfield.
{
getfield(a, GetGlobal, b);
}
using setfield_def = int(lua_setfield_CCV*)(DWORD a, int b, const char* c);
setfield_def setfield = (setfield_def)unprotect(ASLRBypass(Adresses::lua_setfield_addr));
using pushboolean_def = int(lua_pushboolean_CCV*)(DWORD a, int b); // error = convert int to bool.
pushboolean_def pushboolean = (pushboolean_def)unprotect(ASLRBypass(Adresses::lua_pushboolean_addr));
using pushnil_def = int(lua_pushnil_CCV*)(int a);
pushnil_def pushnil = (pushnil_def)unprotect(ASLRBypass(Adresses::lua_pushnil_addr));
using pushnumber_def = int(lua_pushnumber_CCV*)(DWORD a, int b);
pushnumber_def pushnumber = (pushnumber_def)unprotect(ASLRBypass(Adresses::lua_pushnumber_addr));
using pushstring_def = int(lua_pushstring_CCV*)(DWORD a, const char* b);
pushstring_def pushstring = (pushstring_def)unprotect(ASLRBypass(Adresses::lua_pushstring_addr));
using pushvalue_def = int(lua_pushvalue_CCV*)(DWORD, int a2);
pushvalue_def pushvalue = (pushvalue_def)unprotect(ASLRBypass(Adresses::lua_pushvalue_addr));
using pcall_def = int(lua_pcall_CCV*)(DWORD a, int b, int c, int d);
pcall_def pcall = (pcall_def)unprotect(ASLRBypass(Adresses::lua_pcall_addr));
using settop_def = int(lua_settop_CCV*)(DWORD a, int b);
settop_def settop = (settop_def)unprotect(ASLRBypass(Adresses::lua_settop_addr));
using lerror_def = int(lual_error_CCV*)(int a, const char* b, ...);
lerror_def l_error = (lerror_def)(ASLRBypass(Adresses::lual_error_addr)); // not sure if Lua-l_error or lua_error welp its up to u to fix it
}
namespace Execution
{
// if you don't know lua c, theres no point of downloading SKID.
std::vector<std::string> SplitArguments(std::string string)
{
std::vector<std::string> elements;
std::stringstream start(string);
std::istream_iterator<std::string> begin(start);
std::istream_iterator<std::string> end;
std::vector<std::string> vectorStrings(begin, end);
return vectorStrings;
}
void ExecuteLuaC(DWORD RBX, std::string LuaC)
{
std::istringstream StringStreamedString(LuaC);
std::vector<std::string> SplitLines;
std::string HeldLine;
while (std::getline(StringStreamedString, HeldLine)) {
SplitLines.push_back(HeldLine);
HeldLine = "";
}
for (unsigned i = 0; i < SplitLines.size(); i++)
{
std::string CurrentLine = SplitLines[i];
std::vector<std::string> Arg = SplitArguments(CurrentLine);
if (Arg.at(0) == "pushstring")
{
std::string k;
for (size_t i = 1; i < Arg.size(); i++) {
if (i < (Arg.size() - 1)) {
k.append(Arg.at(i) + ' ');
}
else if (i == (Arg.size() - 1)) {
k.append(Arg.at(i));
}
else {
}
}
ROffsets::pushstring(RBXState, k.c_str());
}
else if (Arg.at(0) == "getfield")
{
ROffsets::getfield(RBXState, -1, Arg.at(2).c_str());
}
else if (Arg.at(0) == "setfield")
{
ROffsets::getfield(RBXState, std::stoi(Arg.at(1)), Arg.at(2).c_str());
}
else if (Arg.at(0) == "pushnumber")
{
ROffsets::pushnumber(RBXState, std::stoi(Arg.at(1)));
}
else if (Arg.at(0) == "pcall")
{
ROffsets::pcall(RBXState, std::stoi(Arg[1]), std::stoi(Arg[2]), std::stoi(Arg[3]));
}
else if (Arg.at(0) == "getglobal")
{
ROffsets::getfield(RBXState, GetGlobal, Arg.at(1).c_str());
}
else if (Arg.at(0) == "emptystack")
{
ROffsets::settop(RBXState, 0);
}
else if (Arg.at(0) == "settop")
{
ROffsets::settop(RBXState, std::stoi(Arg.at(1).c_str()));
}
else if (Arg.at(0) == "pushboolean")
{
//MessageBoxA(0, "Convert int to bool in 2nd pushboolean arguments.", "CommandSploitX", 0); //why speedster uses messagebox, its annoying wtf speedster.
//ROffsets::pushboolean(RBXState, Arg.at(1).c_str());
//Don't DM me for adding this some stupid code //
ROffsets::getfield(RBXState, -10002, "warn");
ROffsets::pushstring(RBXState, "Convert int to bool in 2nd pushboolean arguments.");
ROffsets::pcall(RBXState, 1, 0, 0);
}
else if (Arg.at(0) == "pushvalue")
{
ROffsets::pushvalue(RBXState, std::stoi(Arg.at(1)));
}
else // doesn't match any of the text above.
{
ROffsets::getfield(RBXState, -10002, "warn");
ROffsets::pushstring(RBXState, "Unknown global execution. - Ur Mom Unknown global");
ROffsets::pcall(RBXState, 1, 0, 0);
}
}
}
}
namespace Scanner
{
bool Compare(const BYTE* location, const BYTE* aob, const char* mask) {
for (; *mask; ++aob, ++mask, ++location) {
__try {
if (*mask == 'x' && *location != *aob)
return 0;
}
__except (1) {
return 0;
}
}
return 1;
}
DWORD Find_Pattern(BYTE* pattern, char* mask, BYTE protection = (PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY | PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)) {
SYSTEM_INFO SI = { 0 };
GetSystemInfo(&SI);
DWORD start = (DWORD)SI.lpMinimumApplicationAddress;
DWORD end = (DWORD)SI.lpMaximumApplicationAddress;
MEMORY_BASIC_INFORMATION mbi;
while (start < end && VirtualQuery((void*)start, &mbi, sizeof(mbi))) {
if ((mbi.State & MEM_COMMIT) && (mbi.Protect & protection) && !(mbi.Protect & PAGE_GUARD)) {
for (DWORD i = (DWORD)mbi.BaseAddress; i < (DWORD)mbi.BaseAddress + mbi.RegionSize; ++i) {
if (Compare((BYTE*)i, pattern, mask)) {
return i;
}
}
}
start += mbi.RegionSize;
}
return 0;
}
static int Scan(DWORD mode, char* content, char* mask) {
return Find_Pattern((BYTE*)content, mask, mode);
}
}