mirror of
https://github.com/ficool2/custom_items_games.git
synced 2025-08-03 09:46:08 -04:00
Initial commit
This commit is contained in:
commit
dc08eb6dd9
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Release/*
|
||||||
|
.vs/*
|
||||||
|
*.vcxproj.user
|
||||||
|
*.vcxproj.filters
|
11
README.md
Normal file
11
README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Custom Items Games plugin
|
||||||
|
This client-side plugin bypasses integrity checks for items_games.txt in Team Fortress 2. The plugin will only work locally, and it is VAC-safe. Signature scanning is used which should make the plugin work consistently after updates.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
* Download the latest release and extract the "addons" folder to TF2's main folder (../common/Team Fortress 2/tf).
|
||||||
|
* Go into tf/scripts/items, copy the items_game.txt and rename it to items_game_custom.txt. This file will be loaded instead of the original items_games.txt.
|
||||||
|
* Create a blank txt file in the same folder and name it "items_game_custom.txt.sig".
|
||||||
|
* Run the game with -insecure in the launch parameters.
|
||||||
|
* If successful, you should see the plugin loaded in console.
|
||||||
|
|
||||||
|
To disable the plugin, remove -insecure from the launch parameters. The game will not load plugins if -insecure is not present in the launch parameters, and multiplayer servers can then be joined normally. To fully uninstall, simply remove the "addons" folder.
|
117
address.h
Normal file
117
address.h
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef intptr_t Offset;
|
||||||
|
|
||||||
|
struct AddressBase;
|
||||||
|
typedef std::vector<AddressBase*> AddressList;
|
||||||
|
const int maxAddresses = 2;
|
||||||
|
|
||||||
|
struct AddressBase
|
||||||
|
{
|
||||||
|
virtual bool Find() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class addrtype>
|
||||||
|
struct AddressInfo : public AddressBase
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
const char* sig;
|
||||||
|
size_t len;
|
||||||
|
const char* mask;
|
||||||
|
addrtype addr[maxAddresses];
|
||||||
|
ModuleName mod[maxAddresses];
|
||||||
|
|
||||||
|
AddressInfo(const char* _name, const char* _sig, size_t _len, const char* _mask,
|
||||||
|
ModuleName _mod1, ModuleName _mod2, AddressList& list)
|
||||||
|
{
|
||||||
|
name = _name;
|
||||||
|
sig = _sig;
|
||||||
|
len = _len;
|
||||||
|
mask = _mask;
|
||||||
|
memset(addr, 0, sizeof(addr));
|
||||||
|
mod[0] = _mod1;
|
||||||
|
mod[1] = _mod2;
|
||||||
|
list.push_back(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool Find()
|
||||||
|
{
|
||||||
|
int foundAddr = 0;
|
||||||
|
for (int m = 0; m < maxAddresses; m++)
|
||||||
|
{
|
||||||
|
ModuleName curmod = mod[m];
|
||||||
|
if (curmod == MOD_INVALID)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ModuleInfo& info = modules[curmod];
|
||||||
|
|
||||||
|
intptr_t ptr = 0;
|
||||||
|
intptr_t end = info.base + info.size - len;
|
||||||
|
|
||||||
|
for (intptr_t i = info.base; i < end; i++)
|
||||||
|
{
|
||||||
|
bool found = true;
|
||||||
|
for (size_t j = 0; j < len; j++)
|
||||||
|
{
|
||||||
|
if (mask)
|
||||||
|
found &= (mask[j] == '?') || (sig[j] == *(char*)(i + j));
|
||||||
|
else
|
||||||
|
found &= (sig[j] == *(char*)(i + j));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
ptr = i;
|
||||||
|
foundAddr++;
|
||||||
|
Log(Color(0, 255, 255, 255), "Signature %s found at 0x%X in %s.%s\n",
|
||||||
|
name, ptr, info.name, "dll");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addr[m] = (addrtype)ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundAddr == 0)
|
||||||
|
Log(Color(255, 0, 0, 255), "Failed to find signature for %s\n", name);
|
||||||
|
|
||||||
|
return foundAddr != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr addrtype& operator[](ModuleName m)
|
||||||
|
{
|
||||||
|
for (int k = 0; k < maxAddresses; k++)
|
||||||
|
if (mod[k] == m)
|
||||||
|
return addr[k];
|
||||||
|
UNREACHABLE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<AddressBase*> addresses;
|
||||||
|
|
||||||
|
#define CHECK_SIG(name, sig, mask) static_assert(sizeof(#sig) == sizeof(#mask), "Mismatch in signature/mask length for " name)
|
||||||
|
|
||||||
|
#define ADDR(var, name, mod, sig, mask) \
|
||||||
|
AddressInfo<var> address_##var = {name, #sig, sizeof(#sig) - 1, #mask, mod, MOD_INVALID, addresses}; \
|
||||||
|
CHECK_SIG(name, sig, mask);
|
||||||
|
|
||||||
|
#define ADDR_GAME(var, name, sig, mask) \
|
||||||
|
AddressInfo<var> address_##var = {name, #sig, sizeof(#sig) - 1, #mask, MOD_CLIENT, MOD_SERVER, addresses}; \
|
||||||
|
CHECK_SIG(name, sig, mask);
|
||||||
|
|
||||||
|
#define DETOUR_LOAD(addrtype) \
|
||||||
|
for (int k = 0; k < maxAddresses; k++) \
|
||||||
|
if (address_##addrtype.addr[k]) DetourAttach(&(LPVOID&)address_##addrtype.addr[k], &hook_##addrtype);
|
||||||
|
|
||||||
|
#define DETOUR_LOAD_GAME(addrtype) \
|
||||||
|
if (address_##addrtype[MOD_CLIENT]) DetourAttach(&(LPVOID&)address_##addrtype[MOD_CLIENT], &hook_client_##addrtype); \
|
||||||
|
if (address_##addrtype[MOD_SERVER]) DetourAttach(&(LPVOID&)address_##addrtype[MOD_SERVER], &hook_server_##addrtype);
|
||||||
|
|
||||||
|
#define DETOUR_UNLOAD(addrtype) \
|
||||||
|
for (int k = 0; k < maxAddresses; k++) \
|
||||||
|
if (address_##addrtype.addr[k]) DetourDetach(&(LPVOID&)address_##addrtype.addr[k], &hook_##addrtype);
|
||||||
|
|
||||||
|
#define DETOUR_UNLOAD_GAME(addrtype) \
|
||||||
|
if (address_##addrtype[MOD_SERVER]) DetourDetach(&(LPVOID&)address_##addrtype[MOD_CLIENT], &hook_client_##addrtype); \
|
||||||
|
if (address_##addrtype[MOD_SERVER]) DetourDetach(&(LPVOID&)address_##addrtype[MOD_SERVER], &hook_server_##addrtype);
|
25
custom_items_games.sln
Normal file
25
custom_items_games.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.3.32922.545
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "custom_items_games", "custom_items_games.vcxproj", "{7657A3ED-0F27-49A7-8967-AB3D2755732C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{7657A3ED-0F27-49A7-8967-AB3D2755732C}.Debug|x86.ActiveCfg = Release|Win32
|
||||||
|
{7657A3ED-0F27-49A7-8967-AB3D2755732C}.Debug|x86.Build.0 = Release|Win32
|
||||||
|
{7657A3ED-0F27-49A7-8967-AB3D2755732C}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{7657A3ED-0F27-49A7-8967-AB3D2755732C}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {ADAC55E2-8E9D-408D-8563-4264BA8205C3}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
145
custom_items_games.vcxproj
Normal file
145
custom_items_games.vcxproj
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{7657a3ed-0f27-49a7-8967-ab3d2755732c}</ProjectGuid>
|
||||||
|
<RootNamespace>customitemsgames</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);detours.lib</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);detours.lib</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\Users\max6\source\repos\tf_sig_plugin\tf_sig_plugin\plugin.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\Users\max6\source\repos\tf_sig_plugin\tf_sig_plugin\address.h" />
|
||||||
|
<ClInclude Include="..\..\Users\max6\source\repos\tf_sig_plugin\tf_sig_plugin\detours.h" />
|
||||||
|
<ClInclude Include="..\..\Users\max6\source\repos\tf_sig_plugin\tf_sig_plugin\helpers.h" />
|
||||||
|
<ClInclude Include="..\..\Users\max6\source\repos\tf_sig_plugin\tf_sig_plugin\functions.h" />
|
||||||
|
<ClInclude Include="..\..\Users\max6\source\repos\tf_sig_plugin\tf_sig_plugin\plugin.h" />
|
||||||
|
<ClInclude Include="..\..\Users\max6\source\repos\tf_sig_plugin\tf_sig_plugin\module.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
BIN
detours.lib
Normal file
BIN
detours.lib
Normal file
Binary file not shown.
22
helpers.h
Normal file
22
helpers.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct Color
|
||||||
|
{
|
||||||
|
Color(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a)
|
||||||
|
{
|
||||||
|
r = _r;
|
||||||
|
g = _g;
|
||||||
|
b = _b;
|
||||||
|
a = _a;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char r;
|
||||||
|
unsigned char g;
|
||||||
|
unsigned char b;
|
||||||
|
unsigned char a;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define UNREACHABLE __assume(0)
|
||||||
|
|
||||||
|
typedef void (*LogFunc)(const Color& clr, const char* msg, ...);
|
||||||
|
LogFunc Log = nullptr;
|
51
hook.h
Normal file
51
hook.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#pragma optimize("", off)
|
||||||
|
|
||||||
|
Offset offset_server_econItemSchema = 0x9D2534;
|
||||||
|
|
||||||
|
typedef bool (*crypto_verifySignature)(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t*);
|
||||||
|
ADDR_GAME(
|
||||||
|
crypto_verifySignature,
|
||||||
|
"CCrypto::RSAVerifySignatureSHA256",
|
||||||
|
\x55\x8B\xEC\x6A\xFF\x68\x2A\x2A\x2A\x2A\x64\xA1\x00\x00\x00\x00\x50\x64\x89\x25\x00\x00\x00\x00\x81\xEC\xCC\x00\x00\x00,
|
||||||
|
xxxxxx????xxxxxxxxxxxxxxxxxxxx
|
||||||
|
);
|
||||||
|
bool hook_crypto_verifySignature(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t*)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef void (__fastcall *econItemSystem_parseItemSchemaFile)(void*, void*, const char*);
|
||||||
|
ADDR_GAME(
|
||||||
|
econItemSystem_parseItemSchemaFile,
|
||||||
|
"CEconItemSystem::ParseItemSchemaFile",
|
||||||
|
\x55\x8B\xEC\x83\xEC\x14\x8B\x41\x04\x8D\x55\xEC\x83\xC1\x04\xC7\x45\xEC\x00\x00\x00\x00\x52\x68\x2A\x2A\x2A\x2A,
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxx????
|
||||||
|
);
|
||||||
|
const char* g_CustomItemsGame = "scripts/items/items_game_custom.txt";
|
||||||
|
void __fastcall hook_server_econItemSystem_parseItemSchemaFile(void* thisptr, void* edx, const char* name)
|
||||||
|
{
|
||||||
|
name = g_CustomItemsGame;
|
||||||
|
Log(Color(0, 255, 127, 255), "[Server] Loading %s...\n", name);
|
||||||
|
address_econItemSystem_parseItemSchemaFile[MOD_SERVER](thisptr, edx, name);
|
||||||
|
}
|
||||||
|
void __fastcall hook_client_econItemSystem_parseItemSchemaFile(void* thisptr, void* edx, const char* name)
|
||||||
|
{
|
||||||
|
name = g_CustomItemsGame;
|
||||||
|
Log(Color(0, 255, 127, 255), "[Client] Loading %s...\n", name);
|
||||||
|
address_econItemSystem_parseItemSchemaFile[MOD_CLIENT](thisptr, edx, name);
|
||||||
|
hook_server_econItemSystem_parseItemSchemaFile(*((void**)(modules[MOD_SERVER].base + offset_server_econItemSchema)), edx, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef bool (__fastcall* gcUpdateItemSchema_runJob)(void*, void*, void*);
|
||||||
|
ADDR_GAME(
|
||||||
|
gcUpdateItemSchema_runJob,
|
||||||
|
"CGCUpdateItemSchema::BYieldingRunGCJob",
|
||||||
|
\x55\x8B\xEC\x83\xEC\x1C\x53\x57\x8B\xF9\x8D\x4D\xE4,
|
||||||
|
xxxxxxxxxxxxx
|
||||||
|
);
|
||||||
|
void __fastcall hook_gcUpdateItemSchema_runJob(void* thisptr, void* edx, const char* name)
|
||||||
|
{
|
||||||
|
Log(Color(0, 255, 127, 255), "Blocked item schema update from GC\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma optimize("", on)
|
48
iplugin.h
Normal file
48
iplugin.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define INTERFACEVERSION_IPLUGIN "ISERVERPLUGINCALLBACKS003"
|
||||||
|
|
||||||
|
class edict_t;
|
||||||
|
class CCommand;
|
||||||
|
enum EQueryCvarValueStatus;
|
||||||
|
|
||||||
|
typedef void* (*CreateInterfaceFn)(const char *pName, int *pReturnCode);
|
||||||
|
typedef int QueryCvarCookie_t;
|
||||||
|
|
||||||
|
enum PluginResult
|
||||||
|
{
|
||||||
|
PLUGIN_CONTINUE = 0,
|
||||||
|
PLUGIN_OVERRIDE,
|
||||||
|
PLUGIN_STOP
|
||||||
|
};
|
||||||
|
|
||||||
|
enum InterfaceResult
|
||||||
|
{
|
||||||
|
IFACE_OK = 0,
|
||||||
|
IFACE_FAILED
|
||||||
|
};
|
||||||
|
|
||||||
|
class IPlugin
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory) = 0;
|
||||||
|
virtual void Unload(void) = 0;
|
||||||
|
virtual void Pause(void) = 0;
|
||||||
|
virtual void UnPause(void) = 0;
|
||||||
|
virtual const char* GetPluginDescription(void) = 0;
|
||||||
|
virtual void LevelInit(char const* pMapName) = 0;
|
||||||
|
virtual void ServerActivate(edict_t* pEdictList, int edictCount, int clientMax) = 0;
|
||||||
|
virtual void GameFrame(bool simulating) = 0;
|
||||||
|
virtual void LevelShutdown(void) = 0;
|
||||||
|
virtual void ClientActive(edict_t* pEntity) = 0;
|
||||||
|
virtual void ClientDisconnect(edict_t* pEntity) = 0;
|
||||||
|
virtual void ClientPutInServer(edict_t* pEntity, char const* playername) = 0;
|
||||||
|
virtual void SetCommandClient(int index) = 0;
|
||||||
|
virtual void ClientSettingsChanged(edict_t* pEdict) = 0;
|
||||||
|
virtual PluginResult ClientConnect(bool* bAllowConnect, edict_t* pEntity, const char* pszName, const char* pszAddress, char* reject, int maxrejectlen) = 0;
|
||||||
|
virtual PluginResult ClientCommand(edict_t* pEntity, const CCommand& args) = 0;
|
||||||
|
virtual PluginResult NetworkIDValidated(const char* pszUserName, const char* pszNetworkID) = 0;
|
||||||
|
virtual void OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t* pPlayerEntity, EQueryCvarValueStatus eStatus, const char* pCvarName, const char* pCvarValue) = 0;
|
||||||
|
virtual void OnEdictAllocated(edict_t* edict) = 0;
|
||||||
|
virtual void OnEdictFreed(const edict_t* edict) = 0;
|
||||||
|
};
|
51
module.h
Normal file
51
module.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum ModuleName
|
||||||
|
{
|
||||||
|
MOD_INVALID = -1,
|
||||||
|
|
||||||
|
MOD_CLIENT,
|
||||||
|
MOD_SERVER,
|
||||||
|
//MOD_ENGINE,
|
||||||
|
|
||||||
|
MOD_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ModuleInfo
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
intptr_t base;
|
||||||
|
intptr_t size;
|
||||||
|
|
||||||
|
bool Find()
|
||||||
|
{
|
||||||
|
char modName[MAX_PATH];
|
||||||
|
sprintf(modName, "%s.%s", name, "dll");
|
||||||
|
|
||||||
|
MODULEINFO modinfo = { 0 };
|
||||||
|
HMODULE module = GetModuleHandle(modName);
|
||||||
|
|
||||||
|
if (!module)
|
||||||
|
{
|
||||||
|
Log(Color(255, 0, 0, 255), "Failed to get module info for %s\n", modName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetModuleInformation(GetCurrentProcess(), module, &modinfo, sizeof(MODULEINFO));
|
||||||
|
base = (intptr_t)modinfo.lpBaseOfDll;
|
||||||
|
size = (intptr_t)modinfo.SizeOfImage;
|
||||||
|
|
||||||
|
Log(Color(255, 100, 200, 255), "Found module info for %s: Start: 0x%X End: 0x%X (%X)\n",
|
||||||
|
modName, base, base + size, size);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MODULE(name) #name, 0, 0
|
||||||
|
|
||||||
|
ModuleInfo modules[MOD_MAX] =
|
||||||
|
{
|
||||||
|
MODULE(client),
|
||||||
|
MODULE(server),
|
||||||
|
//MODULE(engine),
|
||||||
|
};
|
145
plugin.cpp
Normal file
145
plugin.cpp
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <Psapi.h>
|
||||||
|
#include "detours.h"
|
||||||
|
|
||||||
|
#include "iplugin.h"
|
||||||
|
|
||||||
|
#include "helpers.h"
|
||||||
|
#include "module.h"
|
||||||
|
#include "address.h"
|
||||||
|
#include "hook.h"
|
||||||
|
|
||||||
|
class CPlugin : public IPlugin
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory);
|
||||||
|
virtual void Unload(void);
|
||||||
|
virtual void Pause(void) {}
|
||||||
|
virtual void UnPause(void) {}
|
||||||
|
virtual const char* GetPluginDescription(void) { return "Schema Sig Bypasser"; }
|
||||||
|
virtual void LevelInit(char const* pMapName) {}
|
||||||
|
virtual void ServerActivate(edict_t* pEdictList, int edictCount, int clientMax) {}
|
||||||
|
virtual void GameFrame(bool simulating) {}
|
||||||
|
virtual void LevelShutdown(void) {}
|
||||||
|
virtual void ClientActive(edict_t* pEntity) {}
|
||||||
|
virtual void ClientDisconnect(edict_t* pEntity) {}
|
||||||
|
virtual void ClientPutInServer(edict_t* pEntity, char const* playername) {}
|
||||||
|
virtual void SetCommandClient(int index) {}
|
||||||
|
virtual void ClientSettingsChanged(edict_t* pEdict) {}
|
||||||
|
virtual PluginResult ClientConnect(bool* bAllowConnect, edict_t* pEntity, const char* pszName, const char* pszAddress, char* reject, int maxrejectlen) { return PLUGIN_CONTINUE; }
|
||||||
|
virtual PluginResult ClientCommand(edict_t* pEntity, const CCommand& args) { return PLUGIN_CONTINUE; }
|
||||||
|
virtual PluginResult NetworkIDValidated(const char* pszUserName, const char* pszNetworkID) { return PLUGIN_CONTINUE; }
|
||||||
|
virtual void OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t* pPlayerEntity, EQueryCvarValueStatus eStatus, const char* pCvarName, const char* pCvarValue) {}
|
||||||
|
virtual void OnEdictAllocated(edict_t* edict) {}
|
||||||
|
virtual void OnEdictFreed(const edict_t* edict) {}
|
||||||
|
|
||||||
|
bool FindLog();
|
||||||
|
bool FindModules();
|
||||||
|
bool FindAddresses();
|
||||||
|
void LoadDetours();
|
||||||
|
void UnloadDetours();
|
||||||
|
};
|
||||||
|
|
||||||
|
CPlugin g_Plugin;
|
||||||
|
|
||||||
|
extern "C" __declspec(dllexport) void* CreateInterface(const char* pName, int* pReturnCode)
|
||||||
|
{
|
||||||
|
if (!strcmp(INTERFACEVERSION_IPLUGIN, pName))
|
||||||
|
{
|
||||||
|
if (pReturnCode)
|
||||||
|
*pReturnCode = IFACE_OK;
|
||||||
|
return static_cast<IPlugin*>(&g_Plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pReturnCode)
|
||||||
|
*pReturnCode = IFACE_FAILED;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPlugin::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
|
||||||
|
{
|
||||||
|
if (!FindLog())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!FindModules())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!FindAddresses())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
LoadDetours();
|
||||||
|
|
||||||
|
Log(Color(0, 255, 0, 255), "Loaded Schema Sig Bypasser plugin successfully\n");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPlugin::Unload()
|
||||||
|
{
|
||||||
|
UnloadDetours();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPlugin::FindLog()
|
||||||
|
{
|
||||||
|
HMODULE Handle = LoadLibrary("tier0.dll");
|
||||||
|
if (!Handle)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Log = (LogFunc)GetProcAddress(Handle, "?ConColorMsg@@YAXABVColor@@PBDZZ");
|
||||||
|
if (!Log)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
FreeLibrary(Handle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPlugin::FindModules()
|
||||||
|
{
|
||||||
|
bool failed = false;
|
||||||
|
for (ModuleInfo& mod : modules)
|
||||||
|
failed |= !mod.Find();
|
||||||
|
return !failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPlugin::FindAddresses()
|
||||||
|
{
|
||||||
|
bool failed = false;
|
||||||
|
for (AddressBase* addr : addresses)
|
||||||
|
failed |= !addr->Find();
|
||||||
|
return !failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPlugin::LoadDetours()
|
||||||
|
{
|
||||||
|
DetourTransactionBegin();
|
||||||
|
DetourUpdateThread(GetCurrentThread());
|
||||||
|
|
||||||
|
DETOUR_LOAD(crypto_verifySignature);
|
||||||
|
DETOUR_LOAD(gcUpdateItemSchema_runJob);
|
||||||
|
DETOUR_LOAD_GAME(econItemSystem_parseItemSchemaFile);
|
||||||
|
|
||||||
|
DetourTransactionCommit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPlugin::UnloadDetours()
|
||||||
|
{
|
||||||
|
DetourTransactionBegin();
|
||||||
|
DetourUpdateThread(GetCurrentThread());
|
||||||
|
|
||||||
|
DETOUR_UNLOAD(crypto_verifySignature);
|
||||||
|
DETOUR_UNLOAD(gcUpdateItemSchema_runJob);
|
||||||
|
DETOUR_UNLOAD_GAME(econItemSystem_parseItemSchemaFile);
|
||||||
|
|
||||||
|
DetourTransactionCommit();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user