fix httpget redirect

This commit is contained in:
lightbulblighter 2022-06-04 15:33:14 -07:00
parent 1c52e8e499
commit 82e3457ac7
No known key found for this signature in database
GPG Key ID: 0B2452F9DE0E2D01
9 changed files with 46 additions and 65 deletions

View File

@ -32,7 +32,7 @@
#define ADDRESS_SERVERREPLICATOR__PROCESSTICKET 0x0
#define ADDRESS_DATAMODEL__CREATEDATAMODEL 0x005DC150
#define ADDRESS_GAME__CONSTRUCT 0x0047DBF0
#define ADDRESS_HTTP_HTTPGETPOSTWININET 0x006A9210
#define ADDRESS_HTTP__HTTPGETPOSTWININET 0x006A9210
// MFC specific definitions
#define CLASSLOCATION_CROBLOXAPP 0x00BFF898

View File

@ -0,0 +1,31 @@
#include "pch.h"
#include "Http.h"
#include "Util.h"
#include "LUrlParser.h"
Http__httpGetPostWinInet_t Http__httpGetPostWinInet = (Http__httpGetPostWinInet_t)ADDRESS_HTTP__HTTPGETPOSTWININET;
void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6)
{
LUrlParser::ParseURL parsedUrl = LUrlParser::ParseURL::parseURL(_this->url);
std::string urlPath = Util::toLower(parsedUrl.path_);
bool flip = false;
Http _changed;
if (parsedUrl.host_ == "roblox.com" || parsedUrl.host_ == "www.roblox.com")
{
if (urlPath == "asset" || urlPath == "asset/" || urlPath == "asset/default.ashx")
{
flip = true;
_changed.url = "https://assetdelivery.roblox.com/v1/asset/?" + parsedUrl.query_;
}
}
printf("\n");
if (flip)
Http__httpGetPostWinInet(&_changed, isPost, a3, compressData, additionalHeaders, a6);
else
Http__httpGetPostWinInet(_this, isPost, a3, compressData, additionalHeaders, a6);
}

View File

@ -0,0 +1,7 @@
#pragma once
#include "Classes.h"
typedef void (__thiscall* Http__httpGetPostWinInet_t)(Http* _this, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6);
void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6);
extern Http__httpGetPostWinInet_t Http__httpGetPostWinInet;

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "Patches.h"
#include <detours.h>
#include <detours/detours.h>
int addressOffset;

View File

@ -170,7 +170,7 @@
<ClInclude Include="PlayerCommandLine.h" />
<ClInclude Include="RCCOutput.h" />
<ClInclude Include="ReplicatorSecurity.h" />
<ClInclude Include="TestHttpGetPost.h" />
<ClInclude Include="Http.h" />
<ClInclude Include="TrustCheck.h" />
<ClInclude Include="LUrlParser.h" />
<ClInclude Include="Patches.h" />
@ -199,7 +199,7 @@
<ClCompile Include="RCCOutput.cpp" />
<ClCompile Include="ReplicatorSecurity.cpp" />
<ClCompile Include="Hooks.cpp" />
<ClCompile Include="TestHttpGetPost.cpp" />
<ClCompile Include="Http.cpp" />
<ClCompile Include="TrustCheck.cpp" />
<ClCompile Include="Util.cpp" />
<ClCompile Include="Crypt.cpp" />

View File

@ -60,7 +60,7 @@
<ClInclude Include="RCCOutput.h">
<Filter>Header Files\Hooks</Filter>
</ClInclude>
<ClInclude Include="TestHttpGetPost.h">
<ClInclude Include="Http.h">
<Filter>Header Files\Hooks</Filter>
</ClInclude>
<ClInclude Include="DebugScriptContext.h">
@ -104,7 +104,7 @@
<ClCompile Include="RCCOutput.cpp">
<Filter>Source Files\Hooks</Filter>
</ClCompile>
<ClCompile Include="TestHttpGetPost.cpp">
<ClCompile Include="Http.cpp">
<Filter>Source Files\Hooks</Filter>
</ClCompile>
<ClCompile Include="DebugScriptContext.cpp">

View File

@ -1,50 +0,0 @@
#include "pch.h"
#include "TestHttpGetPost.h"
#include "Util.h"
#include "LUrlParser.h"
Http_httpGetPostWinInet_t Http_httpGetPostWinInet = (Http_httpGetPostWinInet_t)ADDRESS_HTTP_HTTPGETPOSTWININET;
void __fastcall Http_httpGetPostWinInet_hook(Http* _this, void*, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6)
{
printf("Http::httpGetPostWinInet called\n");
// printf("Value of isPost: %d\n", isPost);
// printf("Value of compressData: %d\n", compressData);
// printf("Value of additionalHeaders: %s\n", additionalHeaders);
// throw std::runtime_error("Jay coleman detected");
/* printf("Length of url: %d\n", *(int*)((int)_this + 60));
printf("Length of url 2: %d\n", _this->url.size());
printf("Length of alternateUrl: %d\n", _this->alternateUrl.size());
printf("\n");
printf("Location of _this+20: %08X\n", (int)_this);
printf("Location of _this->alternateUrl: %p\n", &_this->alternateUrl);
printf("\n");
printf("Location of _this+40: %08X\n", (int)_this + 40);
printf("Location of _this->url: %p\n", &_this->url); */
printf("Requested url: %s\n", _this->url.c_str());
LUrlParser::ParseURL parsedUrl = LUrlParser::ParseURL::parseURL(_this->url);
std::string urlPath = Util::toLower(parsedUrl.path_);
if (parsedUrl.host_ == "roblox.com" || parsedUrl.host_ == "www.roblox.com")
{
if (urlPath == "asset" || urlPath == "asset/" || urlPath == "asset/default.ashx")
{
std::string assetUrl = "https://assetdelivery.roblox.com/v1/asset/?" + parsedUrl.query_;
printf("Should swap URL with: %s\n", assetUrl.c_str());
std::string test = assetUrl;
_this->url = test;
}
}
printf("\n");
Http_httpGetPostWinInet(_this, isPost, a3, compressData, additionalHeaders, a6);
}

View File

@ -1,7 +0,0 @@
#pragma once
#include "Classes.h"
typedef void (__thiscall* Http_httpGetPostWinInet_t)(Http* _this, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6);
void __fastcall Http_httpGetPostWinInet_hook(Http* _this, void*, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6);
extern Http_httpGetPostWinInet_t Http_httpGetPostWinInet;

View File

@ -4,7 +4,7 @@
//#include "RobloxMFCHooks.h"
#include "DebugScriptContext.h"
// #include "TestHttpGetPost.h"
#include "Http.h"
#include "TrustCheck.h"
#include "Crypt.h"
@ -26,7 +26,7 @@
START_PATCH_LIST()
// ADD_PATCH(ScriptContext__execute, ScriptContext__execute_hook)
// ADD_PATCH(Http_httpGetPostWinInet, Http_httpGetPostWinInet_hook)
ADD_PATCH(Http__httpGetPostWinInet, Http__httpGetPostWinInet_hook)
ADD_PATCH(Http__trustCheck, Http__trustCheck_hook)
ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook)