Add hook for full script identity error
This commit is contained in:
parent
d1493f1182
commit
3c528474a8
|
|
@ -3,6 +3,8 @@
|
|||
#include "Config.h"
|
||||
#include <oaidl.h>
|
||||
|
||||
// TODO: Split everything here into individual files
|
||||
|
||||
struct Tuple
|
||||
{
|
||||
void* padding1[4];
|
||||
|
|
@ -31,6 +33,8 @@ const auto ServiceProvider__createScriptContext = (void * (__thiscall*)(void* _t
|
|||
// const auto ScriptContext__execute = (void * (__thiscall*)(void* _this, void* a1, int identity, const char* script, const char* name, int arguments))0x617CF0;
|
||||
const auto ScriptContext__execute = (void (__thiscall*)(void* _this, int identity, const char* script, const char* name))0x617C80;
|
||||
|
||||
const auto Context__isInRole = (bool (__cdecl*)(int identity, int permission))ADDRESS_CONTEXT__ISINROLE;
|
||||
|
||||
struct Http
|
||||
{
|
||||
#if PADDING_STRUCT != 0
|
||||
|
|
|
|||
|
|
@ -20,19 +20,22 @@
|
|||
|
||||
// RobloxApp (2010)
|
||||
#ifdef MFC2010
|
||||
|
||||
#define CLASSPADDING_DATAMODEL__JOBID 728
|
||||
|
||||
#define ADDRESS_DATAMODEL__GETJOBID 0x005CACC0
|
||||
// #define ADDRESS_DATAMODEL__GETJOBID 0x005CACC0
|
||||
#define ADDRESS_STANDARDOUT__PRINT 0x0059F340
|
||||
// #define ADDRESS_NETWORK__RAKNETADDRESSTOSTRING 0x004FC1A0
|
||||
#define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x0079ECF0
|
||||
#define ADDRESS_SERVERREPLICATOR__SENDTOP 0x00506910
|
||||
#define ADDRESS_SERVERREPLICATOR__PROCESSPACKET 0x00507420
|
||||
#define ADDRESS_SERVERREPLICATOR__PROCESSTICKET 0x0
|
||||
#define ADDRESS_DATAMODEL__CREATEDATAMODEL 0x005DC150
|
||||
// #define ADDRESS_DATAMODEL__CREATEDATAMODEL 0x005DC150
|
||||
#define ADDRESS_GAME__CONSTRUCT 0x0047DBF0
|
||||
#define ADDRESS_HTTP__HTTPGETPOSTWININET 0x006A9210
|
||||
#define ADDRESS_HTTP__TRUSTCHECK 0x005A2680
|
||||
#define ADDRESS_CONTEXT__REQUIREPERMISSION 0x004A2360
|
||||
#define ADDRESS_CONTEXT__ISINROLE 0x0065E550
|
||||
|
||||
// MFC specific definitions
|
||||
#define CLASSLOCATION_CROBLOXAPP 0x00BFF898
|
||||
|
|
@ -57,10 +60,12 @@
|
|||
#define ID_REQUEST_CHARACTER 96
|
||||
#define ID_DATA 98
|
||||
#define ID_SUBMIT_TICKET 104
|
||||
|
||||
#endif
|
||||
|
||||
// RobloxApp (2011)
|
||||
#ifdef MFC2011
|
||||
|
||||
#define CLASSPADDING_DATAMODEL__JOBID 739
|
||||
|
||||
#define ADDRESS_DATAMODEL__GETJOBID 0x005E70C0
|
||||
|
|
@ -99,16 +104,20 @@
|
|||
#define ID_REPORT_ABUSE 134
|
||||
#define ID_SUBMIT_TICKET 135
|
||||
#define ID_CHAT_GAME 136
|
||||
|
||||
#endif
|
||||
|
||||
// RobloxApp/RobloxPlayer (2012)
|
||||
// RobloxApp/RobloxPlayer/RobloxStudio (2012)
|
||||
#ifdef MFC2012
|
||||
|
||||
#define ADDRESS_HTTP__TRUSTCHECK 0x006D5D20
|
||||
#define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x009B1D20
|
||||
|
||||
#endif
|
||||
|
||||
// RobloxPlayerBeta (2012)
|
||||
#ifdef PLAYER2012
|
||||
|
||||
/*
|
||||
2012 is a bit different in that the player executable is protected with
|
||||
VMProtect. VMProtect offsets the memory locations randomly on startup.
|
||||
|
|
@ -150,12 +159,15 @@
|
|||
|
||||
// Player specific definitions
|
||||
#define ADDRESS_APPLICATION__PARSEARGUMENTS Patches::GetAddressByOffset(0x00004E60)
|
||||
|
||||
#endif
|
||||
|
||||
// RobloxStudioBeta (2012)
|
||||
#ifdef STUDIO2012
|
||||
|
||||
#define ADDRESS_HTTP__TRUSTCHECK Patches::GetAddressByOffset(0x001931A0)
|
||||
#define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 Patches::GetAddressByOffset(0x004CD250)
|
||||
|
||||
#endif
|
||||
|
||||
#define RR_STOP_PROCESSING_AND_DEALLOCATE 0
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
#include "pch.h"
|
||||
#include "Context.h"
|
||||
#include "Util.h"
|
||||
|
||||
Context__requirePermission_t Context__requirePermission = (Context__requirePermission_t)ADDRESS_CONTEXT__REQUIREPERMISSION;
|
||||
|
||||
void __fastcall Context__requirePermission_hook(void* _this, void*, int permission, const char* operation)
|
||||
{
|
||||
int identity = *(int*)_this;
|
||||
|
||||
if (!Context__isInRole(identity, permission))
|
||||
{
|
||||
if (operation != 0)
|
||||
throw std::runtime_error("The current identity (" + std::to_string(identity) + ") cannot " + std::string(operation) + " (requires " + std::to_string(permission) + ")");
|
||||
else
|
||||
throw std::runtime_error("The current identity (" + std::to_string(identity) + ") cannot perform the requested operation (requires " + std::to_string(permission) + ")");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Classes.h"
|
||||
|
||||
typedef void (__thiscall* Context__requirePermission_t)(void* _this, int permission, const char* operation);
|
||||
void __fastcall Context__requirePermission_hook(void* _this, void*, int permission, const char* operation);
|
||||
extern Context__requirePermission_t Context__requirePermission;
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
#include "pch.h"
|
||||
#include "Hooks.h"
|
||||
#include "Patches.h"
|
||||
#include "Config.h"
|
||||
#include "Util.h"
|
||||
|
||||
static bool hasJobId = false;
|
||||
static bool setJobId = false;
|
||||
|
||||
static std::string jobId;
|
||||
|
||||
// Functions //
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
DataModel__getJobId_t DataModel__getJobId = (DataModel__getJobId_t)ADDRESS_DATAMODEL__GETJOBID;
|
||||
// Network__RakNetAddressToString_t Network__RakNetAddressToString = (Network__RakNetAddressToString_t)ADDRESS_NETWORK__RAKNETADDRESSTOSTRING;
|
||||
#ifdef MFC2011
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MFC2010) || defined(MFC2011)
|
||||
// CApp__CreateGame_t CApp__CreateGame = (CApp__CreateGame_t)ADDRESS_CAPP__CREATEGAME;
|
||||
#endif
|
||||
#ifdef DEBUG_SERVERREPLICATOR__PROCESSPACKET
|
||||
ServerReplicator__processPacket_t ServerReplicator__processPacket = (ServerReplicator__processPacket_t)ADDRESS_SERVERREPLICATOR__PROCESSPACKET;
|
||||
#endif
|
||||
|
||||
// Hook Definitions //
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
int __fastcall DataModel__getJobId_hook(DataModel* _this, void*, int a2)
|
||||
{
|
||||
/*
|
||||
This only sets the job ID when game.jobId is read from Lua.
|
||||
|
||||
Thus, the gameserver script must call game.jobId when it starts
|
||||
in order for this to take effect.
|
||||
|
||||
This also only applies to the first DataModel that is created.
|
||||
*/
|
||||
|
||||
if (!setJobId && hasJobId && !jobId.empty())
|
||||
{
|
||||
_this->jobId = jobId;
|
||||
setJobId = true;
|
||||
}
|
||||
|
||||
return DataModel__getJobId(_this, a2);
|
||||
}
|
||||
|
||||
// std::string __fastcall Network__RakNetAddressToString_hook(const int raknetAddress, char portDelineator)
|
||||
// {
|
||||
// return Network__RakNetAddressToString(raknetAddress, portDelineator);
|
||||
// }
|
||||
#endif
|
||||
|
||||
#if defined(MFC2010) || defined(MFC2011)
|
||||
/* INT __fastcall CApp__CreateGame_hook(CApp* _this, void*, int* a2, LPCWSTR a3)
|
||||
{
|
||||
printf("CApp::CreateGame called\n");
|
||||
// printf("Location of _this: %p\n", _this);
|
||||
// printf("Location of a2: %p\n", a2);
|
||||
// printf("Location of a3: %p\n", a3);
|
||||
|
||||
// int result = (int)CApp__CreateGame(_this, a2, a3);
|
||||
// int result = (int)CApp__CreateGame(_this, a2, L"44340105256");
|
||||
int result = (int)CApp__CreateGame(_this, a2, L"44340105256");
|
||||
|
||||
return result;
|
||||
} */
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SERVERREPLICATOR__PROCESSPACKET
|
||||
INT __fastcall ServerReplicator__processPacket_hook(int _this, void*, Packet* packet)
|
||||
{
|
||||
switch ((unsigned char)packet->data[0])
|
||||
{
|
||||
case ID_TIMESTAMP:
|
||||
printf("ServerReplicator::processPacket received ID_TIMESTAMP with length %d\n", packet->length);
|
||||
break;
|
||||
|
||||
case ID_REQUEST_CHARACTER:
|
||||
printf("ServerReplicator::processPacket received ID_REQUEST_CHARACTER with length %d\n", packet->length);
|
||||
break;
|
||||
|
||||
case ID_DATA:
|
||||
printf("ServerReplicator::processPacket received ID_DATA with length %d\n", packet->length);
|
||||
break;
|
||||
|
||||
case ID_SUBMIT_TICKET:
|
||||
printf("ServerReplicator::processPacket received ID_SUBMIT_TICKET with length %d\n", packet->length);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("ServerReplicator::processPacket received packet %d with length %d\n", packet->data[0], packet->length);
|
||||
break;
|
||||
}
|
||||
|
||||
/* if ((unsigned char)packet->data[0] == ID_SUBMIT_TICKET)
|
||||
{
|
||||
printf("ServerReplicator::processPacket received ID_SUBMIT_TICKET with length %d\n", packet->length);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("ServerReplicator::processPacket received packet %d with length %d\n", packet->data[0], packet->length);
|
||||
} */
|
||||
|
||||
/* switch ((unsigned char)packet->data[0])
|
||||
{
|
||||
case ID_SUBMIT_TICKET:
|
||||
// printf("ServerReplicator::processPacket called: ID_SUBMIT_TICKET\n");
|
||||
return ServerReplicator__processPacket(_this, packet);
|
||||
|
||||
default:
|
||||
if (true)
|
||||
{
|
||||
printf("Player not authenticated s");
|
||||
// Logger::Print(2, "Player not authenticated s");
|
||||
return RR_STOP_PROCESSING_AND_DEALLOCATE;
|
||||
}
|
||||
return ServerReplicator__processPacket(_this, packet);
|
||||
} */
|
||||
|
||||
return ServerReplicator__processPacket(_this, packet);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "Classes.h"
|
||||
|
||||
// Type Definitions //
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
typedef INT(__thiscall* DataModel__getJobId_t)(DataModel* _this, int a2);
|
||||
// typedef std::string(__thiscall* Network__RakNetAddressToString_t)(const int raknetAddress, char portDelineator);
|
||||
#ifdef MFC2011
|
||||
|
||||
#endif
|
||||
#ifdef PLAYER2012
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MFC2010) || defined(MFC2011)
|
||||
// typedef INT(__thiscall* CApp__CreateGame_t)(CApp* _this, int *a2, LPCWSTR a3);
|
||||
#endif
|
||||
#ifdef DEBUG_SERVERREPLICATOR__PROCESSPACKET
|
||||
typedef int(__thiscall* ServerReplicator__processPacket_t)(int _this, Packet* packet);
|
||||
#endif
|
||||
|
||||
// Hook Declarations //
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
INT __fastcall DataModel__getJobId_hook(DataModel* _this, void*, int a2);
|
||||
// std::string __fastcall Network__RakNetAddressToString_hook(const int raknetAddress, char portDelineator);
|
||||
#ifdef MFC2011
|
||||
|
||||
#endif
|
||||
#ifdef PLAYER2012
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MFC2010) || defined(MFC2011)
|
||||
// INT __fastcall CApp__CreateGame_hook(CApp* _this, void*, int *a2, LPCWSTR a3);
|
||||
#endif
|
||||
#ifdef DEBUG_SERVERREPLICATOR__PROCESSPACKET
|
||||
INT __fastcall ServerReplicator__processPacket_hook(int _this, void*, Packet* packet);
|
||||
#endif
|
||||
|
||||
// Externals //
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
extern DataModel__getJobId_t DataModel__getJobId;
|
||||
// extern Network__RakNetAddressToString_t Network__RakNetAddressToString;
|
||||
#ifdef MFC2011
|
||||
|
||||
#endif
|
||||
#ifdef PLAYER2012
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MFC2010) || defined(MFC2011)
|
||||
// extern CApp__CreateGame_t CApp__CreateGame;
|
||||
#endif
|
||||
#ifdef DEBUG_SERVERREPLICATOR__PROCESSPACKET
|
||||
extern ServerReplicator__processPacket_t ServerReplicator__processPacket;
|
||||
#endif
|
||||
|
|
@ -142,7 +142,7 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i
|
|||
Http__httpGetPostWinInet(_this, isPost, a3, compressData, additionalHeaders, a6);
|
||||
}
|
||||
|
||||
BOOL __fastcall Http__trustCheck_hook(const char* url)
|
||||
bool __fastcall Http__trustCheck_hook(const char* url)
|
||||
{
|
||||
if (strlen(url) == 7 && !Util::isASCII(url))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
#include <rapidjson/document.h>
|
||||
|
||||
typedef void (__thiscall* Http__httpGetPostWinInet_t)(Http* _this, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6);
|
||||
typedef BOOL(__thiscall* Http__trustCheck_t)(const char* url);
|
||||
typedef bool(__thiscall* Http__trustCheck_t)(const char* url);
|
||||
|
||||
void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6);
|
||||
BOOL __fastcall Http__trustCheck_hook(const char* url);
|
||||
bool __fastcall Http__trustCheck_hook(const char* url);
|
||||
|
||||
extern Http__httpGetPostWinInet_t Http__httpGetPostWinInet;
|
||||
extern Http__trustCheck_t Http__trustCheck;
|
||||
|
|
@ -112,6 +112,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Config.h" />
|
||||
<ClInclude Include="Context.h" />
|
||||
<ClInclude Include="ScriptContext.h" />
|
||||
<ClInclude Include="CRoblox.h" />
|
||||
<ClInclude Include="Application.h" />
|
||||
|
|
@ -121,11 +122,11 @@
|
|||
<ClInclude Include="Patches.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="Classes.h" />
|
||||
<ClInclude Include="Hooks.h" />
|
||||
<ClInclude Include="Util.h" />
|
||||
<ClInclude Include="Crypt.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Context.cpp" />
|
||||
<ClCompile Include="ScriptContext.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="CRoblox.cpp" />
|
||||
|
|
@ -139,7 +140,6 @@
|
|||
<ClCompile Include="Application.cpp" />
|
||||
<ClCompile Include="StandardOut.cpp" />
|
||||
<ClCompile Include="ReplicatorSecurity.cpp" />
|
||||
<ClCompile Include="Hooks.cpp" />
|
||||
<ClCompile Include="Http.cpp" />
|
||||
<ClCompile Include="Util.cpp" />
|
||||
<ClCompile Include="Crypt.cpp" />
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@
|
|||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Hooks.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Classes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -60,6 +57,9 @@
|
|||
<ClInclude Include="ScriptContext.h">
|
||||
<Filter>Header Files\Hooks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Context.h">
|
||||
<Filter>Header Files\Hooks</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
|
|
@ -68,9 +68,6 @@
|
|||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Hooks.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Patches.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -98,5 +95,8 @@
|
|||
<ClCompile Include="ScriptContext.cpp">
|
||||
<Filter>Source Files\Hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Context.cpp">
|
||||
<Filter>Source Files\Hooks</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -6,6 +6,10 @@
|
|||
#include "Http.h"
|
||||
#include "Crypt.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include "Context.h"
|
||||
#endif
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
#include "StandardOut.h"
|
||||
|
||||
|
|
@ -29,6 +33,10 @@ ADD_PATCH(Http__httpGetPostWinInet, Http__httpGetPostWinInet_hook)
|
|||
ADD_PATCH(Http__trustCheck, Http__trustCheck_hook)
|
||||
ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook)
|
||||
|
||||
#ifdef _DEBUG
|
||||
ADD_PATCH(Context__requirePermission, Context__requirePermission_hook)
|
||||
#endif
|
||||
|
||||
#ifdef ARBITERBUILD
|
||||
// ADD_PATCH(DataModel__getJobId, DataModel__getJobId_hook)
|
||||
ADD_PATCH(StandardOut__print, StandardOut__print_hook)
|
||||
|
|
|
|||
Loading…
Reference in New Issue