diff --git a/Starfall/dllmain.cpp b/Starfall/dllmain.cpp index e8bcd38..82bec19 100644 --- a/Starfall/dllmain.cpp +++ b/Starfall/dllmain.cpp @@ -11,7 +11,7 @@ namespace Starfall { FILE* fptr; freopen_s(&fptr, "CONOUT$", "w+", stdout); - SetConsoleTitleA("Starfall - https://github.com/ParadiseFN/Starfall"); + SetConsoleTitleA("Starfall - https://github.com/plooshi/Starfall"); } if (UseBackendParam) { diff --git a/Starfall/request.cpp b/Starfall/request.cpp index a9962cd..b75b84f 100644 --- a/Starfall/request.cpp +++ b/Starfall/request.cpp @@ -133,62 +133,56 @@ def: }; - bool StringCallback(struct pf_patch_t* patch, void* stream) { - void* saddr = (void*)((__int64(stream) + 7) + *(int32_t*)(__int64(stream) + 3)); - if (__int64(saddr) >= __int64(rbuf) && __int64(saddr) < (__int64(rbuf) + (int64_t)rsize)) { - if (wcscmp((wchar_t*)saddr, L"%p: request (easy handle:%p) has been added to threaded queue for processing") == 0) { - for (int i = 0; i < 2048; i++) { - if (CheckBytes<0x48, 0x81, 0xEC>(stream, i, true)) { - for (int x = 0; x < 50; x++) { - if (CheckBytes<0x40>(stream, i + x, true)) { - Log(Display, "Found using 4.24 & lower method\n"); - stream = (uint8_t*)stream - i - x; - goto HookVT; - } - } - } - } + void* checkStream(void *stream) { + for (int i = 0; i < 2048; i++) { + if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i, true)) { + Log(Display, "Found using 4.25 & 4.26 method\n"); + goto setStream; } - else if (wcscmp((wchar_t*)saddr, L"STAT_FCurlHttpRequest_ProcessRequest") == 0) { - for (int i = 0; i < 2048; i++) { - if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i, true)) { - Log(Display, "Found using 4.25 & 4.26 method\n"); - goto setStream; - } - else if (CheckBytes<0x48, 0x8B, 0xC4>(stream, i, true)) { - Log(Display, "Found using UE 4.27 - 5.3 method\n"); -setStream: - stream = (uint8_t*)stream - i; - goto HookVT; - } - else if (CheckBytes<0x48, 0x81, 0xEC>(stream, i, true) || CheckBytes<0x48, 0x83, 0xEC>(stream, i, true)) { - for (int x = 0; x < 50; x++) { - if (CheckBytes<0x40>(stream, i + x, true)) { - Log(Display, "Found using UE 4.25, 4.26 & 5.4+ method\n"); - stream = (uint8_t*)stream - i - x; - goto HookVT; - } - else if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i + x, true) || CheckBytes<0x48, 0x8B, 0xC4>(stream, i + x, true)) - break; - } + else if (CheckBytes<0x48, 0x8B, 0xC4>(stream, i, true)) { + Log(Display, "Found using UE 4.27 - 5.3 method\n"); + setStream: + return (uint8_t*)stream - i; + } + else if (CheckBytes<0x48, 0x81, 0xEC>(stream, i, true) || CheckBytes<0x48, 0x83, 0xEC>(stream, i, true)) { + for (int x = 0; x < 50; x++) { + if (CheckBytes<0x40>(stream, i + x, true)) { + Log(Display, "Found using UE 4.16 - 4.26 & 5.4+ method\n"); + return (uint8_t*)stream - i - x; } + else if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i + x, true) || CheckBytes<0x48, 0x8B, 0xC4>(stream, i + x, true)) + break; } } } + return nullptr; + } + bool StringCallback(struct pf_patch_t* patch, void* stream) { + void* saddr = (void*)((__int64(stream) + 7) + *(int32_t*)(__int64(stream) + 3)); + void* newStream = nullptr; + if (__int64(saddr) >= __int64(rbuf) && __int64(saddr) < (__int64(rbuf) + (int64_t)rsize)) { + if (wcscmp((wchar_t*)saddr, L"%p: request (easy handle:%p) has been added to threaded queue for processing") == 0) { + newStream = checkStream(stream); + } + else if (wcscmp((wchar_t*)saddr, L"STAT_FCurlHttpRequest_ProcessRequest") == 0) { + newStream = checkStream(stream); + } + } + if (newStream) { + Log(Display, "ProcessRequest: 0x%llx\n", __int64(newStream) - __int64(buf)); + char* ptrMatches = (char*)&newStream; + + auto patch2 = pf_construct_patch(ptrMatches, (void*)ptrMasks, 8, PtrCallback); + + struct pf_patch_t patches2[] = { + patch2 + }; + + struct pf_patchset_t patchset2 = pf_construct_patchset(patches2, sizeof(patches2) / sizeof(struct pf_patch_t), (bool (*)(void*, size_t, pf_patchset_t))pf_find_maskmatch); + while (!pf_patchset_emit(rbuf, rsize, patchset2)); + return true; + } return false; - HookVT: - Log(Display, "ProcessRequest: 0x%llx\n", __int64(stream) - __int64(buf)); - char* ptrMatches = (char*)&stream; - - auto patch2 = pf_construct_patch(ptrMatches, (void*)ptrMasks, 8, PtrCallback); - - struct pf_patch_t patches2[] = { - patch2 - }; - - struct pf_patchset_t patchset2 = pf_construct_patchset(patches2, sizeof(patches2) / sizeof(struct pf_patch_t), (bool (*)(void*, size_t, pf_patchset_t))pf_find_maskmatch); - while (!pf_patchset_emit(rbuf, rsize, patchset2)); - return true; } bool EOSStringCallback(struct pf_patch_t* patch, void* stream) { diff --git a/Starfall/url.h b/Starfall/url.h index 810dbd5..88b6348 100644 --- a/Starfall/url.h +++ b/Starfall/url.h @@ -80,11 +80,11 @@ namespace Starfall { } __forceinline StrType GetUrl() { - FString OutStr = FString((Protocol.Length - 1) + (Seperator.Length - 1) + (Domain.Length - 1) + (Port.Length - 1) + (Path.Length - 1) + (Query.String ? Query.Length - 1 : 0) + 1); + FString OutStr = FString((Protocol.Length - 1) + (Seperator.Length - 1) + (Domain.Length - 1) + (Port.String ? Port.Length - 1 : 0) + (Path.Length - 1) + (Query.String ? Query.Length - 1 : 0)); __movsb(PBYTE(OutStr.String), (const PBYTE)Protocol.String, Protocol.Length * 2); __movsb(PBYTE(OutStr.String + wcslen(OutStr.String)), (const PBYTE)Seperator.String, Seperator.Length * 2); __movsb(PBYTE(OutStr.String + wcslen(OutStr.String)), (const PBYTE)Domain.String, Domain.Length * 2); - __movsb(PBYTE(OutStr.String + wcslen(OutStr.String)), (const PBYTE)Port.String, Port.Length * 2); + if (Port.String) __movsb(PBYTE(OutStr.String + wcslen(OutStr.String)), (const PBYTE)Port.String, Port.Length * 2); __movsb(PBYTE(OutStr.String + wcslen(OutStr.String)), (const PBYTE)Path.String, Path.Length * 2); if (Query.String) __movsb(PBYTE(OutStr.String + wcslen(OutStr.String)), (const PBYTE)Query.String, Query.Length * 2); return OutStr;