From 43968ba91d941f4244b421d0a24242749e8f7fad Mon Sep 17 00:00:00 2001 From: rjindael Date: Thu, 7 Sep 2023 16:05:20 -0700 Subject: [PATCH 01/17] feat: add rapidjson --- vcpkg.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index c64e848..c51d25a 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -4,6 +4,7 @@ "version": "1.0.0", "dependencies": [ "curl", - "detours" + "detours", + "rapidjson" ] } \ No newline at end of file From 17b91d98d17ec50d0941472341e96c63a7b9f914 Mon Sep 17 00:00:00 2001 From: rjindael Date: Thu, 7 Sep 2023 16:08:58 -0700 Subject: [PATCH 02/17] feat: hook HttpGetPostWinInet --- Kiseki.Patcher/Header/Globals.hpp | 1 + Kiseki.Patcher/Header/Hooks/Http.hpp | 18 ++++++ Kiseki.Patcher/Source/Hooks/Http.cpp | 88 ++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) diff --git a/Kiseki.Patcher/Header/Globals.hpp b/Kiseki.Patcher/Header/Globals.hpp index a7956ac..638eeb1 100644 --- a/Kiseki.Patcher/Header/Globals.hpp +++ b/Kiseki.Patcher/Header/Globals.hpp @@ -11,6 +11,7 @@ #define PUBLIC_KEY 0x06, 0x02, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xA5, 0x11, 0xD0, 0x9F, 0xAB, 0x9B, 0x3A, 0x96, 0xC5, 0xBE, 0x50, 0xBB, 0xCA, 0x0C, 0xBB, 0xC8, 0x1A, 0x9C, 0xC1, 0x2F, 0x22, 0x7A, 0x80, 0x2C, 0x31, 0x01, 0xE1, 0x21, 0xC2, 0x7F, 0xE0, 0x10, 0xA1, 0x2D, 0x09, 0xED, 0x10, 0x3E, 0x28, 0xB9, 0xBD, 0x0F, 0x38, 0xDB, 0x52, 0x78, 0xC0, 0xEC, 0x04, 0xD4, 0x00, 0xAD, 0x45, 0xD3, 0xC7, 0x78, 0xF2, 0x83, 0xB5, 0x5B, 0x16, 0x0C, 0x32, 0x5D, 0xB3, 0x3B, 0xDA, 0xA2, 0x9C, 0x73, 0xB2, 0x0C, 0x09, 0x93, 0xD8, 0xF8, 0xD9, 0xC5, 0x75, 0xAB, 0x33, 0x19, 0xD3, 0x6A, 0xAF, 0x20, 0x21, 0x6C, 0x78, 0x31, 0x41, 0xD1, 0xCD, 0x6D, 0x4D, 0xA1, 0x6D, 0x49, 0x3A, 0x6A, 0x33, 0x10, 0x6D, 0x52, 0x33, 0x4A, 0x10, 0x32, 0x3D, 0x42, 0xE6, 0xEC, 0x38, 0x97, 0x2F, 0x05, 0x41, 0xDD, 0xD6, 0xB6, 0xAC, 0x17, 0x4B, 0x7E, 0xFA, 0xFE, 0xA4, 0xD2 +#define ADDRESS_HTTP__HTTPGETPOSTWININET 0x006F03B0 #define ADDRESS_HTTP__TRUSTCHECK 0x005B7050 #define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x00809EC0 #define ADDRESS_STANDARDOUT__PRINT 0x005B25E0 diff --git a/Kiseki.Patcher/Header/Hooks/Http.hpp b/Kiseki.Patcher/Header/Hooks/Http.hpp index 068826b..f886c82 100644 --- a/Kiseki.Patcher/Header/Hooks/Http.hpp +++ b/Kiseki.Patcher/Header/Hooks/Http.hpp @@ -3,12 +3,30 @@ #include #include +#include + +#ifdef SERVER +#include "Hooks/StandardOut.hpp" +#endif #include "Globals.hpp" #include "Helpers.hpp" +struct Http +{ +#if PADDING_STRUCT != 0 + void* padding1[1]; +#endif + std::string alternateUrl; + void* padding2[3 + PADDING_STRUCT]; + std::string url; +}; + +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); +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); +extern Http__httpGetPostWinInet_t Http__httpGetPostWinInet; extern Http__trustCheck_t Http__trustCheck; \ No newline at end of file diff --git a/Kiseki.Patcher/Source/Hooks/Http.cpp b/Kiseki.Patcher/Source/Hooks/Http.cpp index 0f976b2..38a094e 100644 --- a/Kiseki.Patcher/Source/Hooks/Http.cpp +++ b/Kiseki.Patcher/Source/Hooks/Http.cpp @@ -1,7 +1,95 @@ #include "Hooks/Http.hpp" +#define CHECK(condition, code) \ + if(!error) { \ + if ((condition)) { \ + error = code; \ + } \ + } + +Http__httpGetPostWinInet_t Http__httpGetPostWinInet = (Http__httpGetPostWinInet_t)ADDRESS_HTTP__HTTPGETPOSTWININET; Http__trustCheck_t Http__trustCheck = (Http__trustCheck_t)ADDRESS_HTTP__TRUSTCHECK; +void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, int a3, bool compressData, LPCSTR additionalHeaders, int a6) +{ + std::pair> parsed = Helpers::parseURL(_this->url); + Http _changed = *_this; + + if (parsed.first) + { + std::map url = parsed.second; + + if (!url["path"].empty() && !url["host"].empty() && !url["query"].empty()) + { + url["path"] = Helpers::toLower(url["path"]); + + if (url["host"] == "roblox.com" || url["host"] == "www.roblox.com") + { + if (url["path"] == "/asset" || url["path"] == "/asset/" || url["path"] == "/asset/default.ashx") + { + _changed.url = "https://assetdelivery.roblox.com/v1/asset/?" + url["query"]; + _this = &_changed; + } + else if (url["path"] == "/thumbs/asset.ashx" || url["path"] == "/thumbs/avatar.ashx") + { + std::string api = "https://www.roblox.com/" + std::string(url["path"] == "/thumbs/asset.ashx" ? "asset" : "avatar") + "/request-thumbnail-fix"; + + std::map source = Helpers::parseQueryString(url["query"]); + std::map fixed = { + { url["path"] == "/thumbs/asset.ashx" ? "overrideModeration" : "dummy", "false" }, + { "thumbnailFormatId", "0" } + }; + + for (auto& pair : source) + { + fixed[Helpers::toLower(pair.first)] = pair.second; + } + + if (fixed.find("id") != fixed.end()) + { + auto handler = fixed.extract("id"); + handler.key() = url["path"] == "/thumbs/asset.ashx" ? "assetId" : "userId"; + + fixed.insert(std::move(handler)); + } + + api += Helpers::joinQueryString(fixed); + + // Get the API response + std::pair response = Helpers::httpGet(api); + if (!response.first) + { + throw std::runtime_error("Unexpected error occurred when fetching Roblox API: 0x0"); + } + + std::string data = response.second; + + rapidjson::Document document; + document.Parse(data.c_str()); + + int error = 0; + + CHECK(document.HasParseError(), 0x01); + CHECK(!document.HasMember("d"), 0x02); + CHECK(!document["d"].IsObject(), 0x03); + CHECK(!document["d"].HasMember("url"), 0x04); + CHECK(!document["d"]["url"].IsString(), 0x05); + + if (error != 0) + { + throw std::runtime_error("Unexpected error occurred when fetching Roblox API: 0x0" + std::to_string(error)); + } + + _changed.url = document["d"]["url"].GetString(); + _this = &_changed; + } + } + } + } + + Http__httpGetPostWinInet(_this, isPost, a3, compressData, additionalHeaders, a6); +} + bool __fastcall Http__trustCheck_hook(const char* url) { if (strlen(url) == 7 && !Helpers::isASCII(url)) From 7e70eb1ccccec378431dcc8b28436bb70d896e41 Mon Sep 17 00:00:00 2001 From: rjindael Date: Thu, 7 Sep 2023 16:09:05 -0700 Subject: [PATCH 03/17] feat: add compile definitions --- Kiseki.Patcher/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kiseki.Patcher/CMakeLists.txt b/Kiseki.Patcher/CMakeLists.txt index 7a1884a..b322ad0 100644 --- a/Kiseki.Patcher/CMakeLists.txt +++ b/Kiseki.Patcher/CMakeLists.txt @@ -37,12 +37,13 @@ add_library(Kiseki.Patcher SHARED ${SOURCE} ${HEADER}) # Packages find_package(CURL CONFIG REQUIRED) +find_package(RapidJSON CONFIG REQUIRED) find_path(DETOURS_INCLUDE_DIRS "detours/detours.h") find_library(DETOURS_LIBRARY detours REQUIRED) target_include_directories(Kiseki.Patcher PRIVATE Header ${DETOURS_INCLUDE_DIRS}) -target_link_libraries(Kiseki.Patcher PRIVATE CURL::libcurl ${DETOURS_LIBRARY}) +target_link_libraries(Kiseki.Patcher PRIVATE CURL::libcurl ${DETOURS_LIBRARY} rapidjson) # Target-specific linking and compile options if(COMPILE_PLAYER) From 68fbc2d81abfd25325d9ef4ae847fc15af7f02a0 Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 17:06:06 -0700 Subject: [PATCH 04/17] feat: we don't care about /Error/Dmp anymore (it breaks all other URL parsing for something we never use anyway. just JMP this) --- Kiseki.Patcher/Source/Helpers.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Kiseki.Patcher/Source/Helpers.cpp b/Kiseki.Patcher/Source/Helpers.cpp index 31a35cd..dbf43bd 100644 --- a/Kiseki.Patcher/Source/Helpers.cpp +++ b/Kiseki.Patcher/Source/Helpers.cpp @@ -140,14 +140,8 @@ std::string Helpers::getISOTimestamp() std::pair> Helpers::parseURL(const std::string url) { - // This is an ugly hack to url-encode the query before CURL actually parses the URL. - // We do this because CURL throws a fit if the query is not properly URL encoded; so URLs such as "/Error/Dmp.ashx?filename=C:/Users/..." won't parse correctly. - char* encodedQuery = curl_escape(url.substr(url.find("?") + 1).c_str(), url.substr(url.find("?") + 1).length()); - std::string encodedUrl = url.substr(0, url.find("?")) + encodedQuery; - curl_free(encodedQuery); - CURLU* curl = curl_url(); - CURLUcode result = curl_url_set(curl, CURLUPART_URL, encodedUrl.c_str(), 0); + CURLUcode result = curl_url_set(curl, CURLUPART_URL, url.c_str(), 0); std::map map; bool success = false; From 0a05b9577cd49de749abd6f921697edeb121d8d6 Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 17:06:30 -0700 Subject: [PATCH 05/17] fix: actually hook Http::httpGetPostWinInet --- Kiseki.Patcher/Source/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Kiseki.Patcher/Source/main.cpp b/Kiseki.Patcher/Source/main.cpp index 862d74a..53a3e2e 100644 --- a/Kiseki.Patcher/Source/main.cpp +++ b/Kiseki.Patcher/Source/main.cpp @@ -13,6 +13,7 @@ START_PATCH_LIST() +ADD_PATCH(Http__httpGetPostWinInet, Http__httpGetPostWinInet_hook) ADD_PATCH(Http__trustCheck, Http__trustCheck_hook) ADD_PATCH(Crypt__verifySignatureBase64, Crypt__verifySignatureBase64_hook) From e006d0085fe9162c7e0bbfc562377385a99515d1 Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 17:06:48 -0700 Subject: [PATCH 06/17] fix: Http struct (now only works on debug builds. fix this one day) --- Kiseki.Patcher/Header/Globals.hpp | 7 +------ Kiseki.Patcher/Header/Hooks/Http.hpp | 6 ++---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Kiseki.Patcher/Header/Globals.hpp b/Kiseki.Patcher/Header/Globals.hpp index 0fcab88..4121d13 100644 --- a/Kiseki.Patcher/Header/Globals.hpp +++ b/Kiseki.Patcher/Header/Globals.hpp @@ -1,15 +1,10 @@ #pragma once -#define ALLOWED_WILDCARD_DOMAINS "kiseki.lol", "rbxcdn.com", "roblox.com" +#define ALLOWED_WILDCARD_DOMAINS "kiseki.loc", "kiseki.lol", "rbxcdn.com", "roblox.com" #define ALLOWED_DOMAINS #define ALLOWED_SCHEMES "http", "https" #define ALLOWED_EMBEDDED_SCHEMES "javascript", "jscript", "res" -#ifdef _DEBUG -#undef ALLOWED_WILDCARD_DOMAINS -#define ALLOWED_WILDCARD_DOMAINS "kiseki.loc", "kiseki.lol", "rbxcdn.com", "roblox.com" -#endif - #define PUBLIC_KEY 0x06, 0x02, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xA5, 0x11, 0xD0, 0x9F, 0xAB, 0x9B, 0x3A, 0x96, 0xC5, 0xBE, 0x50, 0xBB, 0xCA, 0x0C, 0xBB, 0xC8, 0x1A, 0x9C, 0xC1, 0x2F, 0x22, 0x7A, 0x80, 0x2C, 0x31, 0x01, 0xE1, 0x21, 0xC2, 0x7F, 0xE0, 0x10, 0xA1, 0x2D, 0x09, 0xED, 0x10, 0x3E, 0x28, 0xB9, 0xBD, 0x0F, 0x38, 0xDB, 0x52, 0x78, 0xC0, 0xEC, 0x04, 0xD4, 0x00, 0xAD, 0x45, 0xD3, 0xC7, 0x78, 0xF2, 0x83, 0xB5, 0x5B, 0x16, 0x0C, 0x32, 0x5D, 0xB3, 0x3B, 0xDA, 0xA2, 0x9C, 0x73, 0xB2, 0x0C, 0x09, 0x93, 0xD8, 0xF8, 0xD9, 0xC5, 0x75, 0xAB, 0x33, 0x19, 0xD3, 0x6A, 0xAF, 0x20, 0x21, 0x6C, 0x78, 0x31, 0x41, 0xD1, 0xCD, 0x6D, 0x4D, 0xA1, 0x6D, 0x49, 0x3A, 0x6A, 0x33, 0x10, 0x6D, 0x52, 0x33, 0x4A, 0x10, 0x32, 0x3D, 0x42, 0xE6, 0xEC, 0x38, 0x97, 0x2F, 0x05, 0x41, 0xDD, 0xD6, 0xB6, 0xAC, 0x17, 0x4B, 0x7E, 0xFA, 0xFE, 0xA4, 0xD2 #define ADDRESS_HTTP__HTTPGETPOSTWININET 0x006F03B0 diff --git a/Kiseki.Patcher/Header/Hooks/Http.hpp b/Kiseki.Patcher/Header/Hooks/Http.hpp index f886c82..1cd9112 100644 --- a/Kiseki.Patcher/Header/Hooks/Http.hpp +++ b/Kiseki.Patcher/Header/Hooks/Http.hpp @@ -12,13 +12,11 @@ #include "Globals.hpp" #include "Helpers.hpp" +// TODO: This breaks on Release struct Http { -#if PADDING_STRUCT != 0 - void* padding1[1]; -#endif std::string alternateUrl; - void* padding2[3 + PADDING_STRUCT]; + void* padding; std::string url; }; From 21a54ba7473c2b4639d0e6cae4d4c15e10e872ad Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 17:07:15 -0700 Subject: [PATCH 07/17] chore: remove stuff from feature/enhanced-server --- Kiseki.Patcher/Header/Globals.hpp | 1 - Kiseki.Patcher/Header/Hooks/Http.hpp | 4 ---- 2 files changed, 5 deletions(-) diff --git a/Kiseki.Patcher/Header/Globals.hpp b/Kiseki.Patcher/Header/Globals.hpp index 4121d13..63bb9dc 100644 --- a/Kiseki.Patcher/Header/Globals.hpp +++ b/Kiseki.Patcher/Header/Globals.hpp @@ -10,7 +10,6 @@ #define ADDRESS_HTTP__HTTPGETPOSTWININET 0x006F03B0 #define ADDRESS_HTTP__TRUSTCHECK 0x005B7050 #define ADDRESS_CRYPT__VERIFYSIGNATUREBASE64 0x00809EC0 -#define ADDRESS_STANDARDOUT__PRINT 0x005B25E0 #define ADDRESS_SERVERREPLICATOR__SENDTOP 0x00513E80 #define ADDRESS_SERVERREPLICATOR__PROCESSTICKET 0x00514B60 diff --git a/Kiseki.Patcher/Header/Hooks/Http.hpp b/Kiseki.Patcher/Header/Hooks/Http.hpp index 1cd9112..e81505b 100644 --- a/Kiseki.Patcher/Header/Hooks/Http.hpp +++ b/Kiseki.Patcher/Header/Hooks/Http.hpp @@ -5,10 +5,6 @@ #include #include -#ifdef SERVER -#include "Hooks/StandardOut.hpp" -#endif - #include "Globals.hpp" #include "Helpers.hpp" From cd7b7adaa2b0fde1a26e013d4062682988997b7b Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 17:23:18 -0700 Subject: [PATCH 08/17] fix: patch Helpers::httpGet CURLE_URL_MALFORMAT --- Kiseki.Patcher/Source/Helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kiseki.Patcher/Source/Helpers.cpp b/Kiseki.Patcher/Source/Helpers.cpp index dbf43bd..116e410 100644 --- a/Kiseki.Patcher/Source/Helpers.cpp +++ b/Kiseki.Patcher/Source/Helpers.cpp @@ -189,7 +189,7 @@ std::pair Helpers::httpGet(const std::string url) return std::make_pair(false, ""); } - curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Helpers::write); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data); From caf3674b00ddb80555773636f5708cee193db3cd Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 17:25:18 -0700 Subject: [PATCH 09/17] fix: use new thumbnails.roblox.com API --- Kiseki.Patcher/Source/Hooks/Http.cpp | 40 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/Kiseki.Patcher/Source/Hooks/Http.cpp b/Kiseki.Patcher/Source/Hooks/Http.cpp index 38a094e..c7afea1 100644 --- a/Kiseki.Patcher/Source/Hooks/Http.cpp +++ b/Kiseki.Patcher/Source/Hooks/Http.cpp @@ -32,13 +32,12 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i } else if (url["path"] == "/thumbs/asset.ashx" || url["path"] == "/thumbs/avatar.ashx") { - std::string api = "https://www.roblox.com/" + std::string(url["path"] == "/thumbs/asset.ashx" ? "asset" : "avatar") + "/request-thumbnail-fix"; + std::string api = "https://thumbnails.roblox.com"; + + api += url["path"] == "/thumbs/asset.ashx" ? "/v1/assets" : "/v1/users/avatar"; std::map source = Helpers::parseQueryString(url["query"]); - std::map fixed = { - { url["path"] == "/thumbs/asset.ashx" ? "overrideModeration" : "dummy", "false" }, - { "thumbnailFormatId", "0" } - }; + std::map fixed = {}; for (auto& pair : source) { @@ -48,18 +47,31 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i if (fixed.find("id") != fixed.end()) { auto handler = fixed.extract("id"); - handler.key() = url["path"] == "/thumbs/asset.ashx" ? "assetId" : "userId"; + handler.key() = url["path"] == "/thumbs/asset.ashx" ? "assetIds" : "userIds"; fixed.insert(std::move(handler)); } + if (fixed.find("x") != fixed.end() && fixed.find("y") != fixed.end()) + { + fixed["size"] = fixed["x"] + "x" + fixed["y"]; + + fixed.erase("x"); + fixed.erase("y"); + } + + if (fixed.find("format") == fixed.end()) + { + fixed["format"] = "Png"; + } + api += Helpers::joinQueryString(fixed); // Get the API response std::pair response = Helpers::httpGet(api); if (!response.first) { - throw std::runtime_error("Unexpected error occurred when fetching Roblox API: 0x0"); + throw std::runtime_error("Unexpected error occurred when fetching Roblox API: 0"); } std::string data = response.second; @@ -69,18 +81,18 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i int error = 0; - CHECK(document.HasParseError(), 0x01); - CHECK(!document.HasMember("d"), 0x02); - CHECK(!document["d"].IsObject(), 0x03); - CHECK(!document["d"].HasMember("url"), 0x04); - CHECK(!document["d"]["url"].IsString(), 0x05); + CHECK(document.HasParseError(), 1); + CHECK(!document.HasMember("data"), 2); + CHECK(document["data"].Size() == 0, 3); + CHECK(!document["data"][0].HasMember("imageUrl"), 4); + CHECK(!document["data"][0]["imageUrl"].IsString(), 5); if (error != 0) { - throw std::runtime_error("Unexpected error occurred when fetching Roblox API: 0x0" + std::to_string(error)); + throw std::runtime_error("Unexpected error occurred when fetching Roblox API: " + std::to_string(error)); } - _changed.url = document["d"]["url"].GetString(); + _changed.url = document["data"][0]["imageUrl"].GetString(); _this = &_changed; } } From 8af635f047ff5b0fcf07f932ab573425ebbdce28 Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 18:26:32 -0700 Subject: [PATCH 10/17] feat: use sets.pizzaboxer.xyz for deprecated InsertAsset endpoint --- Kiseki.Patcher/Header/Globals.hpp | 2 +- Kiseki.Patcher/Source/Hooks/Http.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Kiseki.Patcher/Header/Globals.hpp b/Kiseki.Patcher/Header/Globals.hpp index 63bb9dc..aad9f74 100644 --- a/Kiseki.Patcher/Header/Globals.hpp +++ b/Kiseki.Patcher/Header/Globals.hpp @@ -1,7 +1,7 @@ #pragma once #define ALLOWED_WILDCARD_DOMAINS "kiseki.loc", "kiseki.lol", "rbxcdn.com", "roblox.com" -#define ALLOWED_DOMAINS +#define ALLOWED_DOMAINS "sets.pizzaboxer.xyz" #define ALLOWED_SCHEMES "http", "https" #define ALLOWED_EMBEDDED_SCHEMES "javascript", "jscript", "res" diff --git a/Kiseki.Patcher/Source/Hooks/Http.cpp b/Kiseki.Patcher/Source/Hooks/Http.cpp index c7afea1..244882f 100644 --- a/Kiseki.Patcher/Source/Hooks/Http.cpp +++ b/Kiseki.Patcher/Source/Hooks/Http.cpp @@ -25,7 +25,11 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i if (url["host"] == "roblox.com" || url["host"] == "www.roblox.com") { - if (url["path"] == "/asset" || url["path"] == "/asset/" || url["path"] == "/asset/default.ashx") + if (url["path"] == "/game/tools/insertasset.ashx") + { + _changed.url = "https://sets.pizzaboxer.xyz/" + url["path"] + "?" + url["query"]; + } + else if (url["path"] == "/asset" || url["path"] == "/asset/" || url["path"] == "/asset/default.ashx") { _changed.url = "https://assetdelivery.roblox.com/v1/asset/?" + url["query"]; _this = &_changed; From d73e035dc4d3119398cd2a392d1da87ea3026dc3 Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 8 Sep 2023 21:17:05 -0700 Subject: [PATCH 11/17] feat: handle kiseki.loc/asset redirects --- Kiseki.Patcher/Header/Helpers.hpp | 1 + Kiseki.Patcher/Source/Helpers.cpp | 45 ++++++++++++++++++++++++++++ Kiseki.Patcher/Source/Hooks/Http.cpp | 12 +++++++- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/Kiseki.Patcher/Header/Helpers.hpp b/Kiseki.Patcher/Header/Helpers.hpp index 1563a78..ddee178 100644 --- a/Kiseki.Patcher/Header/Helpers.hpp +++ b/Kiseki.Patcher/Header/Helpers.hpp @@ -29,5 +29,6 @@ public: static std::string getModulePath(); static std::string getISOTimestamp(); static std::pair> parseURL(const std::string url); + static std::string getRedirectURL(const std::string url); static std::pair httpGet(const std::string url); }; \ No newline at end of file diff --git a/Kiseki.Patcher/Source/Helpers.cpp b/Kiseki.Patcher/Source/Helpers.cpp index 116e410..637dfb0 100644 --- a/Kiseki.Patcher/Source/Helpers.cpp +++ b/Kiseki.Patcher/Source/Helpers.cpp @@ -138,6 +138,51 @@ std::string Helpers::getISOTimestamp() return std::string(buffer); } +std::string Helpers::getRedirectURL(const std::string url) +{ + CURL* curl = curl_easy_init(); + CURLcode result; + + if (!curl) + { + return url; + } + + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0); + curl_easy_setopt(curl, CURLOPT_NOBODY, 1); + curl_easy_setopt(curl, CURLOPT_HEADER, 1); + + result = curl_easy_perform(curl); + + if (result != CURLE_OK) + { + return url; + } + + long response = 0; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response); + + if (response != 301 && response != 302) + { + return url; + } + + char* redirectURL; + curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &redirectURL); + + std::string location = redirectURL ? std::string(redirectURL) : ""; + + curl_easy_cleanup(curl); + + if (location.empty()) + { + return url; + } + + return location; +} + std::pair> Helpers::parseURL(const std::string url) { CURLU* curl = curl_url(); diff --git a/Kiseki.Patcher/Source/Hooks/Http.cpp b/Kiseki.Patcher/Source/Hooks/Http.cpp index 244882f..dda340d 100644 --- a/Kiseki.Patcher/Source/Hooks/Http.cpp +++ b/Kiseki.Patcher/Source/Hooks/Http.cpp @@ -23,11 +23,21 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i { url["path"] = Helpers::toLower(url["path"]); - if (url["host"] == "roblox.com" || url["host"] == "www.roblox.com") + // TODO: This is a weird hack. + if (url["host"] == "kiseki.lol" || url["host"] == "www.kiseki.lol" || url["host"] == "kiseki.loc" || url["host"] == "www.kiseki.loc") + { + if (url["path"] == "/asset" || url["path"] == "/asset/") + { + std::string location = Helpers::getRedirectURL(url["scheme"] + "://" + url["host"] + "/asset?" + url["query"]); + _this = &_changed; + } + } + else if (url["host"] == "roblox.com" || url["host"] == "www.roblox.com") { if (url["path"] == "/game/tools/insertasset.ashx") { _changed.url = "https://sets.pizzaboxer.xyz/" + url["path"] + "?" + url["query"]; + _this = &_changed; } else if (url["path"] == "/asset" || url["path"] == "/asset/" || url["path"] == "/asset/default.ashx") { From 935eb9108346ab89598b0a5e0e6470e6b3d1a8f9 Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 22 Sep 2023 18:23:43 -0700 Subject: [PATCH 12/17] chore(proj): rewrite proj description and whatnot --- Kiseki.Patcher/Resource/Information.h | 4 ++-- README.md | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Kiseki.Patcher/Resource/Information.h b/Kiseki.Patcher/Resource/Information.h index 7ceb66e..477ddfa 100644 --- a/Kiseki.Patcher/Resource/Information.h +++ b/Kiseki.Patcher/Resource/Information.h @@ -7,6 +7,6 @@ #define VERSION_RESOURCE_STR VERSION_FULL_STR #define APP_NAME "Kiseki.Patcher" -#define APP_DESCRIPTION "Client Functionality Library" +#define APP_DESCRIPTION "Client functionality library" #define APP_ORGANIZATION "Kiseki" -#define APP_COPYRIGHT "Copyright (c) Kiseki 2022-2023" +#define APP_COPYRIGHT "Copyright (c) Kiseki 2023" diff --git a/README.md b/README.md index c523762..fb007a3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Kiseki.Patcher -Client add-on DLL used for extending game engine and server functionality -# License -Copyright (c) Kiseki 2022-2023. All rights reserved. Not for public use. \ No newline at end of file +Client functionality library + +## License + +Copyright (c) Kiseki 2023. All rights reserved. Not for public use. From 9a16099c7f9ffa10894224abfd4cfdf46f70c581 Mon Sep 17 00:00:00 2001 From: rjindael Date: Fri, 22 Sep 2023 18:26:26 -0700 Subject: [PATCH 13/17] chore(docs): credits --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fb007a3..69b5298 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,5 @@ Client functionality library ## License Copyright (c) Kiseki 2023. All rights reserved. Not for public use. + +Kiseki.Patcher is adapted from [@lrre-foss/lure](https://github.com/lrre-foss/lure), a project licensed under the [Apache License 2.0](https://github.com/lrre-foss/lure/blob/trunk/LICENSE). From e32552777843e5be80272de6fccc43f4ab623239 Mon Sep 17 00:00:00 2001 From: rjindael Date: Sat, 30 Sep 2023 23:10:19 -0700 Subject: [PATCH 14/17] =?UTF-8?q?feat:=20=F0=9F=8E=89=20finalize=20Kiseki.?= =?UTF-8?q?Patcher=20for=20v1.0.0=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kiseki.Patcher/Source/Hooks/Http.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Kiseki.Patcher/Source/Hooks/Http.cpp b/Kiseki.Patcher/Source/Hooks/Http.cpp index dda340d..54f18c4 100644 --- a/Kiseki.Patcher/Source/Hooks/Http.cpp +++ b/Kiseki.Patcher/Source/Hooks/Http.cpp @@ -22,17 +22,8 @@ void __fastcall Http__httpGetPostWinInet_hook(Http* _this, void*, bool isPost, i if (!url["path"].empty() && !url["host"].empty() && !url["query"].empty()) { url["path"] = Helpers::toLower(url["path"]); - - // TODO: This is a weird hack. - if (url["host"] == "kiseki.lol" || url["host"] == "www.kiseki.lol" || url["host"] == "kiseki.loc" || url["host"] == "www.kiseki.loc") - { - if (url["path"] == "/asset" || url["path"] == "/asset/") - { - std::string location = Helpers::getRedirectURL(url["scheme"] + "://" + url["host"] + "/asset?" + url["query"]); - _this = &_changed; - } - } - else if (url["host"] == "roblox.com" || url["host"] == "www.roblox.com") + + if (url["host"] == "roblox.com" || url["host"] == "www.roblox.com") { if (url["path"] == "/game/tools/insertasset.ashx") { From 2659c5eec10895e229cd6c87ea3245fcd34341c8 Mon Sep 17 00:00:00 2001 From: rj Date: Mon, 18 Dec 2023 00:55:20 -0800 Subject: [PATCH 15/17] license: fix copyright year --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 69b5298..4ec693c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,6 @@ Client functionality library ## License -Copyright (c) Kiseki 2023. All rights reserved. Not for public use. +Copyright (c) Kiseki 2022-2023. All rights reserved. Not for public use. Kiseki.Patcher is adapted from [@lrre-foss/lure](https://github.com/lrre-foss/lure), a project licensed under the [Apache License 2.0](https://github.com/lrre-foss/lure/blob/trunk/LICENSE). From e09b9202e4f5310d93b0f528bca720636f5514af Mon Sep 17 00:00:00 2001 From: rj Date: Tue, 12 Mar 2024 22:56:31 -0700 Subject: [PATCH 16/17] notice --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ec693c..f943305 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # Kiseki.Patcher +> [!IMPORTANT] +> This project is currently in the process of being migrated to [@lrre-foss/lure](https://github.com/lrre-foss/lure). This repository will no longer receive updates. Please send all pull requests and bug fixes to that repository instead. + Client functionality library ## License -Copyright (c) Kiseki 2022-2023. All rights reserved. Not for public use. +Copyright (c) Kiseki 2022-2024. All rights reserved. Not for public use. Kiseki.Patcher is adapted from [@lrre-foss/lure](https://github.com/lrre-foss/lure), a project licensed under the [Apache License 2.0](https://github.com/lrre-foss/lure/blob/trunk/LICENSE). From a2b103ec4b7faa914f16d6d78e08a6c5459516bd Mon Sep 17 00:00:00 2001 From: rj Date: Tue, 12 Mar 2024 22:58:05 -0700 Subject: [PATCH 17/17] license --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index f943305..fdda377 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,4 @@ Client functionality library ## License -Copyright (c) Kiseki 2022-2024. All rights reserved. Not for public use. - -Kiseki.Patcher is adapted from [@lrre-foss/lure](https://github.com/lrre-foss/lure), a project licensed under the [Apache License 2.0](https://github.com/lrre-foss/lure/blob/trunk/LICENSE). +Kiseki.Patcher is a fork of [@lrre-foss/lure](https://github.com/lrre-foss/lure), a project licensed under the [Apache License 2.0](https://github.com/lrre-foss/lure/blob/trunk/LICENSE); Kiseki.Patcher is thereby licensed under the Apache License 2.0 as well.