diff --git a/PolygonClientUtilities/Config.h b/PolygonClientUtilities/Config.h index 2f86c8f..2b8ff3e 100644 --- a/PolygonClientUtilities/Config.h +++ b/PolygonClientUtilities/Config.h @@ -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 diff --git a/PolygonClientUtilities/Http.cpp b/PolygonClientUtilities/Http.cpp new file mode 100644 index 0000000..4165c19 --- /dev/null +++ b/PolygonClientUtilities/Http.cpp @@ -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); +} \ No newline at end of file diff --git a/PolygonClientUtilities/Http.h b/PolygonClientUtilities/Http.h new file mode 100644 index 0000000..30621a4 --- /dev/null +++ b/PolygonClientUtilities/Http.h @@ -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; \ No newline at end of file diff --git a/PolygonClientUtilities/Patches.cpp b/PolygonClientUtilities/Patches.cpp index f6eeca6..ca6bba4 100644 --- a/PolygonClientUtilities/Patches.cpp +++ b/PolygonClientUtilities/Patches.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include "Patches.h" -#include +#include int addressOffset; diff --git a/PolygonClientUtilities/PolygonClientUtilities.vcxproj b/PolygonClientUtilities/PolygonClientUtilities.vcxproj index 3b96168..2b27c1a 100644 --- a/PolygonClientUtilities/PolygonClientUtilities.vcxproj +++ b/PolygonClientUtilities/PolygonClientUtilities.vcxproj @@ -170,7 +170,7 @@ - + @@ -199,7 +199,7 @@ - + diff --git a/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters b/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters index f7fcf09..37f90a4 100644 --- a/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters +++ b/PolygonClientUtilities/PolygonClientUtilities.vcxproj.filters @@ -60,7 +60,7 @@ Header Files\Hooks - + Header Files\Hooks @@ -104,7 +104,7 @@ Source Files\Hooks - + Source Files\Hooks diff --git a/PolygonClientUtilities/TestHttpGetPost.cpp b/PolygonClientUtilities/TestHttpGetPost.cpp deleted file mode 100644 index 5d13bf7..0000000 --- a/PolygonClientUtilities/TestHttpGetPost.cpp +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/PolygonClientUtilities/TestHttpGetPost.h b/PolygonClientUtilities/TestHttpGetPost.h deleted file mode 100644 index 34b5a71..0000000 --- a/PolygonClientUtilities/TestHttpGetPost.h +++ /dev/null @@ -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; \ No newline at end of file diff --git a/PolygonClientUtilities/dllmain.cpp b/PolygonClientUtilities/dllmain.cpp index c3cde91..1e25cb9 100644 --- a/PolygonClientUtilities/dllmain.cpp +++ b/PolygonClientUtilities/dllmain.cpp @@ -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)