Add hook for setting game.jobId
This commit is contained in:
parent
f1a565327e
commit
21820beb55
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
// RobloxApp (2010)
|
||||
#ifdef MFC2010
|
||||
#define STRUCTOFFSET_DATAMODEL__JOBID 2912
|
||||
|
||||
#define ADDRESS_DATAMODEL__GETJOBID 0x005CACC0
|
||||
#define ADDRESS_STANDARDOUT__PRINT 0x0059F340
|
||||
#define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x004FC1A0
|
||||
#define ADDRESS_HTTP__TRUSTCHECK 0x005A2680
|
||||
|
|
@ -20,10 +23,13 @@
|
|||
|
||||
// RobloxApp (2011)
|
||||
#ifdef MFC2011
|
||||
#define STRUCTOFFSET_DATAMODEL__JOBID 2956
|
||||
|
||||
#define ADDRESS_DATAMODEL__GETJOBID 0x005E70C0
|
||||
#define ADDRESS_STANDARDOUT__PRINT 0x005B25E0
|
||||
#define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x0
|
||||
#define ADDRESS_HTTP__TRUSTCHECK 0x005B7050
|
||||
#define ADDRESS_HTTP__VERIFYSIGNATUREBASE64 0x00809EC0
|
||||
#define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x00809EC0
|
||||
#define ADDRESS_CAPP__CREATEGAME 0x0
|
||||
#define ADDRESS_CAPP__ROBLOXAUTHENTICATE 0x0
|
||||
#define ADDRESS_CROBLOXAPP__INITINSTANCE 0x004613C0
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -14,12 +14,16 @@ void Logger::Initialize(const std::string jobId)
|
|||
Logger::handle = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
SetStdHandle(STD_OUTPUT_HANDLE, Logger::handle);
|
||||
|
||||
#ifndef NDEBUG
|
||||
printf("[[[ DLL COMPILED AS DEBUG ]]]\n");
|
||||
#endif
|
||||
|
||||
// lol
|
||||
printf("Access key read: \n");
|
||||
printf("Current Access key: \n");
|
||||
printf("Service starting...\n");
|
||||
printf("Intializing Roblox Web Service\n");
|
||||
printf("Service Started on port 64989\n");
|
||||
// printf("Access key read: \n");
|
||||
// printf("Current Access key: \n");
|
||||
// printf("Service starting...\n");
|
||||
// printf("Intializing Roblox Web Service\n");
|
||||
// printf("Service Started on port 64989\n");
|
||||
|
||||
Logger::outputLog = std::ofstream(jobId + std::string("-Output.txt"));
|
||||
Logger::httpLog = std::ofstream(jobId + std::string("-Http.txt"));
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@
|
|||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="RobloxMFCClasses.h" />
|
||||
<ClInclude Include="RobloxMFCHooks.h" />
|
||||
<ClInclude Include="Util.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
|
|
@ -183,6 +184,7 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RobloxMFCHooks.cpp" />
|
||||
<ClCompile Include="Util.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@
|
|||
<ClInclude Include="Logger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Util.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
|
|
@ -56,5 +59,8 @@
|
|||
<ClCompile Include="Logger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Util.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
#include "pch.h"
|
||||
#include "RobloxMFCHooks.h"
|
||||
#include "Logger.h"
|
||||
#include "Config.h"
|
||||
#include "Util.h"
|
||||
#include "Logger.h"
|
||||
#include "LUrlParser.h"
|
||||
|
||||
static bool hasAuthUrlArg = false;
|
||||
static bool hasAuthTicketArg = false;
|
||||
static bool hasJoinArg = false;
|
||||
static bool hasJobId = false;
|
||||
static bool setJobId = false;
|
||||
|
||||
static std::wstring authenticationUrl;
|
||||
static std::wstring authenticationTicket;
|
||||
|
|
@ -19,6 +21,7 @@ static std::string jobId;
|
|||
Http__trustCheck_t Http__trustCheck = (Http__trustCheck_t)ADDRESS_HTTP__TRUSTCHECK;
|
||||
Crypt__verifySignatureBase64_t Crypt__verifySignatureBase64 = (Crypt__verifySignatureBase64_t)ADDRESS_CRYPT__VERIFYSIGNATUREBASE64;
|
||||
#ifdef ARBITERBUILD
|
||||
DataModel__getJobId_t DataModel__getJobId = (DataModel__getJobId_t)ADDRESS_DATAMODEL__GETJOBID;
|
||||
StandardOut__print_t StandardOut__print = (StandardOut__print_t)ADDRESS_STANDARDOUT__PRINT;
|
||||
// Network__RakNetAddressToString_t Network__RakNetAddressToString = (Network__RakNetAddressToString_t)ADDRESS_NETWORK__RAKNETADDRESSTOSTRING;
|
||||
#endif
|
||||
|
|
@ -31,34 +34,6 @@ CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam = (CRobl
|
|||
|
||||
BOOL __fastcall Http__trustCheck_hook(const char* url)
|
||||
{
|
||||
const std::vector<std::string> allowedHosts
|
||||
{
|
||||
"polygon.pizzaboxer.xyz",
|
||||
"polygondev.pizzaboxer.xyz",
|
||||
"polygonapi.pizzaboxer.xyz",
|
||||
|
||||
"roblox.com",
|
||||
"www.roblox.com",
|
||||
"assetdelivery.roblox.com",
|
||||
|
||||
"tadah.rocks",
|
||||
"www.tadah.rocks"
|
||||
};
|
||||
|
||||
const std::vector<std::string> allowedSchemes
|
||||
{
|
||||
"http",
|
||||
"https",
|
||||
"ftp",
|
||||
};
|
||||
|
||||
const std::vector<std::string> allowedEmbeddedSchemes
|
||||
{
|
||||
"javascript",
|
||||
"jscript",
|
||||
"res",
|
||||
};
|
||||
|
||||
LUrlParser::ParseURL parsedUrl = LUrlParser::ParseURL::parseURL(url);
|
||||
|
||||
if (!parsedUrl.isValid())
|
||||
|
|
@ -71,10 +46,10 @@ BOOL __fastcall Http__trustCheck_hook(const char* url)
|
|||
if (std::string("about:blank") == url)
|
||||
return true;
|
||||
|
||||
if (std::find(allowedSchemes.begin(), allowedSchemes.end(), parsedUrl.scheme_) != allowedSchemes.end())
|
||||
return std::find(allowedHosts.begin(), allowedHosts.end(), parsedUrl.host_) != allowedHosts.end();
|
||||
if (std::find(Util::allowedSchemes.begin(), Util::allowedSchemes.end(), parsedUrl.scheme_) != Util::allowedSchemes.end())
|
||||
return std::find(Util::allowedHosts.begin(), Util::allowedHosts.end(), parsedUrl.host_) != Util::allowedHosts.end();
|
||||
|
||||
if (std::find(allowedEmbeddedSchemes.begin(), allowedEmbeddedSchemes.end(), parsedUrl.scheme_) != allowedEmbeddedSchemes.end())
|
||||
if (std::find(Util::allowedEmbeddedSchemes.begin(), Util::allowedEmbeddedSchemes.end(), parsedUrl.scheme_) != Util::allowedEmbeddedSchemes.end())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -98,6 +73,28 @@ void __fastcall Crypt__verifySignatureBase64_hook(HCRYPTPROV* _this, void*, char
|
|||
}
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
int __fastcall DataModel__getJobId_hook(char* _this, void*, int a2)
|
||||
{
|
||||
// this only sets the job id when game.jobId is called by lua
|
||||
// so the gameserver script must call game.jobId at the beginning for this to take effect
|
||||
// also, this only applies to the first datamodel that is created
|
||||
|
||||
if (!setJobId && hasJobId && !jobId.empty())
|
||||
{
|
||||
int jobIdPtr = (int)_this + STRUCTOFFSET_DATAMODEL__JOBID;
|
||||
#ifdef NDEBUG
|
||||
jobIdPtr += 4;
|
||||
#endif
|
||||
|
||||
std::string* jobIdValue = (std::string*)jobIdPtr;
|
||||
jobIdValue->assign(jobId);
|
||||
|
||||
setJobId = true;
|
||||
}
|
||||
|
||||
return DataModel__getJobId(_this, a2);
|
||||
}
|
||||
|
||||
void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* message)
|
||||
{
|
||||
StandardOut__print(_this, type, message);
|
||||
|
|
@ -107,11 +104,10 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
|
|||
#ifdef NDEBUG
|
||||
// for some reason, the location of the message pointer is offset 4 bytes when compiled as release
|
||||
// i assume doing this is safe? most of the examples ive seen use reinterpret_cast but this seems to work fine
|
||||
int messagePtr = (int)message;
|
||||
messagePtr += 4;
|
||||
int messagePtr = (int)message + 4;
|
||||
std::string* message = (std::string*)messagePtr;
|
||||
|
||||
#endif
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 1: // RBX::MESSAGE_OUTPUT:
|
||||
|
|
@ -131,7 +127,6 @@ void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string*
|
|||
SetConsoleTextAttribute(Logger::handle, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%s\n", message->c_str());
|
||||
SetConsoleTextAttribute(Logger::handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@
|
|||
|
||||
// Type Definitions //
|
||||
|
||||
typedef void(__thiscall* Http__trustCheck_t)(const char* url);
|
||||
typedef BOOL(__thiscall* Http__trustCheck_t)(const char* url);
|
||||
typedef void(__thiscall* Crypt__verifySignatureBase64_t)(HCRYPTPROV* _this, char a2, int a3, int a4, int a5, int a6, int a7, int a8, char a9, int a10, int a11, int a12, int a13, int a14, int a15);
|
||||
#ifdef ARBITERBUILD
|
||||
typedef INT(__thiscall* DataModel__getJobId_t)(char* _this, int a2);
|
||||
typedef void(__thiscall* StandardOut__print_t)(int _this, int type, std::string* message);
|
||||
// typedef void(__thiscall* Network__RakNetAddressToString_t)(int raknetAddress, bool writePort, char portDelineator);
|
||||
#endif
|
||||
|
|
@ -20,6 +21,7 @@ typedef void(__thiscall* CRobloxCommandLineInfo__ParseParam_t)(CRobloxCommandLin
|
|||
extern Http__trustCheck_t Http__trustCheck;
|
||||
extern Crypt__verifySignatureBase64_t Crypt__verifySignatureBase64;
|
||||
#ifdef ARBITERBUILD
|
||||
extern DataModel__getJobId_t DataModel__getJobId;
|
||||
extern StandardOut__print_t StandardOut__print;
|
||||
// extern Network__RakNetAddressToString_t Network__RakNetAddressToString;
|
||||
#endif
|
||||
|
|
@ -33,6 +35,7 @@ extern CRobloxCommandLineInfo__ParseParam_t CRobloxCommandLineInfo__ParseParam;
|
|||
BOOL __fastcall Http__trustCheck_hook(const char* url);
|
||||
void __fastcall Crypt__verifySignatureBase64_hook(HCRYPTPROV* _this, void*, char a2, int a3, int a4, int a5, int a6, int a7, int a8, char a9, int a10, int a11, int a12, int a13, int a14, int a15);
|
||||
#ifdef ARBITERBUILD
|
||||
INT __fastcall DataModel__getJobId_hook(char* _this, void*, int a2);
|
||||
void __fastcall StandardOut__print_hook(int _this, void*, int type, std::string* message);
|
||||
// std::string __fastcall Network__RakNetAddressToString_hook(int raknetAddress, bool writePort, char portDelineator);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
#include "pch.h"
|
||||
#include "Util.h"
|
||||
|
||||
const std::vector<std::string> Util::allowedHosts
|
||||
{
|
||||
"polygon.pizzaboxer.xyz",
|
||||
"polygondev.pizzaboxer.xyz",
|
||||
"polygonapi.pizzaboxer.xyz",
|
||||
|
||||
"roblox.com",
|
||||
"www.roblox.com",
|
||||
"assetdelivery.roblox.com",
|
||||
|
||||
"tadah.rocks",
|
||||
"www.tadah.rocks"
|
||||
};
|
||||
|
||||
const std::vector<std::string> Util::allowedSchemes
|
||||
{
|
||||
"http",
|
||||
"https",
|
||||
"ftp"
|
||||
};
|
||||
|
||||
const std::vector<std::string> Util::allowedEmbeddedSchemes
|
||||
{
|
||||
"javascript",
|
||||
"jscript",
|
||||
"res"
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
class Util
|
||||
{
|
||||
public:
|
||||
static const std::vector<std::string> allowedHosts;
|
||||
static const std::vector<std::string> allowedSchemes;
|
||||
static const std::vector<std::string> allowedEmbeddedSchemes;
|
||||
};
|
||||
|
|
@ -7,6 +7,7 @@ START_PATCH_LIST()
|
|||
ADD_PATCH(Http__trustCheck, Http__trustCheck_hook)
|
||||
ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook)
|
||||
#if defined(MFC2010) || defined(MFC2011)
|
||||
ADD_PATCH(DataModel__getJobId, DataModel__getJobId_hook)
|
||||
ADD_PATCH(CRobloxApp__InitInstance, CRobloxApp__InitInstance_hook)
|
||||
ADD_PATCH(CRobloxCommandLineInfo__ParseParam, CRobloxCommandLineInfo__ParseParam_hook)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue