-
Notifications
You must be signed in to change notification settings - Fork 1
/
entry.cpp
135 lines (102 loc) · 3.77 KB
/
entry.cpp
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
#include <iostream>
#include "driver/Driver.h"
#include "Mapper/kdmapper.hpp"
#include "Mapper/utils.hpp"
#include "Mapper/driver.h"
#include <thread>
#include "Roblox/DataModel/DataModel.hpp"
#include "Roblox/Instance/RobloxInstance.hpp"
#include "Roblox/Bridge/Bridge.hpp"
#include "utils/utils.h"
#include "BytecodeUtils.h"
HANDLE iqvw64e_device_handle;
using namespace kdmapper;
using namespace intel_driver;
std::string random_string()
{
srand((unsigned int)time((time_t*)0));
std::string str = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890";
std::string newstr;
int pos;
while (newstr.size() != 32)
{
pos = ((rand() % (str.size() + 1)));
newstr += str.substr(pos, 1);
}
return newstr;
}
void TitleThread()
{
while (true)
{
SetConsoleTitleA(random_string().c_str());
}
}
std::thread Title(TitleThread);
int main()
{
const auto pDatamodel{ DataModel::get_singleton() };
const auto pBridge{ Bridge::get_singleton() };
std::cout << "[~] Initializing..." << std::endl;
HANDLE device_handler = Load();
if (!device_handler || device_handler == INVALID_HANDLE_VALUE)
{
std::cout << "[-] Failed to initialize." << std::endl;
std::cin.get();
return -1;
}
MapDriverBytes(device_handler, RawData);
Unload(device_handler);
std::cout << "[+] Initialized" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
std::cout << "[~] Finding Roblox..." << std::endl;
const auto pDriver{ Driver::get_singleton() };
std::wstring target = L"RobloxPlayerBeta.exe";
DWORD pid = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot != INVALID_HANDLE_VALUE) {
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(hSnapshot, &pe32)) {
do {
if (target.compare(pe32.szExeFile) == 0) {
pid = pe32.th32ProcessID;
break;
}
} while (Process32Next(hSnapshot, &pe32));
}
CloseHandle(hSnapshot);
}
if (pid == 0) {
std::cout << "[-] Couldn't find Roblox";
std::cin.get();
return 1;
}
std::cout << "[+] Found Roblox" << std::endl;
pDriver->initialize(L"\\\\.\\{f751dd83-fcc5-43b5-aa0d-398fe67bc306}", pid);
uintptr_t target_process_base_address = pDriver->get_base_address(L"RobloxPlayerBeta.exe");
if (target_process_base_address == 0) {
std::cout << "[-] Failed to get base address of roblox. This may be because of the driver not being loaded" << std::endl;
}
// TODO: Add Ingame injection
auto target_process_hwnd = utils::get_hwnd_of_process_id(pid);
auto thread_id = GetWindowThreadProcessId(target_process_hwnd, 0);
pDatamodel->main_thread_id = thread_id;
std::uint64_t datamodel = pDatamodel->get_datamodel();
RobloxInstance game = static_cast<RobloxInstance>(datamodel);
auto coregui = game.FindFirstChildOfClass("CoreGui");
auto robloxgui = coregui.find_first_child("RobloxGui");
auto Modules = robloxgui.find_first_child("Modules");
auto Common = Modules.find_first_child("Common");
auto policyservice = Common.find_first_child("PolicyService");
std::cout << "[~] Attaching..." << std::endl;
if (pDatamodel->ingame == false) {
policyservice.SetBytecode(init_script_bytecode, init_script_size);
}
else {
std::cout << "[-] Ingame Injection is not supported as of right now!" << std::endl;
}
std::cout << "[+] Attached!" << std::endl;
pBridge->initialize();
pBridge->start();
}