minor changes
`cheat-base` add x32 build `manual map` and `load library` injection moved to `cheat-base` removed unnecessary packet sniffer functionality fixed several type conversionals `cheat-library` now is startup by default little changes in `Logger`, `PatternScanner`, `ProtoTransfer` updated detours
This commit is contained in:
parent
d0a07b0344
commit
c3a9f2a678
@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.0.32014.148
|
VisualStudioVersion = 17.0.32014.148
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "injector", "injector\injector.vcxproj", "{F578B30C-8DE6-4741-99E4-1D30D2ACDAC4}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cheat-library", "cheat-library\cheat-library.vcxproj", "{CE178784-CB96-45CA-AE16-FC0DA1126970}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cheat-base", "cheat-base\cheat-base.vcxproj", "{ADB35022-823B-4DC0-B495-3EFEFBD3A82F}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cheat-base", "cheat-base\cheat-base.vcxproj", "{ADB35022-823B-4DC0-B495-3EFEFBD3A82F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cheat-library", "cheat-library\cheat-library.vcxproj", "{CE178784-CB96-45CA-AE16-FC0DA1126970}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "injector", "injector\injector.vcxproj", "{F578B30C-8DE6-4741-99E4-1D30D2ACDAC4}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -1,14 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release_WS|Win32">
|
||||||
|
<Configuration>Release_WS</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release_WS|x64">
|
<ProjectConfiguration Include="Release_WS|x64">
|
||||||
<Configuration>Release_WS</Configuration>
|
<Configuration>Release_WS</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
@ -43,6 +55,24 @@
|
|||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
@ -60,18 +90,30 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -81,8 +123,9 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>
|
<SubSystem>
|
||||||
@ -94,26 +137,28 @@
|
|||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalDependencies>detours-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||||
</Lib>
|
</Lib>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalLibraryDirectories>$(ProjectDir)/vendor/detours/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_AMD64_;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_AMD64_;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<OmitFramePointers>false</OmitFramePointers>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>
|
<SubSystem>
|
||||||
@ -127,26 +172,28 @@
|
|||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalDependencies>detours-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||||
</Lib>
|
</Lib>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalLibraryDirectories>$(ProjectDir)/vendor/detours/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_AMD64_;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_AMD64_;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<OmitFramePointers>false</OmitFramePointers>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>
|
<SubSystem>
|
||||||
@ -160,10 +207,63 @@
|
|||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalDependencies>detours-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||||
</Lib>
|
</Lib>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalLibraryDirectories>$(ProjectDir)/vendor/detours/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Lib>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<SupportJustMyCode>false</SupportJustMyCode>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Lib>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
|
</ClCompile>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Lib>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)framework\;$(ProjectDir)src\;$(ProjectDir)vendor\detours\;$(ProjectDir)vendor\fmt\include\;$(ProjectDir)vendor\imgui\;$(ProjectDir)vendor\magic_enum\include\;$(ProjectDir)vendor\simpleIni\;$(ProjectDir)vendor\json\single_include\;$(ProjectDir)vendor\imgui-notify-v2\;$(ProjectDir)vendor\stb\</AdditionalIncludeDirectories>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
|
</ClCompile>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalDependencies>detours-$(PlatformShortName).lib</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(ProjectDir)vendor\detours\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -196,6 +296,8 @@
|
|||||||
<ClInclude Include="src\cheat-base\events\joins\eventjoinwrapper.hpp" />
|
<ClInclude Include="src\cheat-base\events\joins\eventjoinwrapper.hpp" />
|
||||||
<ClInclude Include="src\cheat-base\events\joins\handlereventjoin.h" />
|
<ClInclude Include="src\cheat-base\events\joins\handlereventjoin.h" />
|
||||||
<ClInclude Include="src\cheat-base\events\joins\handlereventjoin.hpp" />
|
<ClInclude Include="src\cheat-base\events\joins\handlereventjoin.hpp" />
|
||||||
|
<ClInclude Include="src\cheat-base\inject\load-library.h" />
|
||||||
|
<ClInclude Include="src\cheat-base\inject\manual-map.h" />
|
||||||
<ClInclude Include="src\cheat-base\ResourceLoader.h" />
|
<ClInclude Include="src\cheat-base\ResourceLoader.h" />
|
||||||
<ClInclude Include="src\cheat-base\Hotkey.h" />
|
<ClInclude Include="src\cheat-base\Hotkey.h" />
|
||||||
<ClInclude Include="src\cheat-base\render\ImageLoader.h" />
|
<ClInclude Include="src\cheat-base\render\ImageLoader.h" />
|
||||||
@ -208,6 +310,8 @@
|
|||||||
<ClInclude Include="src\cheat-base\render\renderer.h" />
|
<ClInclude Include="src\cheat-base\render\renderer.h" />
|
||||||
<ClInclude Include="src\cheat-base\HookManager.h" />
|
<ClInclude Include="src\cheat-base\HookManager.h" />
|
||||||
<ClInclude Include="src\cheat-base\Patch.h" />
|
<ClInclude Include="src\cheat-base\Patch.h" />
|
||||||
|
<ClInclude Include="src\cheat-base\singleton\Singleton.h" />
|
||||||
|
<ClInclude Include="src\cheat-base\singleton\SingletonManager.h" />
|
||||||
<ClInclude Include="src\cheat-base\thread-safe.h" />
|
<ClInclude Include="src\cheat-base\thread-safe.h" />
|
||||||
<ClInclude Include="src\cheat-base\util.h" />
|
<ClInclude Include="src\cheat-base\util.h" />
|
||||||
<ClInclude Include="src\cheat-base\Logger.h" />
|
<ClInclude Include="src\cheat-base\Logger.h" />
|
||||||
@ -247,12 +351,20 @@
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\cheat-base\events\joins\eventjoinwrapper.cpp">
|
<ClCompile Include="src\cheat-base\events\joins\eventjoinwrapper.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\cheat-base\inject\load-library.cpp" />
|
||||||
|
<ClCompile Include="src\cheat-base\inject\manual-map.cpp" />
|
||||||
<ClCompile Include="src\cheat-base\ResourceLoader.cpp" />
|
<ClCompile Include="src\cheat-base\ResourceLoader.cpp" />
|
||||||
<ClCompile Include="src\cheat-base\Hotkey.cpp" />
|
<ClCompile Include="src\cheat-base\Hotkey.cpp" />
|
||||||
<ClCompile Include="src\cheat-base\render\ImageLoader.cpp" />
|
<ClCompile Include="src\cheat-base\render\ImageLoader.cpp" />
|
||||||
@ -269,57 +381,90 @@
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\cheat-base\PipeTransfer.cpp" />
|
<ClCompile Include="src\cheat-base\PipeTransfer.cpp" />
|
||||||
<ClCompile Include="vendor\fmt\src\format.cc">
|
<ClCompile Include="vendor\fmt\src\format.cc">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\fmt\src\os.cc">
|
<ClCompile Include="vendor\fmt\src\os.cc">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\backends\imgui_impl_dx11.cpp">
|
<ClCompile Include="vendor\imgui\backends\imgui_impl_dx11.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\backends\imgui_impl_win32.cpp">
|
<ClCompile Include="vendor\imgui\backends\imgui_impl_win32.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\imgui.cpp">
|
<ClCompile Include="vendor\imgui\imgui.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\imgui_demo.cpp">
|
<ClCompile Include="vendor\imgui\imgui_demo.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\imgui_draw.cpp">
|
<ClCompile Include="vendor\imgui\imgui_draw.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\imgui_tables.cpp">
|
<ClCompile Include="vendor\imgui\imgui_tables.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\imgui_widgets.cpp">
|
<ClCompile Include="vendor\imgui\imgui_widgets.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="vendor\imgui\misc\cpp\imgui_stdlib.cpp">
|
<ClCompile Include="vendor\imgui\misc\cpp\imgui_stdlib.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release_WS|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pch.h</PrecompiledHeaderFile>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
@ -231,6 +231,18 @@
|
|||||||
<ClInclude Include="vendor\imgui\backends\imgui_impl_win32.h">
|
<ClInclude Include="vendor\imgui\backends\imgui_impl_win32.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cheat-base\singleton\Singleton.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cheat-base\singleton\SingletonManager.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cheat-base\inject\manual-map.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cheat-base\inject\load-library.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\cheat-base\util.cpp">
|
<ClCompile Include="src\cheat-base\util.cpp">
|
||||||
@ -317,5 +329,11 @@
|
|||||||
<ClCompile Include="vendor\imgui\backends\imgui_impl_win32.cpp">
|
<ClCompile Include="vendor\imgui\backends\imgui_impl_win32.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\cheat-base\inject\manual-map.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\cheat-base\inject\load-library.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -17,6 +17,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
@ -88,11 +88,6 @@ Prefix GetLevelPrefix(Logger::Level level)
|
|||||||
|
|
||||||
void Logger::Log(Logger::Level logLevel, const char* filepath, int line, const char* fmt, ...)
|
void Logger::Log(Logger::Level logLevel, const char* filepath, int line, const char* fmt, ...)
|
||||||
{
|
{
|
||||||
if (Logger::s_ConsoleLogLevel == Logger::Level::None && Logger::s_FileLogLevel == Logger::Level::None)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto filename = std::filesystem::path(filepath).filename().string();
|
|
||||||
auto prefix = GetLevelPrefix(logLevel);
|
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
@ -100,6 +95,13 @@ void Logger::Log(Logger::Level logLevel, const char* filepath, int line, const c
|
|||||||
vsprintf_s(buffer, fmt, args);
|
vsprintf_s(buffer, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
LogEvent(logLevel, filepath, line, buffer);
|
||||||
|
if (Logger::s_ConsoleLogLevel == Logger::Level::None && Logger::s_FileLogLevel == Logger::Level::None)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto filename = std::filesystem::path(filepath).filename().string();
|
||||||
|
auto prefix = GetLevelPrefix(logLevel);
|
||||||
|
|
||||||
if (Logger::s_ConsoleLogLevel != Logger::Level::None && Logger::s_ConsoleLogLevel >= logLevel)
|
if (Logger::s_ConsoleLogLevel != Logger::Level::None && Logger::s_ConsoleLogLevel >= logLevel)
|
||||||
{
|
{
|
||||||
const std::lock_guard<std::mutex> lock(_mutex);
|
const std::lock_guard<std::mutex> lock(_mutex);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <cheat-base/events/event.hpp>
|
||||||
|
|
||||||
#define EXTLOG(level, fmt, ...) Logger::Log(level, __FILE__, __LINE__, fmt, __VA_ARGS__)
|
#define EXTLOG(level, fmt, ...) Logger::Log(level, __FILE__, __LINE__, fmt, __VA_ARGS__)
|
||||||
#define LOG_CRIT(fmt, ...) EXTLOG(Logger::Level::Critical, fmt, __VA_ARGS__)
|
#define LOG_CRIT(fmt, ...) EXTLOG(Logger::Level::Critical, fmt, __VA_ARGS__)
|
||||||
#define LOG_ERROR(fmt, ...) EXTLOG(Logger::Level::Error, fmt, __VA_ARGS__)
|
#define LOG_ERROR(fmt, ...) EXTLOG(Logger::Level::Error, fmt, __VA_ARGS__)
|
||||||
@ -37,6 +39,8 @@ public:
|
|||||||
|
|
||||||
static void PrepareFileLogging(std::string directory);
|
static void PrepareFileLogging(std::string directory);
|
||||||
|
|
||||||
|
static inline TEvent<Logger::Level, const char*, int, const char*> LogEvent;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Level s_FileLogLevel;
|
static Level s_FileLogLevel;
|
||||||
static Level s_ConsoleLogLevel;
|
static Level s_ConsoleLogLevel;
|
||||||
|
@ -34,6 +34,9 @@ public:
|
|||||||
int64_t GetModuleTimestamp(const std::string& moduleName);
|
int64_t GetModuleTimestamp(const std::string& moduleName);
|
||||||
int64_t GetModuleTimestamp(HMODULE hModule);
|
int64_t GetModuleTimestamp(HMODULE hModule);
|
||||||
|
|
||||||
|
uintptr_t SearchInModule(const std::string& moduleName, const std::string& pattern);
|
||||||
|
uintptr_t SearchInModule(HMODULE hModule, const std::string& pattern);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
class AddressCounter
|
class AddressCounter
|
||||||
@ -98,9 +101,6 @@ protected:
|
|||||||
uintptr_t SearchXref(const std::string& moduleName, const OffsetSignature& xrefPattern);
|
uintptr_t SearchXref(const std::string& moduleName, const OffsetSignature& xrefPattern);
|
||||||
uintptr_t SearchXref(HMODULE hModule, const OffsetSignature& xrefPattern);
|
uintptr_t SearchXref(HMODULE hModule, const OffsetSignature& xrefPattern);
|
||||||
|
|
||||||
uintptr_t SearchInModule(const std::string& moduleName, const std::string& pattern);
|
|
||||||
uintptr_t SearchInModule(HMODULE hModule, const std::string& pattern);
|
|
||||||
|
|
||||||
uintptr_t GetOffsetInt(const nlohmann::json& value);
|
uintptr_t GetOffsetInt(const nlohmann::json& value);
|
||||||
std::string GetOffsetStr(uintptr_t offset);
|
std::string GetOffsetStr(uintptr_t offset);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ bool PipeTransfer::Connect()
|
|||||||
|
|
||||||
bool PipeTransfer::WaitForConnection()
|
bool PipeTransfer::WaitForConnection()
|
||||||
{
|
{
|
||||||
return ConnectNamedPipe(m_Pipe, nullptr);
|
return ConnectNamedPipe(m_Pipe, nullptr) || GetLastError() == ERROR_PIPE_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PipeTransfer::ReadBytes(void* buffer, size_t size)
|
void PipeTransfer::ReadBytes(void* buffer, size_t size)
|
||||||
|
55
cheat-base/src/cheat-base/inject/load-library.cpp
Normal file
55
cheat-base/src/cheat-base/inject/load-library.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include <pch.h>
|
||||||
|
#include "load-library.h"
|
||||||
|
#include <cheat-base/util.h>
|
||||||
|
|
||||||
|
#if defined(DISABLE_OUTPUT)
|
||||||
|
#define ILog(data, ...)
|
||||||
|
#define IPrintError(text, ...)
|
||||||
|
#else
|
||||||
|
#define ILog(text, ...) printf(text, __VA_ARGS__)
|
||||||
|
#define ILogError(text, ...) ILog(text, __VA_ARGS__); std::cout << "Error: " << util::GetLastErrorAsString() << std::endl
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool LoadLibraryDLL(HANDLE hProc, const std::string& dllpath)
|
||||||
|
{
|
||||||
|
HMODULE hKernel = GetModuleHandle("kernel32.dll");
|
||||||
|
if (hKernel == NULL)
|
||||||
|
{
|
||||||
|
ILogError("[DLL Injection] Failed to get kernel32.dll module address.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LPVOID pLoadLibrary = (LPVOID)GetProcAddress(hKernel, "LoadLibraryA");
|
||||||
|
if (pLoadLibrary == NULL) {
|
||||||
|
ILogError("[DLL Injection] Failed to get LoadLibraryA address.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LPVOID pDLLPath = VirtualAllocEx(hProc, NULL, strlen(dllpath.c_str()) + 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||||
|
if (pDLLPath == NULL) {
|
||||||
|
ILogError("[DLL Injection] Failed to allocate memory for DLLPath in target process.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the string name of our DLL in the memory allocated
|
||||||
|
BOOL writeResult = WriteProcessMemory(hProc, pDLLPath, dllpath.c_str(), strlen(dllpath.c_str()), NULL);
|
||||||
|
if (writeResult == FALSE) {
|
||||||
|
ILogError("[DLL Injection] Failed to write remote process memory.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load our DLL by calling loadlibrary in the other process and passing our dll name
|
||||||
|
HANDLE hThread = CreateRemoteThread(hProc, NULL, NULL, (LPTHREAD_START_ROUTINE)pLoadLibrary, (LPVOID)pDLLPath, NULL, NULL);
|
||||||
|
if (hThread == NULL) {
|
||||||
|
ILogError("[DLL Injection] Failed to create remote thread.\n");
|
||||||
|
VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CloseHandle(hThread);
|
||||||
|
|
||||||
|
// TODO: Add waiting for thread end and release unneccessary data.
|
||||||
|
// VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
|
||||||
|
|
||||||
|
ILog("[DLL Injection] Successfully LoadLibraryA injection.\n");
|
||||||
|
return true;
|
||||||
|
}
|
3
cheat-base/src/cheat-base/inject/load-library.h
Normal file
3
cheat-base/src/cheat-base/inject/load-library.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
bool LoadLibraryDLL(HANDLE hProc, const std::string& dllpath);
|
385
cheat-base/src/cheat-base/inject/manual-map.cpp
Normal file
385
cheat-base/src/cheat-base/inject/manual-map.cpp
Normal file
@ -0,0 +1,385 @@
|
|||||||
|
#include <pch.h>
|
||||||
|
#include "manual-map.h"
|
||||||
|
#include <cheat-base/util.h>
|
||||||
|
|
||||||
|
#if defined(DISABLE_OUTPUT)
|
||||||
|
#define ILog(data, ...)
|
||||||
|
#define IPrintError(text, ...)
|
||||||
|
#else
|
||||||
|
#define ILog(text, ...) printf(text, __VA_ARGS__)
|
||||||
|
#define ILogError(text, ...) ILog(text, __VA_ARGS__); std::cout << "Error: " << util::GetLastErrorAsString() << std::endl
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
#define CURRENT_ARCH IMAGE_FILE_MACHINE_AMD64
|
||||||
|
#else
|
||||||
|
#define CURRENT_ARCH IMAGE_FILE_MACHINE_I386
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using f_LoadLibraryA = HINSTANCE(WINAPI*)(const char* lpLibFilename);
|
||||||
|
using f_GetProcAddress = FARPROC(WINAPI*)(HMODULE hModule, LPCSTR lpProcName);
|
||||||
|
using f_DLL_ENTRY_POINT = BOOL(WINAPI*)(void* hDll, DWORD dwReason, void* pReserved);
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
using f_RtlAddFunctionTable = BOOL(WINAPIV*)(PRUNTIME_FUNCTION FunctionTable, DWORD EntryCount, DWORD64 BaseAddress);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct MANUAL_MAPPING_DATA
|
||||||
|
{
|
||||||
|
f_LoadLibraryA pLoadLibraryA;
|
||||||
|
f_GetProcAddress pGetProcAddress;
|
||||||
|
#ifdef _WIN64
|
||||||
|
f_RtlAddFunctionTable pRtlAddFunctionTable;
|
||||||
|
#endif
|
||||||
|
BYTE* pbase;
|
||||||
|
HINSTANCE hMod;
|
||||||
|
DWORD fdwReasonParam;
|
||||||
|
LPVOID reservedParam;
|
||||||
|
BOOL SEHSupport;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool ManualMapDLL(HANDLE hProc, const std::string& filepath)
|
||||||
|
{
|
||||||
|
std::ifstream file(filepath, std::ios::in | std::ios::binary | std::ios::ate);
|
||||||
|
if (!file.is_open())
|
||||||
|
{
|
||||||
|
std::cout << "Error while reading DLL file!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::streampos size = file.tellg();
|
||||||
|
auto memblock = new char[size];
|
||||||
|
file.seekg(0, std::ios::beg);
|
||||||
|
file.read(memblock, size);
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
BYTE* fileContent = (BYTE*)memblock;
|
||||||
|
|
||||||
|
// Manual map injection will help us to be like a assasin
|
||||||
|
bool result = ManualMapDLL(hProc, fileContent, size);
|
||||||
|
|
||||||
|
delete[] memblock;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void __stdcall Shellcode(MANUAL_MAPPING_DATA* pData);
|
||||||
|
|
||||||
|
bool ManualMapDLL(HANDLE hProc, BYTE* pSrcData, SIZE_T FileSize, bool ClearHeader, bool ClearNonNeededSections, bool AdjustProtections, bool SEHExceptionSupport, DWORD fdwReason) {
|
||||||
|
IMAGE_NT_HEADERS* pOldNtHeader = nullptr;
|
||||||
|
IMAGE_OPTIONAL_HEADER* pOldOptHeader = nullptr;
|
||||||
|
IMAGE_FILE_HEADER* pOldFileHeader = nullptr;
|
||||||
|
BYTE* pTargetBase = nullptr;
|
||||||
|
|
||||||
|
if (reinterpret_cast<IMAGE_DOS_HEADER*>(pSrcData)->e_magic != 0x5A4D) { //"MZ"
|
||||||
|
ILog("[DLL injection] Invalid file\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pOldNtHeader = reinterpret_cast<IMAGE_NT_HEADERS*>(pSrcData + reinterpret_cast<IMAGE_DOS_HEADER*>(pSrcData)->e_lfanew);
|
||||||
|
pOldOptHeader = &pOldNtHeader->OptionalHeader;
|
||||||
|
pOldFileHeader = &pOldNtHeader->FileHeader;
|
||||||
|
|
||||||
|
if (pOldFileHeader->Machine != CURRENT_ARCH) {
|
||||||
|
ILog("[DLL injection] Invalid platform.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ILog("[DLL injection] File ok\n");
|
||||||
|
|
||||||
|
pTargetBase = reinterpret_cast<BYTE*>(VirtualAllocEx(hProc, nullptr, pOldOptHeader->SizeOfImage, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
||||||
|
if (!pTargetBase) {
|
||||||
|
ILogError("[DLL injection] Target process memory allocation failed (ex)\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD oldp = 0;
|
||||||
|
VirtualProtectEx(hProc, pTargetBase, pOldOptHeader->SizeOfImage, PAGE_EXECUTE_READWRITE, &oldp);
|
||||||
|
|
||||||
|
MANUAL_MAPPING_DATA data{ 0 };
|
||||||
|
data.pLoadLibraryA = LoadLibraryA;
|
||||||
|
data.pGetProcAddress = GetProcAddress;
|
||||||
|
#ifdef _WIN64
|
||||||
|
data.pRtlAddFunctionTable = (f_RtlAddFunctionTable)RtlAddFunctionTable;
|
||||||
|
#else
|
||||||
|
SEHExceptionSupport = false;
|
||||||
|
#endif
|
||||||
|
data.pbase = pTargetBase;
|
||||||
|
data.fdwReasonParam = fdwReason;
|
||||||
|
data.SEHSupport = SEHExceptionSupport;
|
||||||
|
|
||||||
|
//File header
|
||||||
|
if (!WriteProcessMemory(hProc, pTargetBase, pSrcData, 0x1000, nullptr)) { //only first 0x1000 bytes for the header
|
||||||
|
ILogError("[DLL injection] Can't write file header.\n");
|
||||||
|
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMAGE_SECTION_HEADER* pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
||||||
|
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
||||||
|
if (pSectionHeader->SizeOfRawData) {
|
||||||
|
if (!WriteProcessMemory(hProc, pTargetBase + pSectionHeader->VirtualAddress, pSrcData + pSectionHeader->PointerToRawData, pSectionHeader->SizeOfRawData, nullptr)) {
|
||||||
|
ILogError("[DLL injection] Can't map sections.\n");
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Mapping params
|
||||||
|
BYTE* MappingDataAlloc = reinterpret_cast<BYTE*>(VirtualAllocEx(hProc, nullptr, sizeof(MANUAL_MAPPING_DATA), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
||||||
|
if (!MappingDataAlloc) {
|
||||||
|
ILogError("[DLL injection] Target process mapping allocation failed (ex).\n");
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WriteProcessMemory(hProc, MappingDataAlloc, &data, sizeof(MANUAL_MAPPING_DATA), nullptr)) {
|
||||||
|
ILogError("[DLL injection] Can't write mapping.\n");
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Shell code
|
||||||
|
void* pShellcode = VirtualAllocEx(hProc, nullptr, 0x1000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||||
|
if (!pShellcode) {
|
||||||
|
ILogError("[DLL injection] Memory shellcode allocation failed (ex).\n");
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WriteProcessMemory(hProc, pShellcode, Shellcode, 0x1000, nullptr)) {
|
||||||
|
ILogError("[DLL injection] Can't write shellcode.\n");
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ILog("[DLL injection] Mapped DLL at %p\n", pTargetBase);
|
||||||
|
ILog("[DLL injection] Mapping info at %p\n", MappingDataAlloc);
|
||||||
|
ILog("[DLL injection] Shell code at %p\n", pShellcode);
|
||||||
|
|
||||||
|
ILog("[DLL injection] Data allocated\n");
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
ILog("[DLL injection] My shellcode pointer %p\n", Shellcode);
|
||||||
|
ILog("[DLL injection] Target point %p\n", pShellcode);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HANDLE hThread = CreateRemoteThread(hProc, nullptr, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(pShellcode), MappingDataAlloc, 0, nullptr);
|
||||||
|
if (!hThread) {
|
||||||
|
ILogError("[DLL injection] Thread creation failed.\n");
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CloseHandle(hThread);
|
||||||
|
|
||||||
|
ILog("[DLL injection] Thread created at: %p, waiting for return...\n", pShellcode);
|
||||||
|
|
||||||
|
HINSTANCE hCheck = NULL;
|
||||||
|
while (!hCheck) {
|
||||||
|
DWORD exitcode = 0;
|
||||||
|
GetExitCodeProcess(hProc, &exitcode);
|
||||||
|
if (exitcode != STILL_ACTIVE) {
|
||||||
|
ILog("[DLL injection] Process crashed, exit code: 0x%x\n", exitcode);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MANUAL_MAPPING_DATA data_checked{ 0 };
|
||||||
|
ReadProcessMemory(hProc, MappingDataAlloc, &data_checked, sizeof(data_checked), nullptr);
|
||||||
|
hCheck = data_checked.hMod;
|
||||||
|
|
||||||
|
if (hCheck == (HINSTANCE)0x404040) {
|
||||||
|
ILog("[DLL injection] Wrong mapping ptr.\n");
|
||||||
|
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
||||||
|
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (hCheck == (HINSTANCE)0x505050) {
|
||||||
|
ILog("[DLL injection] WARNING: Exception support failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
Sleep(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
BYTE* emptyBuffer = (BYTE*)malloc(1024 * 1024 * 20);
|
||||||
|
if (emptyBuffer == nullptr) {
|
||||||
|
ILog("[DLL injection] Unable to allocate memory\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(emptyBuffer, 0, 1024 * 1024 * 20);
|
||||||
|
|
||||||
|
//CLEAR PE HEAD
|
||||||
|
if (ClearHeader) {
|
||||||
|
if (!WriteProcessMemory(hProc, pTargetBase, emptyBuffer, 0x1000, nullptr)) {
|
||||||
|
ILogError("[DLL injection] WARNING!: Can't clear HEADER\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//END CLEAR PE HEAD
|
||||||
|
|
||||||
|
|
||||||
|
if (ClearNonNeededSections) {
|
||||||
|
pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
||||||
|
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
||||||
|
if (pSectionHeader->Misc.VirtualSize) {
|
||||||
|
if ((SEHExceptionSupport ? 0 : strcmp((char*)pSectionHeader->Name, ".pdata") == 0) ||
|
||||||
|
strcmp((char*)pSectionHeader->Name, ".rsrc") == 0 ||
|
||||||
|
strcmp((char*)pSectionHeader->Name, ".reloc") == 0) {
|
||||||
|
ILog("[DLL injection] Processing %s removal\n", pSectionHeader->Name);
|
||||||
|
if (!WriteProcessMemory(hProc, pTargetBase + pSectionHeader->VirtualAddress, emptyBuffer, pSectionHeader->Misc.VirtualSize, nullptr)) {
|
||||||
|
ILogError("[DLL injection] Can't clear section %s.\n", pSectionHeader->Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AdjustProtections) {
|
||||||
|
pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
||||||
|
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
||||||
|
if (pSectionHeader->Misc.VirtualSize) {
|
||||||
|
DWORD old = 0;
|
||||||
|
DWORD newP = PAGE_READONLY;
|
||||||
|
|
||||||
|
if ((pSectionHeader->Characteristics & IMAGE_SCN_MEM_WRITE) > 0) {
|
||||||
|
newP = PAGE_READWRITE;
|
||||||
|
}
|
||||||
|
else if ((pSectionHeader->Characteristics & IMAGE_SCN_MEM_EXECUTE) > 0) {
|
||||||
|
newP = PAGE_EXECUTE_READ;
|
||||||
|
}
|
||||||
|
if (VirtualProtectEx(hProc, pTargetBase + pSectionHeader->VirtualAddress, pSectionHeader->Misc.VirtualSize, newP, &old)) {
|
||||||
|
ILog("[DLL injection] Section %s set as %lX\n", (char*)pSectionHeader->Name, newP);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ILog("[DLL injection] FAIL: section %s not set as %lX\n", (char*)pSectionHeader->Name, newP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DWORD old = 0;
|
||||||
|
VirtualProtectEx(hProc, pTargetBase, IMAGE_FIRST_SECTION(pOldNtHeader)->VirtualAddress, PAGE_READONLY, &old);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WriteProcessMemory(hProc, pShellcode, emptyBuffer, 0x1000, nullptr)) {
|
||||||
|
ILog("[DLL injection] WARNING: Can't clear shellcode\n");
|
||||||
|
}
|
||||||
|
if (!VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE)) {
|
||||||
|
ILog("[DLL injection] WARNING: can't release shell code memory\n");
|
||||||
|
}
|
||||||
|
if (!VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE)) {
|
||||||
|
ILog("[DLL injection] WARNING: can't release mapping data memory\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RELOC_FLAG32(RelInfo) ((RelInfo >> 0x0C) == IMAGE_REL_BASED_HIGHLOW)
|
||||||
|
#define RELOC_FLAG64(RelInfo) ((RelInfo >> 0x0C) == IMAGE_REL_BASED_DIR64)
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
#define RELOC_FLAG RELOC_FLAG64
|
||||||
|
#else
|
||||||
|
#define RELOC_FLAG RELOC_FLAG32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma runtime_checks( "", off )
|
||||||
|
#pragma optimize( "", off )
|
||||||
|
void __stdcall Shellcode(MANUAL_MAPPING_DATA* pData) {
|
||||||
|
if (!pData) {
|
||||||
|
pData->hMod = (HINSTANCE)0x404040;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BYTE* pBase = pData->pbase;
|
||||||
|
auto* pOpt = &reinterpret_cast<IMAGE_NT_HEADERS*>(pBase + reinterpret_cast<IMAGE_DOS_HEADER*>((uintptr_t)pBase)->e_lfanew)->OptionalHeader;
|
||||||
|
|
||||||
|
auto _LoadLibraryA = pData->pLoadLibraryA;
|
||||||
|
auto _GetProcAddress = pData->pGetProcAddress;
|
||||||
|
#ifdef _WIN64
|
||||||
|
auto _RtlAddFunctionTable = pData->pRtlAddFunctionTable;
|
||||||
|
#endif
|
||||||
|
auto _DllMain = reinterpret_cast<f_DLL_ENTRY_POINT>(pBase + pOpt->AddressOfEntryPoint);
|
||||||
|
|
||||||
|
BYTE* LocationDelta = pBase - pOpt->ImageBase;
|
||||||
|
if (LocationDelta) {
|
||||||
|
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size) {
|
||||||
|
auto* pRelocData = reinterpret_cast<IMAGE_BASE_RELOCATION*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress);
|
||||||
|
const auto* pRelocEnd = reinterpret_cast<IMAGE_BASE_RELOCATION*>(reinterpret_cast<uintptr_t>(pRelocData) + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size);
|
||||||
|
while (pRelocData < pRelocEnd && pRelocData->SizeOfBlock) {
|
||||||
|
UINT AmountOfEntries = (pRelocData->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD);
|
||||||
|
WORD* pRelativeInfo = reinterpret_cast<WORD*>(pRelocData + 1);
|
||||||
|
|
||||||
|
for (UINT i = 0; i != AmountOfEntries; ++i, ++pRelativeInfo) {
|
||||||
|
if (RELOC_FLAG(*pRelativeInfo)) {
|
||||||
|
UINT_PTR* pPatch = reinterpret_cast<UINT_PTR*>(pBase + pRelocData->VirtualAddress + ((*pRelativeInfo) & 0xFFF));
|
||||||
|
*pPatch += reinterpret_cast<UINT_PTR>(LocationDelta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pRelocData = reinterpret_cast<IMAGE_BASE_RELOCATION*>(reinterpret_cast<BYTE*>(pRelocData) + pRelocData->SizeOfBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size) {
|
||||||
|
auto* pImportDescr = reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
|
||||||
|
while (pImportDescr->Name) {
|
||||||
|
char* szMod = reinterpret_cast<char*>(pBase + pImportDescr->Name);
|
||||||
|
HINSTANCE hDll = _LoadLibraryA(szMod);
|
||||||
|
|
||||||
|
ULONG_PTR* pThunkRef = reinterpret_cast<ULONG_PTR*>(pBase + pImportDescr->OriginalFirstThunk);
|
||||||
|
ULONG_PTR* pFuncRef = reinterpret_cast<ULONG_PTR*>(pBase + pImportDescr->FirstThunk);
|
||||||
|
|
||||||
|
if (!pThunkRef)
|
||||||
|
pThunkRef = pFuncRef;
|
||||||
|
|
||||||
|
for (; *pThunkRef; ++pThunkRef, ++pFuncRef) {
|
||||||
|
if (IMAGE_SNAP_BY_ORDINAL(*pThunkRef)) {
|
||||||
|
*pFuncRef = (ULONG_PTR)_GetProcAddress(hDll, reinterpret_cast<char*>(*pThunkRef & 0xFFFF));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
auto* pImport = reinterpret_cast<IMAGE_IMPORT_BY_NAME*>(pBase + (*pThunkRef));
|
||||||
|
*pFuncRef = (ULONG_PTR)_GetProcAddress(hDll, pImport->Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++pImportDescr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size) {
|
||||||
|
auto* pTLS = reinterpret_cast<IMAGE_TLS_DIRECTORY*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress);
|
||||||
|
auto* pCallback = reinterpret_cast<PIMAGE_TLS_CALLBACK*>(pTLS->AddressOfCallBacks);
|
||||||
|
for (; pCallback && *pCallback; ++pCallback)
|
||||||
|
(*pCallback)(pBase, DLL_PROCESS_ATTACH, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExceptionSupportFailed = false;
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
|
||||||
|
if (pData->SEHSupport) {
|
||||||
|
auto excep = pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION];
|
||||||
|
if (excep.Size) {
|
||||||
|
if (!_RtlAddFunctionTable(
|
||||||
|
reinterpret_cast<IMAGE_RUNTIME_FUNCTION_ENTRY*>(pBase + excep.VirtualAddress),
|
||||||
|
excep.Size / sizeof(IMAGE_RUNTIME_FUNCTION_ENTRY), (DWORD64)pBase)) {
|
||||||
|
ExceptionSupportFailed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_DllMain(pBase, pData->fdwReasonParam, nullptr);
|
||||||
|
|
||||||
|
if (ExceptionSupportFailed)
|
||||||
|
pData->hMod = reinterpret_cast<HINSTANCE>(0x505050);
|
||||||
|
else
|
||||||
|
pData->hMod = reinterpret_cast<HINSTANCE>(pBase);
|
||||||
|
}
|
4
cheat-base/src/cheat-base/inject/manual-map.h
Normal file
4
cheat-base/src/cheat-base/inject/manual-map.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
bool ManualMapDLL(HANDLE hProc, const std::string& filepath);
|
||||||
|
bool ManualMapDLL(HANDLE hProc, BYTE* pSrcData, SIZE_T FileSize, bool ClearHeader = false, bool ClearNonNeededSections = false, bool AdjustProtections = true, bool SEHExceptionSupport = false, DWORD fdwReason = DLL_PROCESS_ATTACH);
|
BIN
cheat-base/vendor/detours/detours-x64.lib
vendored
BIN
cheat-base/vendor/detours/detours-x64.lib
vendored
Binary file not shown.
BIN
cheat-base/vendor/detours/detours-x86.lib
vendored
Normal file
BIN
cheat-base/vendor/detours/detours-x86.lib
vendored
Normal file
Binary file not shown.
@ -40,15 +40,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\PacketParser.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\GenshinCM.h" />
|
<ClInclude Include="src\user\cheat\GenshinCM.h" />
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\SnifferWindow.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\teleport\CustomTeleports.h" />
|
<ClInclude Include="src\user\cheat\teleport\CustomTeleports.h" />
|
||||||
<ClInclude Include="src\user\cheat\visuals\Browser.h" />
|
<ClInclude Include="src\user\cheat\visuals\Browser.h" />
|
||||||
<ClInclude Include="src\user\cheat\visuals\CameraZoom.h" />
|
<ClInclude Include="src\user\cheat\visuals\CameraZoom.h" />
|
||||||
@ -93,18 +85,10 @@
|
|||||||
<ClInclude Include="src\user\cheat\misc\Debug.h" />
|
<ClInclude Include="src\user\cheat\misc\Debug.h" />
|
||||||
<ClInclude Include="src\user\cheat\misc\Hotkeys.h" />
|
<ClInclude Include="src\user\cheat\misc\Hotkeys.h" />
|
||||||
<ClInclude Include="src\user\cheat\misc\ProtectionBypass.h" />
|
<ClInclude Include="src\user\cheat\misc\ProtectionBypass.h" />
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\PacketInfo.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\PacketSniffer.h">
|
<ClInclude Include="src\user\cheat\misc\sniffer\PacketSniffer.h">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\ProtoManager.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\native.h" />
|
<ClInclude Include="src\user\cheat\native.h" />
|
||||||
<ClInclude Include="src\user\cheat\player\GodMode.h" />
|
<ClInclude Include="src\user\cheat\player\GodMode.h" />
|
||||||
<ClInclude Include="src\user\cheat\player\InfiniteStamina.h" />
|
<ClInclude Include="src\user\cheat\player\InfiniteStamina.h" />
|
||||||
@ -154,14 +138,6 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\PacketParser.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\SnifferWindow.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\teleport\CustomTeleports.cpp" />
|
<ClCompile Include="src\user\cheat\teleport\CustomTeleports.cpp" />
|
||||||
<ClCompile Include="src\user\cheat\GenshinCM.cpp" />
|
<ClCompile Include="src\user\cheat\GenshinCM.cpp" />
|
||||||
<ClCompile Include="src\user\cheat\visuals\Browser.cpp" />
|
<ClCompile Include="src\user\cheat\visuals\Browser.cpp" />
|
||||||
@ -204,18 +180,10 @@
|
|||||||
<ClCompile Include="src\user\cheat\misc\Debug.cpp" />
|
<ClCompile Include="src\user\cheat\misc\Debug.cpp" />
|
||||||
<ClCompile Include="src\user\cheat\misc\Hotkeys.cpp" />
|
<ClCompile Include="src\user\cheat\misc\Hotkeys.cpp" />
|
||||||
<ClCompile Include="src\user\cheat\misc\ProtectionBypass.cpp" />
|
<ClCompile Include="src\user\cheat\misc\ProtectionBypass.cpp" />
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\PacketInfo.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\PacketSniffer.cpp">
|
<ClCompile Include="src\user\cheat\misc\sniffer\PacketSniffer.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\ProtoManager.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\native.cpp" />
|
<ClCompile Include="src\user\cheat\native.cpp" />
|
||||||
<ClCompile Include="src\user\cheat\player\GodMode.cpp" />
|
<ClCompile Include="src\user\cheat\player\GodMode.cpp" />
|
||||||
<ClCompile Include="src\user\cheat\player\InfiniteStamina.cpp" />
|
<ClCompile Include="src\user\cheat\player\InfiniteStamina.cpp" />
|
||||||
@ -871,8 +839,8 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<TargetName>CLibrary</TargetName>
|
<TargetName>CLibrary</TargetName>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
<CustomBuildBeforeTargets>Run</CustomBuildBeforeTargets>
|
<CustomBuildBeforeTargets>Run</CustomBuildBeforeTargets>
|
||||||
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
|
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
|
||||||
<CustomBuildAfterTargets>FinalizeBuildStatus</CustomBuildAfterTargets>
|
<CustomBuildAfterTargets>FinalizeBuildStatus</CustomBuildAfterTargets>
|
||||||
@ -880,8 +848,8 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<TargetName>CLibrary</TargetName>
|
<TargetName>CLibrary</TargetName>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
<CustomBuildBeforeTargets>Run</CustomBuildBeforeTargets>
|
<CustomBuildBeforeTargets>Run</CustomBuildBeforeTargets>
|
||||||
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
|
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
|
||||||
<CustomBuildAfterTargets>FinalizeBuildStatus</CustomBuildAfterTargets>
|
<CustomBuildAfterTargets>FinalizeBuildStatus</CustomBuildAfterTargets>
|
||||||
@ -889,8 +857,8 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<TargetName>CLibrary</TargetName>
|
<TargetName>CLibrary</TargetName>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
<CustomBuildBeforeTargets>Run</CustomBuildBeforeTargets>
|
<CustomBuildBeforeTargets>Run</CustomBuildBeforeTargets>
|
||||||
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
|
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
|
||||||
<CustomBuildAfterTargets>FinalizeBuildStatus</CustomBuildAfterTargets>
|
<CustomBuildAfterTargets>FinalizeBuildStatus</CustomBuildAfterTargets>
|
||||||
@ -911,6 +879,7 @@
|
|||||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@ -949,6 +918,7 @@ powershell -nop -c "& {sleep 15}"</Command>
|
|||||||
<SupportJustMyCode>false</SupportJustMyCode>
|
<SupportJustMyCode>false</SupportJustMyCode>
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@ -986,6 +956,7 @@ powershell -nop -c "& {sleep 15}"</Command>
|
|||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<DiagnosticsFormat>Classic</DiagnosticsFormat>
|
<DiagnosticsFormat>Classic</DiagnosticsFormat>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -48,15 +48,9 @@
|
|||||||
<ClInclude Include="src\framework\pch-il2cpp.h">
|
<ClInclude Include="src\framework\pch-il2cpp.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\PacketInfo.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\PacketSniffer.h">
|
<ClInclude Include="src\user\cheat\misc\sniffer\PacketSniffer.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\ProtoManager.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\misc\Debug.h">
|
<ClInclude Include="src\user\cheat\misc\Debug.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -195,12 +189,6 @@
|
|||||||
<ClInclude Include="src\user\cheat\visuals\CameraZoom.h">
|
<ClInclude Include="src\user\cheat\visuals\CameraZoom.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\SnifferWindow.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\PacketParser.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\user\cheat\misc\sniffer\messages\MessageBase.h">
|
<ClInclude Include="src\user\cheat\misc\sniffer\messages\MessageBase.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -255,15 +243,9 @@
|
|||||||
<ClCompile Include="src\framework\pch-il2cpp.cpp">
|
<ClCompile Include="src\framework\pch-il2cpp.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\PacketInfo.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\PacketSniffer.cpp">
|
<ClCompile Include="src\user\cheat\misc\sniffer\PacketSniffer.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\ProtoManager.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\misc\Debug.cpp">
|
<ClCompile Include="src\user\cheat\misc\Debug.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -390,12 +372,6 @@
|
|||||||
<ClCompile Include="src\user\cheat\visuals\CameraZoom.cpp">
|
<ClCompile Include="src\user\cheat\visuals\CameraZoom.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\SnifferWindow.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\PacketParser.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\user\cheat\misc\sniffer\messages\MessageBase.cpp">
|
<ClCompile Include="src\user\cheat\misc\sniffer\messages\MessageBase.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -11651,6 +11651,16 @@ namespace app {
|
|||||||
struct Browser__Fields fields;
|
struct Browser__Fields fields;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Button_1 {
|
||||||
|
struct Button_1__Class* klass;
|
||||||
|
MonitorData* monitor;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Slider_1 {
|
||||||
|
struct Slider_1__Class* klass;
|
||||||
|
MonitorData* monitor;
|
||||||
|
};
|
||||||
|
|
||||||
#if !defined(_GHIDRA_) && !defined(_IDA_)
|
#if !defined(_GHIDRA_) && !defined(_IDA_)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,6 +45,9 @@ namespace sniffer
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
auto messagePtr = ReceiveMessage();
|
auto messagePtr = ReceiveMessage();
|
||||||
|
if (messagePtr == nullptr)
|
||||||
|
return {};
|
||||||
|
|
||||||
if (GetMessageIDByType<TMessage>() != messagePtr->messageID())
|
if (GetMessageIDByType<TMessage>() != messagePtr->messageID())
|
||||||
{
|
{
|
||||||
delete messagePtr;
|
delete messagePtr;
|
||||||
|
@ -1,145 +0,0 @@
|
|||||||
#include "pch-il2cpp.h"
|
|
||||||
#include "PacketInfo.h"
|
|
||||||
|
|
||||||
#include <misc/cpp/imgui_stdlib.h>
|
|
||||||
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
PacketInfo::PacketInfo(PacketData packetData)
|
|
||||||
: m_Data(packetData),
|
|
||||||
m_JObject(nlohmann::json::parse(packetData.messageJson)),
|
|
||||||
m_Time(util::GetCurrentTimeMillisec()),
|
|
||||||
m_DrawBeauty(false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PacketIOType PacketInfo::type() const
|
|
||||||
{
|
|
||||||
return m_Data.ioType;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t PacketInfo::id() const
|
|
||||||
{
|
|
||||||
return m_Data.messageID;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t PacketInfo::size() const
|
|
||||||
{
|
|
||||||
return m_Data.messageRawData.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t PacketInfo::time() const
|
|
||||||
{
|
|
||||||
return m_Time;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PacketInfo::name() const
|
|
||||||
{
|
|
||||||
return m_Data.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
nlohmann::json PacketInfo::object() const
|
|
||||||
{
|
|
||||||
return m_JObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawPrimitive(const std::string& key, nlohmann::json& jsonPrimitive)
|
|
||||||
{
|
|
||||||
if (jsonPrimitive.is_boolean())
|
|
||||||
{
|
|
||||||
bool primitive = jsonPrimitive;
|
|
||||||
ImGui::Checkbox(key.c_str(), &primitive);
|
|
||||||
}
|
|
||||||
else if (jsonPrimitive.is_number_integer() || jsonPrimitive.is_number_unsigned())
|
|
||||||
{
|
|
||||||
int primitive = jsonPrimitive;
|
|
||||||
ImGui::InputInt(key.c_str(), &primitive);
|
|
||||||
}
|
|
||||||
else if (jsonPrimitive.is_number_float())
|
|
||||||
{
|
|
||||||
float primitive = jsonPrimitive;
|
|
||||||
ImGui::InputFloat(key.c_str(), &primitive);
|
|
||||||
}
|
|
||||||
else if (jsonPrimitive.is_string())
|
|
||||||
{
|
|
||||||
std::string primitive = jsonPrimitive;
|
|
||||||
ImGui::InputText(key.c_str(), &primitive);
|
|
||||||
}
|
|
||||||
else if (jsonPrimitive.is_null())
|
|
||||||
{
|
|
||||||
ImGui::Text("%s: <null>", key.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawObject(const std::string& key, nlohmann::json& jsonObject);
|
|
||||||
|
|
||||||
void DrawArray(const std::string& key, nlohmann::json& jsonArray)
|
|
||||||
{
|
|
||||||
ImGui::PushID(key.c_str());
|
|
||||||
|
|
||||||
if (ImGui::TreeNode(key.c_str()))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
for (auto& el : jsonArray)
|
|
||||||
{
|
|
||||||
DrawObject(std::to_string(i), el);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::PopID();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawObject(const std::string& key, nlohmann::json& jsonObject)
|
|
||||||
{
|
|
||||||
if (jsonObject.is_array())
|
|
||||||
DrawArray(key, jsonObject);
|
|
||||||
else if (jsonObject.is_primitive())
|
|
||||||
DrawPrimitive(key, jsonObject);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::PushID(key.c_str());
|
|
||||||
|
|
||||||
if (ImGui::TreeNode(key.c_str()))
|
|
||||||
{
|
|
||||||
for (auto& el : jsonObject.items())
|
|
||||||
DrawObject(el.key(), el.value());
|
|
||||||
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::PopID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacketInfo::Draw()
|
|
||||||
{
|
|
||||||
ImGui::PushID(this);
|
|
||||||
|
|
||||||
if (m_Header.empty())
|
|
||||||
m_Header = fmt::format("[{}] {} | {}. Size: {}", magic_enum::enum_name(type()), id(), name(), size());
|
|
||||||
|
|
||||||
if (ImGui::TreeNode(m_Header.c_str()))
|
|
||||||
{
|
|
||||||
if (ImGui::Checkbox("## Beauty", &m_DrawBeauty) && m_DrawBeauty && m_JsonMessageBeauty.empty())
|
|
||||||
{
|
|
||||||
m_JsonMessageBeauty = m_JObject.dump(2);
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
if (m_DrawBeauty)
|
|
||||||
ImGui::InputTextMultiline("JSON Message", &m_JsonMessageBeauty);
|
|
||||||
else
|
|
||||||
ImGui::InputText("JSON Message", &m_Data.messageJson);
|
|
||||||
|
|
||||||
|
|
||||||
DrawObject("Data", m_JObject);
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::PopID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
#include "messages/PacketData.h"
|
|
||||||
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
class PacketInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PacketInfo(PacketData packetData);
|
|
||||||
|
|
||||||
PacketIOType type() const;
|
|
||||||
uint32_t id() const;
|
|
||||||
size_t size() const;
|
|
||||||
int64_t time() const;
|
|
||||||
std::string name() const;
|
|
||||||
nlohmann::json object() const;
|
|
||||||
|
|
||||||
void Draw();
|
|
||||||
|
|
||||||
private:
|
|
||||||
nlohmann::json m_JObject;
|
|
||||||
int64_t m_Time;
|
|
||||||
|
|
||||||
bool m_DrawBeauty;
|
|
||||||
std::string m_JsonMessageBeauty;
|
|
||||||
std::string m_Header;
|
|
||||||
|
|
||||||
PacketData m_Data;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,240 +0,0 @@
|
|||||||
#include "pch-il2cpp.h"
|
|
||||||
#include "PacketParser.h"
|
|
||||||
|
|
||||||
#include "MessageManager.h"
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
|
|
||||||
PacketParser::PacketParser(const std::string& protoDirPath, const std::string& protoIDPath)
|
|
||||||
: m_ProtoManager()
|
|
||||||
{
|
|
||||||
m_ProtoManager.Load(protoIDPath, protoDirPath);
|
|
||||||
UpdateUnionPacketIDs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacketParser::SetProtoDir(const std::string& protoDir)
|
|
||||||
{
|
|
||||||
m_ProtoManager.LoadProtoDir(protoDir);
|
|
||||||
UpdateUnionPacketIDs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacketParser::SetProtoIDPath(const std::string& protoIDPath)
|
|
||||||
{
|
|
||||||
m_ProtoManager.LoadProtoDir(protoIDPath);
|
|
||||||
UpdateUnionPacketIDs();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PacketParser::Parse(PacketData& data)
|
|
||||||
{
|
|
||||||
auto name = m_ProtoManager.GetName(data.messageID);
|
|
||||||
if (!name)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto head = m_ProtoManager.GetJson("PacketHead", data.headRawData);
|
|
||||||
if (!head)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto message = m_ProtoManager.GetJson(data.messageID, data.messageRawData);
|
|
||||||
if (!message)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
data.name = *name;
|
|
||||||
data.headJson = *head;
|
|
||||||
data.messageJson = *message;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PacketParser::IsUnionPacket(const PacketData& data)
|
|
||||||
{
|
|
||||||
return m_UnionPacketIds.count(data.messageID) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PacketData> PacketParser::ParseUnionPacket(const PacketData& data)
|
|
||||||
{
|
|
||||||
if (!IsUnionPacket(data))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
auto parseFunction = m_UnionPacketIds[data.messageID];
|
|
||||||
return (this->*parseFunction)(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
PacketData PacketParser::CreateNestedPacket(const PacketData& parent, std::string bodyEncoded, int16_t packetID)
|
|
||||||
{
|
|
||||||
PacketData nestedPacketData = MessageManager::CreateMessage<PacketData>();
|
|
||||||
nestedPacketData.headRawData = parent.headRawData;
|
|
||||||
nestedPacketData.headJson = parent.headJson;
|
|
||||||
nestedPacketData.messageRawData = util::base64_decode(bodyEncoded);
|
|
||||||
nestedPacketData.messageID = packetID;
|
|
||||||
nestedPacketData.valid = true;
|
|
||||||
nestedPacketData.ioType = parent.ioType;
|
|
||||||
nestedPacketData.parentPacketID = parent.sequenceID();
|
|
||||||
|
|
||||||
if (packetID != 0)
|
|
||||||
Parse(nestedPacketData);
|
|
||||||
|
|
||||||
return nestedPacketData;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PacketData> PacketParser::ParseUnionCmdNotify(const PacketData& data)
|
|
||||||
{
|
|
||||||
nlohmann::json cmdListObject = nlohmann::json::parse(data.messageJson);
|
|
||||||
|
|
||||||
std::vector<PacketData> packets;
|
|
||||||
for (auto& cmd : cmdListObject["cmdList"])
|
|
||||||
{
|
|
||||||
auto nestedPacketData = CreateNestedPacket(data, cmd["body"], cmd["messageId"]);
|
|
||||||
packets.push_back(nestedPacketData);
|
|
||||||
|
|
||||||
if (IsUnionPacket(nestedPacketData))
|
|
||||||
{
|
|
||||||
auto nestedNestedPackets = ParseUnionPacket(nestedPacketData);
|
|
||||||
packets.insert(packets.end(), nestedNestedPackets.begin(), nestedNestedPackets.end());
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return packets;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<PacketData> PacketParser::ParseAbilityInvokeEntry(const PacketData& parent, const nlohmann::json& entry)
|
|
||||||
{
|
|
||||||
static std::map<std::string, std::string> abilityArgument2Proto =
|
|
||||||
{
|
|
||||||
{ "ABILITY_META_MODIFIER_CHANGE", "AbilityMetaModifierChange" },
|
|
||||||
{ "ABILITY_META_COMMAND_MODIFIER_CHANGE_REQUEST", "AbilityMetaCommandModifierChangeRequest" },
|
|
||||||
{ "ABILITY_META_SPECIAL_FLOAT_ARGUMENT", "AbilityMetaSpecialFloatArgument" },
|
|
||||||
{ "ABILITY_META_OVERRIDE_PARAM", "AbilityMetaOverrideParam" },
|
|
||||||
{ "ABILITY_META_CLEAR_OVERRIDE_PARAM", "AbilityMetaClearOverrideParam" },
|
|
||||||
{ "ABILITY_META_REINIT_OVERRIDEMAP", "AbilityMetaReinitOverridemap" },
|
|
||||||
{ "ABILITY_META_GLOBAL_FLOAT_VALUE", "AbilityMetaGlobalFloatValue" },
|
|
||||||
{ "ABILITY_META_CLEAR_GLOBAL_FLOAT_VALUE", "AbilityMetaClearGlobalFloatValue" },
|
|
||||||
{ "ABILITY_META_ABILITY_ELEMENT_STRENGTH", "AbilityMetaAbilityElementStrength" },
|
|
||||||
{ "ABILITY_META_ADD_OR_GET_ABILITY_AND_TRIGGER", "AbilityMetaAddOrGetAbilityAndTrigger" },
|
|
||||||
{ "ABILITY_META_SET_KILLED_SETATE", "AbilityMetaSetKilledSetate" },
|
|
||||||
{ "ABILITY_META_SET_ABILITY_TRIGGER", "AbilityMetaSetAbilityTrigger" },
|
|
||||||
{ "ABILITY_META_ADD_NEW_ABILITY", "AbilityMetaAddNewAbility" },
|
|
||||||
{ "ABILITY_META_REMOVE_ABILITY", "AbilityMetaRemoveAbility" },
|
|
||||||
{ "ABILITY_META_SET_MODIFIER_APPLY_ENTITY", "AbilityMetaSetModifierApplyEntity" },
|
|
||||||
{ "ABILITY_META_MODIFIER_DURABILITY_CHANGE", "AbilityMetaModifierDurabilityChange" },
|
|
||||||
{ "ABILITY_META_ELEMENT_REACTION_VISUAL", "AbilityMetaElementReactionVisual" },
|
|
||||||
{ "ABILITY_META_SET_POSE_PARAMETER", "AbilityMetaSetPoseParameter" },
|
|
||||||
{ "ABILITY_META_UPDATE_BASE_REACTION_DAMAGE", "AbilityMetaUpdateBaseReactionDamage" },
|
|
||||||
{ "ABILITY_META_TRIGGER_ELEMENT_REACTION", "AbilityMetaTriggerElementReaction" },
|
|
||||||
{ "ABILITY_META_LOSE_HP", "AbilityMetaLoseHp" },
|
|
||||||
{ "ABILITY_ACTION_TRIGGER_ABILITY", "AbilityActionTriggerAbility" },
|
|
||||||
{ "ABILITY_ACTION_SET_CRASH_DAMAGE", "AbilityActionSetCrashDamage" },
|
|
||||||
{ "ABILITY_ACTION_EFFECT", "AbilityActionEffect" },
|
|
||||||
{ "ABILITY_ACTION_SUMMON", "AbilityActionSummon" },
|
|
||||||
{ "ABILITY_ACTION_BLINK", "AbilityActionBlink" },
|
|
||||||
{ "ABILITY_ACTION_CREATE_GADGET", "AbilityActionCreateGadget" },
|
|
||||||
{ "ABILITY_ACTION_APPLY_LEVEL_MODIFIER", "AbilityActionApplyLevelModifier" },
|
|
||||||
{ "ABILITY_ACTION_GENERATE_ELEM_BALL", "AbilityActionGenerateElemBall" },
|
|
||||||
{ "ABILITY_ACTION_SET_RANDOM_OVERRIDE_MAP_VALUE", "AbilityActionSetRandomOverrideMapValue" },
|
|
||||||
{ "ABILITY_ACTION_SERVER_MONSTER_LOG", "AbilityActionServerMonsterLog" },
|
|
||||||
{ "ABILITY_ACTION_CREATE_TILE", "AbilityActionCreateTile" },
|
|
||||||
{ "ABILITY_ACTION_DESTROY_TILE", "AbilityActionDestroyTile" },
|
|
||||||
{ "ABILITY_ACTION_FIRE_AFTER_IMAGE", "AbilityActionFireAfterImage" },
|
|
||||||
{ "ABILITY_MIXIN_AVATAR_STEER_BY_CAMERA", "AbilityMixinAvatarSteerByCamera" },
|
|
||||||
{ "ABILITY_MIXIN_MONSTER_DEFEND", "AbilityMixinMonsterDefend" },
|
|
||||||
{ "ABILITY_MIXIN_WIND_ZONE", "AbilityMixinWindZone" },
|
|
||||||
{ "ABILITY_MIXIN_COST_STAMINA", "AbilityMixinCostStamina" },
|
|
||||||
{ "ABILITY_MIXIN_ELITE_SHIELD", "AbilityMixinEliteShield" },
|
|
||||||
{ "ABILITY_MIXIN_ELEMENT_SHIELD", "AbilityMixinElementShield" },
|
|
||||||
{ "ABILITY_MIXIN_GLOBAL_SHIELD", "AbilityMixinGlobalShield" },
|
|
||||||
{ "ABILITY_MIXIN_SHIELD_BAR", "AbilityMixinShieldBar" },
|
|
||||||
{ "ABILITY_MIXIN_WIND_SEED_SPAWNER", "AbilityMixinWindSeedSpawner" },
|
|
||||||
{ "ABILITY_MIXIN_DO_ACTION_BY_ELEMENT_REACTION", "AbilityMixinDoActionByElementReaction" },
|
|
||||||
{ "ABILITY_MIXIN_FIELD_ENTITY_COUNT_CHANGE", "AbilityMixinFieldEntityCountChange" },
|
|
||||||
{ "ABILITY_MIXIN_SCENE_PROP_SYNC", "AbilityMixinScenePropSync" },
|
|
||||||
{ "ABILITY_MIXIN_WIDGET_MP_SUPPORT", "AbilityMixinWidgetMpSupport" }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (entry.count("abilityData") == 0 || entry.count("argumentType") == 0)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
std::string argumentType = entry["argumentType"];
|
|
||||||
if (abilityArgument2Proto.count(argumentType) == 0)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
PacketData nestedPacketData = CreateNestedPacket(parent, entry["abilityData"]);
|
|
||||||
nestedPacketData.name = abilityArgument2Proto[argumentType];
|
|
||||||
|
|
||||||
auto jsonData = m_ProtoManager.GetJson(nestedPacketData.name, nestedPacketData.messageRawData);
|
|
||||||
nestedPacketData.messageJson = jsonData ? *jsonData : "{}";
|
|
||||||
return nestedPacketData;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PacketData> PacketParser::ParseAbilityInvocationsNotify(const PacketData& data)
|
|
||||||
{
|
|
||||||
auto combatJsonObject = nlohmann::json::parse(data.messageJson);
|
|
||||||
std::vector<PacketData> packets = {};
|
|
||||||
for (auto& invokeEntry : combatJsonObject["invokes"])
|
|
||||||
{
|
|
||||||
auto abilityPacketData = ParseAbilityInvokeEntry(data, invokeEntry);
|
|
||||||
if (abilityPacketData)
|
|
||||||
packets.push_back(*abilityPacketData);
|
|
||||||
}
|
|
||||||
return packets;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<PacketData> PacketParser::ParseCombatInvokeEntry(const PacketData& parent, const nlohmann::json& entry)
|
|
||||||
{
|
|
||||||
static std::map<std::string, std::string> combateTypeProtos = {
|
|
||||||
{ "ENTITY_MOVE", "EntityMoveInfo" },
|
|
||||||
{ "COMBAT_EVT_BEING_HIT", "EvtBeingHitInfo" },
|
|
||||||
{ "COMBAT_ANIMATOR_STATE_CHANGED", "EvtAnimatorStateChangedInfo" },
|
|
||||||
{ "COMBAT_FACE_TO_DIR", "EvtFaceToDirInfo" },
|
|
||||||
{ "COMBAT_SET_ATTACK_TARGET", "EvtSetAttackTargetInfo" },
|
|
||||||
{ "COMBAT_RUSH_MOVE", "EvtRushMoveInfo" },
|
|
||||||
{ "COMBAT_ANIMATOR_PARAMETER_CHANGED", "EvtAnimatorParameterInfo" },
|
|
||||||
{ "SYNC_ENTITY_POSITION", "EvtSyncEntityPositionInfo" },
|
|
||||||
{ "COMBAT_STEER_MOTION_INFO", "EvtCombatSteerMotionInfo" },
|
|
||||||
{ "COMBAT_FORCE_SET_POSITION_INFO", "EvtCombatForceSetPosInfo" },
|
|
||||||
{ "COMBAT_FORCE_SET_POS_INFO", "EvtCombatForceSetPosInfo" },
|
|
||||||
{ "COMBAT_COMPENSATE_POS_DIFF", "EvtCompensatePosDiffInfo" },
|
|
||||||
{ "COMBAT_MONSTER_DO_BLINK", "EvtMonsterDoBlink" },
|
|
||||||
{ "COMBAT_FIXED_RUSH_MOVE", "EvtFixedRushMove" },
|
|
||||||
{ "COMBAT_SYNC_TRANSFORM", "EvtSyncTransform" },
|
|
||||||
{ "COMBAT_LIGHT_CORE_MOVE", "EvtLightCoreMove" }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!entry["argumentType"].is_string())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
std::string argumentType = entry["argumentType"];
|
|
||||||
|
|
||||||
if (combateTypeProtos.count(argumentType) == 0)
|
|
||||||
{
|
|
||||||
LOG_WARNING("Failed to find argument type %s", argumentType.c_str());
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
PacketData nestedPacketData = CreateNestedPacket(parent, entry["combatData"]);
|
|
||||||
nestedPacketData.name = combateTypeProtos[argumentType];
|
|
||||||
|
|
||||||
auto jsonData = m_ProtoManager.GetJson(nestedPacketData.name, nestedPacketData.messageRawData);
|
|
||||||
nestedPacketData.messageJson = jsonData ? *jsonData : "{}";
|
|
||||||
return nestedPacketData;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PacketData> PacketParser::ParseCombatInvocationsNotify(const PacketData& data)
|
|
||||||
{
|
|
||||||
auto combatJsonObject = nlohmann::json::parse(data.messageJson);
|
|
||||||
std::vector<PacketData> packets = {};
|
|
||||||
for (auto& invokeEntry : combatJsonObject["invokeList"])
|
|
||||||
{
|
|
||||||
auto combatPacketData = ParseCombatInvokeEntry(data, invokeEntry);
|
|
||||||
if (combatPacketData)
|
|
||||||
packets.push_back(*combatPacketData);
|
|
||||||
}
|
|
||||||
return packets;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacketParser::UpdateUnionPacketIDs()
|
|
||||||
{
|
|
||||||
m_UnionPacketIds.clear();
|
|
||||||
for (auto& [unionPacketName, parserFunc] : s_UnionPacketNames)
|
|
||||||
{
|
|
||||||
m_UnionPacketIds[m_ProtoManager.GetId(unionPacketName)] = parserFunc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "messages/PacketData.h"
|
|
||||||
#include "ProtoManager.h"
|
|
||||||
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
class PacketParser
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PacketParser(const std::string& protoDirPath, const std::string& protoIDPath);
|
|
||||||
|
|
||||||
void SetProtoDir(const std::string& protoDir);
|
|
||||||
void SetProtoIDPath(const std::string& protoIDPath);
|
|
||||||
|
|
||||||
bool Parse(PacketData& data);
|
|
||||||
bool IsUnionPacket(const PacketData& data);
|
|
||||||
std::vector<PacketData> ParseUnionPacket(const PacketData& data);
|
|
||||||
|
|
||||||
private:
|
|
||||||
PacketData CreateNestedPacket(const PacketData& parent, std::string bodyEncoded, int16_t packetID = 0);
|
|
||||||
std::vector<PacketData> ParseUnionCmdNotify(const PacketData& data);
|
|
||||||
|
|
||||||
std::optional<PacketData> ParseAbilityInvokeEntry(const PacketData& parent, const nlohmann::json& entry);
|
|
||||||
std::vector<PacketData> ParseAbilityInvocationsNotify(const PacketData& data);
|
|
||||||
|
|
||||||
std::optional<PacketData> ParseCombatInvokeEntry(const PacketData& parent, const nlohmann::json& entry);
|
|
||||||
std::vector<PacketData> ParseCombatInvocationsNotify(const PacketData& data);
|
|
||||||
|
|
||||||
using UnionPacketParserFunc = std::vector<PacketData>(PacketParser::*)(const PacketData& data);
|
|
||||||
inline static std::map<std::string, UnionPacketParserFunc> s_UnionPacketNames =
|
|
||||||
{
|
|
||||||
{ "UnionCmdNotify", &ParseUnionCmdNotify},
|
|
||||||
|
|
||||||
{ "EntityAbilityInvokeEntry", &ParseAbilityInvocationsNotify },
|
|
||||||
{ "ClientAbilityInitFinishNotify", &ParseAbilityInvocationsNotify },
|
|
||||||
{ "ClientAbilityChangeNotify", &ParseAbilityInvocationsNotify },
|
|
||||||
{ "AbilityInvocationsNotify", &ParseAbilityInvocationsNotify },
|
|
||||||
|
|
||||||
{ "CombatInvocationsNotify", &ParseCombatInvocationsNotify}
|
|
||||||
};
|
|
||||||
|
|
||||||
sniffer::ProtoManager m_ProtoManager;
|
|
||||||
std::map<uint32_t, UnionPacketParserFunc> m_UnionPacketIds;
|
|
||||||
|
|
||||||
void UpdateUnionPacketIDs();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -11,18 +11,12 @@
|
|||||||
namespace cheat::feature
|
namespace cheat::feature
|
||||||
{
|
{
|
||||||
PacketSniffer::PacketSniffer() : Feature(),
|
PacketSniffer::PacketSniffer() : Feature(),
|
||||||
NF(m_CapturingEnabled, "Capturing", "PacketSniffer", false),
|
NF(f_CaptureEnabled, "Capturing", "PacketSniffer", false),
|
||||||
NF(m_ManipulationEnabled, "Manipulation", "PacketSniffer", false),
|
NF(f_ManipulationEnabled, "Manipulation", "PacketSniffer", false),
|
||||||
NF(m_PipeEnabled, "Pipe", "PacketSniffer", false)
|
NF(f_PipeName, "Pipe name", "PacketSniffer", "genshin_packet_pipe")
|
||||||
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
, NF(m_ProtoDirPath, "Proto Dir Path", "PacketSniffer", ""),
|
|
||||||
NF(m_ProtoIDFilePath, "Proto ID File Path", "PacketSniffer", ""),
|
|
||||||
m_PacketParser(m_ProtoDirPath, m_ProtoIDFilePath)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
{
|
||||||
sniffer::MessageManager::Connect("genshin_packet_pipe");
|
sniffer::MessageManager::Connect(f_PipeName.value());
|
||||||
|
|
||||||
HookManager::install(app::Kcp_KcpNative_kcp_client_send_packet, KcpNative_kcp_client_send_packet_Hook);
|
HookManager::install(app::Kcp_KcpNative_kcp_client_send_packet, KcpNative_kcp_client_send_packet_Hook);
|
||||||
HookManager::install(app::MoleMole_KcpClient_TryDequeueEvent, KcpClient_TryDequeueEvent_Hook);
|
HookManager::install(app::MoleMole_KcpClient_TryDequeueEvent, KcpClient_TryDequeueEvent_Hook);
|
||||||
@ -34,78 +28,12 @@ namespace cheat::feature
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PacketSniffer::OnCapturingChanged()
|
|
||||||
{
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
if (!m_CapturingEnabled)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (!m_ProtoDirPath.value().empty() && !m_ProtoIDFilePath.value().empty())
|
|
||||||
{
|
|
||||||
m_PacketParser.SetProtoIDPath(m_ProtoIDFilePath);
|
|
||||||
m_PacketParser.SetProtoDir(m_ProtoDirPath);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacketSniffer::DrawMain()
|
void PacketSniffer::DrawMain()
|
||||||
{
|
{
|
||||||
|
ImGui::Text("Dev: for working needs server for named pipe with specified name.\nCheck 'packet-handler' project like example.");
|
||||||
//ImGui::Text("Dev: for working needs server for named pipe 'genshin_packet_pipe'.\nCheck 'packet-handler' project like example.");
|
ConfigWidget(f_PipeName, "Pipe name for connecting. Changes will apply after next game launch.");
|
||||||
if (ConfigWidget(m_CapturingEnabled, "Enabling capturing of packet info and sending to pipe, if it exists."))
|
ConfigWidget(f_CaptureEnabled, "Enable capturing of packet info and sending to pipe, if it exists.");
|
||||||
{
|
ConfigWidget(f_ManipulationEnabled, "Enable blocking and modifying packets by sniffer, can cause network lags.");
|
||||||
bool result = OnCapturingChanged();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
m_CapturingEnabled = false;
|
|
||||||
ImGui::OpenPopup("Error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginPopup("Error"))
|
|
||||||
{
|
|
||||||
ImGui::Text("Please fill 'Proto Dir Path' and 'Proto ID File Path' before enabling capture.");
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
auto& window = sniffer::SnifferWindow::GetInstance();
|
|
||||||
ConfigWidget(window.m_Show, "Show capturing window.");
|
|
||||||
|
|
||||||
ConfigWidget(m_PipeEnabled, "Enable sending of packet data to pipe with name 'genshin_packet_pipe'.\n"\
|
|
||||||
"This feature can be used with external monitoring tools.");
|
|
||||||
//ConfigWidget(m_ManipulationEnabled, "Enabling manipulation packet feature, that allows to replace, block incoming/outcoming packets." \
|
|
||||||
// "\nThis feature often needs, to read-write pipe operation, so can decrease network bandwidth.");
|
|
||||||
|
|
||||||
if (m_CapturingEnabled)
|
|
||||||
{
|
|
||||||
ImGui::Text("These parameters can only be changed when 'Capturing' is disabled.");
|
|
||||||
ImGui::BeginDisabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigWidget(m_ProtoDirPath, "Path to directory containing Genshin .proto files.");
|
|
||||||
ConfigWidget(m_ProtoIDFilePath, "Path to JSON file containing packet id->packet name info.");
|
|
||||||
|
|
||||||
if (m_CapturingEnabled)
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
#else
|
|
||||||
ImGui::Text("When capture is enabled, raw packet data will be send to named pipe: 'genshin_packet_pipe'.");
|
|
||||||
ImGui::Text("'Raw' means that you should to parse protobuf structure by yourself.");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void PacketSniffer::DrawExternal()
|
|
||||||
{
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
auto& window = sniffer::SnifferWindow::GetInstance();
|
|
||||||
if (window.m_Show)
|
|
||||||
window.Draw();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketSniffer& PacketSniffer::GetInstance()
|
PacketSniffer& PacketSniffer::GetInstance()
|
||||||
@ -141,7 +69,10 @@ namespace cheat::feature
|
|||||||
|
|
||||||
bool PacketSniffer::OnPacketIO(app::KcpPacket_1* packet, PacketIOType type)
|
bool PacketSniffer::OnPacketIO(app::KcpPacket_1* packet, PacketIOType type)
|
||||||
{
|
{
|
||||||
if (!m_CapturingEnabled)
|
if (!sniffer::MessageManager::IsConnected())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!f_CaptureEnabled)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PacketData packetData = ParseRawPacketData((char*)packet->data, packet->dataLen);
|
PacketData packetData = ParseRawPacketData((char*)packet->data, packet->dataLen);
|
||||||
@ -149,30 +80,10 @@ namespace cheat::feature
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
packetData.ioType = type;
|
packetData.ioType = type;
|
||||||
packetData.blockModeEnabled = m_ManipulationEnabled;
|
packetData.blockModeEnabled = f_ManipulationEnabled;
|
||||||
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
bool parsed = m_PacketParser.Parse(packetData);
|
|
||||||
if (!parsed)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
sniffer::SnifferWindow::GetInstance().OnPacketIO({packetData});
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sniffer::MessageManager::Send(packetData);
|
sniffer::MessageManager::Send(packetData);
|
||||||
|
|
||||||
bool canceled = m_ManipulationEnabled && ProcessModifiedData(packet);
|
bool canceled = f_ManipulationEnabled && ProcessModifiedData(packet);
|
||||||
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
if (m_PacketParser.IsUnionPacket(packetData))
|
|
||||||
{
|
|
||||||
for (auto& nestedPacketData : m_PacketParser.ParseUnionPacket(packetData))
|
|
||||||
{
|
|
||||||
sniffer::SnifferWindow::GetInstance().OnPacketIO({ nestedPacketData });
|
|
||||||
sniffer::MessageManager::Send(nestedPacketData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return !canceled;
|
return !canceled;
|
||||||
}
|
}
|
||||||
|
@ -12,41 +12,25 @@
|
|||||||
|
|
||||||
#include "MessageManager.h"
|
#include "MessageManager.h"
|
||||||
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
#include "PacketParser.h"
|
|
||||||
#include "PacketInfo.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace cheat::feature
|
namespace cheat::feature
|
||||||
{
|
{
|
||||||
|
|
||||||
class PacketSniffer : public Feature
|
class PacketSniffer : public Feature
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
config::Field<bool> m_CapturingEnabled;
|
config::Field<bool> f_CaptureEnabled;
|
||||||
config::Field<bool> m_ManipulationEnabled;
|
config::Field<bool> f_ManipulationEnabled;
|
||||||
config::Field<bool> m_PipeEnabled;
|
config::Field<std::string> f_PipeName;
|
||||||
|
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
config::Field<std::string> m_ProtoDirPath;
|
|
||||||
config::Field<std::string> m_ProtoIDFilePath;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static PacketSniffer& GetInstance();
|
static PacketSniffer& GetInstance();
|
||||||
|
|
||||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||||
void DrawMain() override;
|
void DrawMain() override;
|
||||||
|
|
||||||
void DrawExternal() final;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef _PACKET_SNIFFER
|
|
||||||
sniffer::PacketParser m_PacketParser;
|
|
||||||
#endif
|
|
||||||
PacketSniffer();
|
PacketSniffer();
|
||||||
PacketData ParseRawPacketData(char* encryptedData, uint32_t length);
|
|
||||||
bool OnCapturingChanged();
|
|
||||||
|
|
||||||
|
PacketData ParseRawPacketData(char* encryptedData, uint32_t length);
|
||||||
static char* EncryptXor(void* content, uint32_t length);
|
static char* EncryptXor(void* content, uint32_t length);
|
||||||
static bool KcpClient_TryDequeueEvent_Hook(void* __this, app::ClientKcpEvent* evt, MethodInfo* method);
|
static bool KcpClient_TryDequeueEvent_Hook(void* __this, app::ClientKcpEvent* evt, MethodInfo* method);
|
||||||
static int32_t KcpNative_kcp_client_send_packet_Hook(void* kcp_client, app::KcpPacket_1* packet, MethodInfo* method);
|
static int32_t KcpNative_kcp_client_send_packet_Hook(void* kcp_client, app::KcpPacket_1* packet, MethodInfo* method);
|
||||||
|
@ -1,125 +0,0 @@
|
|||||||
#include "pch-il2cpp.h"
|
|
||||||
#include "ProtoManager.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
|
|
||||||
class ErrorCollector : public google::protobuf::compiler::MultiFileErrorCollector
|
|
||||||
{
|
|
||||||
// Inherited via MultiFileErrorCollector
|
|
||||||
virtual void AddError(const std::string& filename, int line, int column, const std::string& message) override
|
|
||||||
{
|
|
||||||
LOG_ERROR("Error while parsing %s file, line %d, column %d, error: %s\n", filename.c_str(), line, column, message.c_str());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void ProtoManager::LoadProtoDir(const std::string& dirPath)
|
|
||||||
{
|
|
||||||
const std::lock_guard<std::mutex> lock(_mutex);
|
|
||||||
|
|
||||||
diskTree = std::shared_ptr<google::protobuf::compiler::DiskSourceTree>(new google::protobuf::compiler::DiskSourceTree());
|
|
||||||
if (!dirPath.empty())
|
|
||||||
diskTree->MapPath("", dirPath);
|
|
||||||
|
|
||||||
auto errorCollector = new ErrorCollector();
|
|
||||||
importer = std::shared_ptr<google::protobuf::compiler::Importer>(new google::protobuf::compiler::Importer(diskTree.get(), errorCollector));
|
|
||||||
factory = std::shared_ptr<google::protobuf::DynamicMessageFactory>(new google::protobuf::DynamicMessageFactory(importer->pool()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProtoManager::LoadIDFile(const std::string& filepath)
|
|
||||||
{
|
|
||||||
if (filepath.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const std::lock_guard<std::mutex> lock(_mutex);
|
|
||||||
|
|
||||||
nameMap.clear();
|
|
||||||
|
|
||||||
std::ifstream file;
|
|
||||||
file.open(filepath);
|
|
||||||
if (!file.is_open())
|
|
||||||
{
|
|
||||||
LOG_WARNING("Failed to load proto id file.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto content = nlohmann::json::parse(file);
|
|
||||||
for (nlohmann::json::iterator it = content.begin(); it != content.end(); ++it)
|
|
||||||
{
|
|
||||||
auto id = std::stoi(it.key().c_str());
|
|
||||||
nameMap[id] = it.value();
|
|
||||||
idMap[it.value()] = id;
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
google::protobuf::Message* ProtoManager::ParseMessage(const std::string& name, std::vector<byte> data)
|
|
||||||
{
|
|
||||||
const std::lock_guard<std::mutex> lock(_mutex);
|
|
||||||
|
|
||||||
auto fileDescriptor = importer->Import(name + ".proto");
|
|
||||||
if (fileDescriptor == nullptr || fileDescriptor->message_type_count() == 0)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
auto message = factory->GetPrototype(fileDescriptor->message_type(0))->New();
|
|
||||||
|
|
||||||
std::string stringData((char*)data.data(), data.size());
|
|
||||||
message->ParseFromString(stringData);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProtoManager::ProtoManager() {}
|
|
||||||
|
|
||||||
void ProtoManager::Load(const std::string& idFilePath, const std::string& protoDir)
|
|
||||||
{
|
|
||||||
LoadIDFile(idFilePath);
|
|
||||||
LoadProtoDir(protoDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional <std::string> ProtoManager::GetJson(const std::string& name, std::vector<byte>& data)
|
|
||||||
{
|
|
||||||
auto message = ParseMessage(name, data);
|
|
||||||
if (message == nullptr)
|
|
||||||
{
|
|
||||||
LOG_ERROR("Failed to parse message with name %s.", name.c_str());
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string jsonMessage = {};
|
|
||||||
google::protobuf::util::MessageToJsonString(*message, &jsonMessage);
|
|
||||||
|
|
||||||
delete message;
|
|
||||||
|
|
||||||
return jsonMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string> ProtoManager::GetJson(uint32_t id, std::vector<byte>& data)
|
|
||||||
{
|
|
||||||
auto name = GetName(id);
|
|
||||||
if (!name)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return GetJson(*name, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string> ProtoManager::GetName(uint32_t id)
|
|
||||||
{
|
|
||||||
const std::lock_guard<std::mutex> lock(_mutex);
|
|
||||||
|
|
||||||
if (nameMap.count(id) == 0)
|
|
||||||
{
|
|
||||||
LOG_WARNING("Failed to find proto with id %u", id);
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return nameMap[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t ProtoManager::GetId(const std::string& name)
|
|
||||||
{
|
|
||||||
return idMap.count(name) == 0 ? 0 : idMap[name];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <filesystem>
|
|
||||||
|
|
||||||
#include <google/protobuf/compiler/importer.h>
|
|
||||||
#include <google/protobuf/dynamic_message.h>
|
|
||||||
#include <google/protobuf/message.h>
|
|
||||||
#include <google/protobuf/util/json_util.h>
|
|
||||||
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
class ProtoManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProtoManager();
|
|
||||||
|
|
||||||
std::optional<std::string> GetJson(uint32_t id, std::vector<byte>& data);
|
|
||||||
std::optional<std::string> GetJson(const std::string& name, std::vector<byte>& byte);
|
|
||||||
std::optional<std::string> GetName(uint32_t id);
|
|
||||||
uint16_t GetId(const std::string& name);
|
|
||||||
|
|
||||||
void Load(const std::string& idFilePath, const std::string& protoDir);
|
|
||||||
void LoadIDFile(const std::string& filepath);
|
|
||||||
void LoadProtoDir(const std::string& dirPath);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::mutex _mutex;
|
|
||||||
std::shared_ptr<google::protobuf::compiler::Importer> importer;
|
|
||||||
std::shared_ptr<google::protobuf::DynamicMessageFactory> factory;
|
|
||||||
std::shared_ptr<google::protobuf::compiler::DiskSourceTree> diskTree;
|
|
||||||
|
|
||||||
std::map<uint16_t, std::string> nameMap;
|
|
||||||
std::map<std::string, uint16_t> idMap;
|
|
||||||
|
|
||||||
google::protobuf::Message* ParseMessage(const std::string& name, std::vector<byte> data);
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,547 +0,0 @@
|
|||||||
#include "pch-il2cpp.h"
|
|
||||||
#include "SnifferWindow.h"
|
|
||||||
#include <imgui_internal.h>
|
|
||||||
#include <misc/cpp/imgui_stdlib.h>
|
|
||||||
#include <regex>
|
|
||||||
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
SnifferWindow& SnifferWindow::GetInstance()
|
|
||||||
{
|
|
||||||
static SnifferWindow instance;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
static auto nameCompare = [](const PacketInfo& a, const PacketInfo& b) { return a.name() < b.name(); };
|
|
||||||
static auto sizeCompare = [](const PacketInfo& a, const PacketInfo& b) { return a.size() < b.size(); };
|
|
||||||
static auto idCompare = [](const PacketInfo& a, const PacketInfo& b) { return a.id() < b.id(); };
|
|
||||||
static auto typeCompare = [](const PacketInfo& a, const PacketInfo& b) { return a.type() < b.type(); };
|
|
||||||
static auto timeCompare = [](const PacketInfo& a, const PacketInfo& b) { return a.time() < b.time(); };
|
|
||||||
|
|
||||||
void SnifferWindow::OnPacketIO(const PacketInfo& info)
|
|
||||||
{
|
|
||||||
const std::lock_guard<std::mutex> lock(m_CapturePacketLock);
|
|
||||||
|
|
||||||
if (m_SortValue == SortValue::Time)
|
|
||||||
{
|
|
||||||
m_CapturedPackets.push_back(info);
|
|
||||||
if (m_FilterGroup.Execute(info))
|
|
||||||
m_CachedPackets.push_back(info);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (m_SortValue)
|
|
||||||
{
|
|
||||||
case sniffer::SnifferWindow::SortValue::Name:
|
|
||||||
m_CapturedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, nameCompare), info);
|
|
||||||
if (m_FilterGroup.Execute(info))
|
|
||||||
m_CachedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, nameCompare), info);
|
|
||||||
break;
|
|
||||||
case sniffer::SnifferWindow::SortValue::Size:
|
|
||||||
m_CapturedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, sizeCompare), info);
|
|
||||||
if (m_FilterGroup.Execute(info))
|
|
||||||
m_CachedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, nameCompare), info);
|
|
||||||
break;
|
|
||||||
case sniffer::SnifferWindow::SortValue::Id:
|
|
||||||
m_CapturedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, idCompare), info);
|
|
||||||
if (m_FilterGroup.Execute(info))
|
|
||||||
m_CachedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, nameCompare), info);
|
|
||||||
break;
|
|
||||||
case sniffer::SnifferWindow::SortValue::Type:
|
|
||||||
m_CapturedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, typeCompare), info);
|
|
||||||
if (m_FilterGroup.Execute(info))
|
|
||||||
m_CachedPackets.insert(std::lower_bound(m_CapturedPackets.begin(), m_CapturedPackets.end(), info, nameCompare), info);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef min
|
|
||||||
#undef max
|
|
||||||
|
|
||||||
void SnifferWindow::Draw()
|
|
||||||
{
|
|
||||||
|
|
||||||
const std::lock_guard<std::mutex> lock(m_CapturePacketLock);
|
|
||||||
|
|
||||||
bool showPrev = m_Show;
|
|
||||||
bool windowShowed = ImGui::Begin("Packet sniffer", m_Show);
|
|
||||||
|
|
||||||
if (showPrev != m_Show)
|
|
||||||
m_Show.FireChanged();
|
|
||||||
|
|
||||||
if (!windowShowed)
|
|
||||||
{
|
|
||||||
ImGui::End();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ComboEnum("## SortValue", &m_SortValue))
|
|
||||||
{
|
|
||||||
switch (m_SortValue)
|
|
||||||
{
|
|
||||||
case sniffer::SnifferWindow::SortValue::Name:
|
|
||||||
m_CapturedPackets.sort(nameCompare);
|
|
||||||
m_CachedPackets.sort(nameCompare);
|
|
||||||
break;
|
|
||||||
case sniffer::SnifferWindow::SortValue::Size:
|
|
||||||
m_CapturedPackets.sort(sizeCompare);
|
|
||||||
m_CachedPackets.sort(sizeCompare);
|
|
||||||
break;
|
|
||||||
case sniffer::SnifferWindow::SortValue::Id:
|
|
||||||
m_CapturedPackets.sort(idCompare);
|
|
||||||
m_CachedPackets.sort(idCompare);
|
|
||||||
break;
|
|
||||||
case sniffer::SnifferWindow::SortValue::Type:
|
|
||||||
m_CapturedPackets.sort(typeCompare);
|
|
||||||
m_CachedPackets.sort(typeCompare);
|
|
||||||
break;
|
|
||||||
case sniffer::SnifferWindow::SortValue::Time:
|
|
||||||
m_CapturedPackets.sort(timeCompare);
|
|
||||||
m_CachedPackets.sort(timeCompare);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
ComboEnum("Sort ## SortType", &m_SortType);
|
|
||||||
|
|
||||||
m_FilterGroup.Draw(false);
|
|
||||||
|
|
||||||
if (ImGui::Button("Apply filter"))
|
|
||||||
{
|
|
||||||
m_CachedPackets.clear();
|
|
||||||
for (auto& info : m_CapturedPackets)
|
|
||||||
{
|
|
||||||
if (m_FilterGroup.Execute(info))
|
|
||||||
{
|
|
||||||
m_CachedPackets.push_back(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
if (ImGui::Button("Clear history"))
|
|
||||||
{
|
|
||||||
m_CapturedPackets.clear();
|
|
||||||
m_CachedPackets.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::BeginChild("Packets");
|
|
||||||
|
|
||||||
if (m_SortType == SortType::Asc)
|
|
||||||
{
|
|
||||||
for (auto& info : m_CachedPackets)
|
|
||||||
info.Draw();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (auto it = m_CachedPackets.rbegin(); it != m_CachedPackets.rend(); it++)
|
|
||||||
it->Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndChild();
|
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
SnifferWindow::SnifferWindow() :
|
|
||||||
NF(m_Show, "Show capturing window", "SnifferWindow", false),
|
|
||||||
m_SortType(SortType::Desc),
|
|
||||||
m_SortValue(SortValue::Time)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Filter::Draw(bool canBeRemoved)
|
|
||||||
{
|
|
||||||
ImGui::PushID(this);
|
|
||||||
ComboEnum("## ObjectType", &m_ObjectType); ImGui::SameLine();
|
|
||||||
ComboEnum("## CompareType", &m_CompareType); ImGui::SameLine();
|
|
||||||
|
|
||||||
if (m_ObjectType != ObjectType::AnyValue)
|
|
||||||
{
|
|
||||||
ImGui::SetNextItemWidth(200);
|
|
||||||
ImGui::InputText("## Key", &m_KeyPattern); ImGui::SameLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_ObjectType == ObjectType::AnyValue || m_ObjectType == ObjectType::KeyValue)
|
|
||||||
{
|
|
||||||
ImGui::SetNextItemWidth(200);
|
|
||||||
ImGui::InputText("## Value", &m_ObjectPattern); ImGui::SameLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool removed = false;
|
|
||||||
if (canBeRemoved && ImGui::Button("Remove"))
|
|
||||||
removed = true;
|
|
||||||
|
|
||||||
ImGui::PopID();
|
|
||||||
return removed;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> StringSplit(const std::string& delimiter, const std::string& content)
|
|
||||||
{
|
|
||||||
std::vector<std::string> tokens;
|
|
||||||
size_t pos = 0;
|
|
||||||
size_t prevPos = 0;
|
|
||||||
std::string token;
|
|
||||||
while ((pos = content.find(delimiter, prevPos)) != std::string::npos) {
|
|
||||||
token = content.substr(prevPos, pos - prevPos);
|
|
||||||
tokens.push_back(token);
|
|
||||||
prevPos = pos + delimiter.length();
|
|
||||||
}
|
|
||||||
tokens.push_back(content.substr(prevPos));
|
|
||||||
return tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool ApplyCompareString(const std::string& value, const std::string& pattern, Filter::CompareType compare)
|
|
||||||
{
|
|
||||||
std::string lowerValue = value;
|
|
||||||
std::transform(lowerValue.begin(), lowerValue.end(), lowerValue.begin(),
|
|
||||||
[](unsigned char c) { return std::tolower(c); });
|
|
||||||
|
|
||||||
std::string lowerPattern = pattern;
|
|
||||||
std::transform(lowerPattern.begin(), lowerPattern.end(), lowerPattern.begin(),
|
|
||||||
[](unsigned char c) { return std::tolower(c); });
|
|
||||||
|
|
||||||
switch (compare)
|
|
||||||
{
|
|
||||||
case sniffer::Filter::CompareType::Regex:
|
|
||||||
{
|
|
||||||
std::regex _regex(lowerPattern.c_str());
|
|
||||||
return std::regex_match(lowerValue, _regex);
|
|
||||||
}
|
|
||||||
case sniffer::Filter::CompareType::Equal:
|
|
||||||
return lowerValue == lowerPattern;
|
|
||||||
case sniffer::Filter::CompareType::Contains:
|
|
||||||
return lowerValue.find(lowerPattern) != std::string::npos;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
static bool ApplyCompareAnyType(const nlohmann::json& object, const T& value, Filter::CompareType compare)
|
|
||||||
{
|
|
||||||
switch (compare)
|
|
||||||
{
|
|
||||||
case sniffer::Filter::CompareType::Equal:
|
|
||||||
return object == value;
|
|
||||||
case sniffer::Filter::CompareType::Less:
|
|
||||||
return object < value;
|
|
||||||
case sniffer::Filter::CompareType::LessEqual:
|
|
||||||
return object <= value;
|
|
||||||
case sniffer::Filter::CompareType::More:
|
|
||||||
return object > value;
|
|
||||||
case sniffer::Filter::CompareType::MoreEqual:
|
|
||||||
return object >= value;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool ApplyCompareValue(const nlohmann::json& object, const std::string& pattern, Filter::CompareType compare)
|
|
||||||
{
|
|
||||||
if (object.is_string())
|
|
||||||
return ApplyCompareString(object, pattern, compare);
|
|
||||||
|
|
||||||
if (object.is_boolean())
|
|
||||||
{
|
|
||||||
if (compare != Filter::CompareType::Equal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool value = pattern == "true" || pattern == "1";
|
|
||||||
return object == value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!object.is_number())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (object.is_number_float())
|
|
||||||
{
|
|
||||||
auto value = std::stof(pattern);
|
|
||||||
return ApplyCompareAnyType(object, value, compare);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object.is_number_integer())
|
|
||||||
{
|
|
||||||
auto value = std::stoi(pattern);
|
|
||||||
return ApplyCompareAnyType(object, value, compare);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object.is_number_unsigned())
|
|
||||||
{
|
|
||||||
auto value = std::stoul(pattern);
|
|
||||||
return ApplyCompareAnyType(object, value, compare);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool HasValue(const nlohmann::json& object, const std::string& pattern, Filter::CompareType compare)
|
|
||||||
{
|
|
||||||
if (object.is_array())
|
|
||||||
{
|
|
||||||
for (auto& nested : object)
|
|
||||||
{
|
|
||||||
if (HasValue(nested, pattern, compare))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (object.is_object())
|
|
||||||
{
|
|
||||||
for (auto& item : object.items())
|
|
||||||
{
|
|
||||||
if (HasValue(item.value(), pattern, compare))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ApplyCompareValue(object, pattern, compare);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Filter::FindAnyValue(const sniffer::PacketInfo& info)
|
|
||||||
{
|
|
||||||
if (m_ObjectPattern.empty())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return HasValue(info.object(), m_ObjectPattern, m_CompareType);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Filter::FindAnyKey(const sniffer::PacketInfo& info)
|
|
||||||
{
|
|
||||||
if (m_KeyPattern.empty())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return !FindKeys(info, true).empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Filter::FindKeyValue(const sniffer::PacketInfo& info)
|
|
||||||
{
|
|
||||||
if (m_KeyPattern.empty())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
auto objects = FindKeys(info);
|
|
||||||
for (auto& obj : objects)
|
|
||||||
{
|
|
||||||
if (ApplyCompareValue(info.object(), m_ObjectPattern, m_CompareType))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<nlohmann::json> FindKey(const nlohmann::json& object, const std::string& pattern, Filter::CompareType compareType, bool onlyFirst, bool recursive)
|
|
||||||
{
|
|
||||||
std::vector<nlohmann::json> objects;
|
|
||||||
|
|
||||||
if (object.is_array())
|
|
||||||
{
|
|
||||||
if (!recursive)
|
|
||||||
return objects;
|
|
||||||
|
|
||||||
for (auto& nested : object)
|
|
||||||
{
|
|
||||||
auto nestedResult = FindKey(nested, pattern, compareType, onlyFirst, recursive);
|
|
||||||
if (nestedResult.size() > 0)
|
|
||||||
{
|
|
||||||
objects.insert(objects.end(), nestedResult.begin(), nestedResult.end());
|
|
||||||
if (onlyFirst)
|
|
||||||
return objects;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (object.is_object())
|
|
||||||
{
|
|
||||||
for (auto& item : object.items())
|
|
||||||
{
|
|
||||||
bool correct = ApplyCompareString(item.key(), pattern, compareType);
|
|
||||||
if (!correct)
|
|
||||||
{
|
|
||||||
if (recursive)
|
|
||||||
{
|
|
||||||
auto nestedResult = FindKey(item.value(), pattern, compareType, onlyFirst, recursive);
|
|
||||||
if (nestedResult.size() > 0)
|
|
||||||
{
|
|
||||||
objects.insert(objects.end(), nestedResult.begin(), nestedResult.end());
|
|
||||||
if (onlyFirst)
|
|
||||||
return objects;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
objects.push_back(item.value());
|
|
||||||
if (onlyFirst)
|
|
||||||
return objects;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return objects;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<nlohmann::json> Filter::FindKeys(const sniffer::PacketInfo& info, bool onlyFirst)
|
|
||||||
{
|
|
||||||
auto equalType = m_ObjectType == ObjectType::KeyValue ? CompareType::Regex : m_CompareType;
|
|
||||||
auto tokens = StringSplit("::", m_KeyPattern);
|
|
||||||
|
|
||||||
std::string& mainToken = tokens[0];
|
|
||||||
if (tokens.size() == 1)
|
|
||||||
{
|
|
||||||
auto mainObjects = FindKey(info.object(), mainToken, equalType, onlyFirst, true);
|
|
||||||
return mainObjects;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto objects = FindKey(info.object(), m_KeyPattern, equalType, false, true);
|
|
||||||
|
|
||||||
for (auto it = tokens.begin() + 1; it != tokens.end(); it++)
|
|
||||||
{
|
|
||||||
if (objects.empty())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
bool last_token = (tokens.end() - 1) == it;
|
|
||||||
bool _onlyFirst = onlyFirst && last_token;
|
|
||||||
|
|
||||||
objects = FindKey(objects, *it, equalType, _onlyFirst, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return objects;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Filter::Execute(const sniffer::PacketInfo& info)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
switch (m_ObjectType)
|
|
||||||
{
|
|
||||||
case sniffer::Filter::ObjectType::KeyValue:
|
|
||||||
return FindKeyValue(info);
|
|
||||||
case sniffer::Filter::ObjectType::AnyKey:
|
|
||||||
return FindAnyKey(info);
|
|
||||||
case sniffer::Filter::ObjectType::AnyValue:
|
|
||||||
return FindAnyValue(info);
|
|
||||||
case sniffer::Filter::ObjectType::Name:
|
|
||||||
return ApplyCompareString(info.name(), m_KeyPattern, m_CompareType);
|
|
||||||
case sniffer::Filter::ObjectType::PacketId:
|
|
||||||
return ApplyCompareString(std::to_string(info.id()), m_KeyPattern, m_CompareType);
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (const std::regex_error& e)
|
|
||||||
{
|
|
||||||
UNREFERENCED_PARAMETER(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nlohmann::json Filter::Serialize()
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
Filter::Filter()
|
|
||||||
: m_CompareType(CompareType::Equal),
|
|
||||||
m_ObjectType(ObjectType::KeyValue)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Filter::Filter(nlohmann::json& object)
|
|
||||||
: Filter()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FilterGroup::Draw(bool canBeRemoved)
|
|
||||||
{
|
|
||||||
ImGui::PushID(this);
|
|
||||||
|
|
||||||
bool removed = false;
|
|
||||||
auto name = fmt::format("Group {}", magic_enum::enum_name(m_Rule));
|
|
||||||
ImGui::BeginGroupPanel(name.c_str());
|
|
||||||
{
|
|
||||||
ComboEnum("Rule", &m_Rule);
|
|
||||||
|
|
||||||
if (canBeRemoved)
|
|
||||||
{
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button("Remove"))
|
|
||||||
removed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<IFilter*> removeFilter = {};
|
|
||||||
for (auto& filter : m_Filters)
|
|
||||||
{
|
|
||||||
if (filter->Draw())
|
|
||||||
removeFilter = filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (removeFilter)
|
|
||||||
{
|
|
||||||
m_Filters.remove(*removeFilter);
|
|
||||||
delete* removeFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Button("Add group", ImVec2(70, 0)))
|
|
||||||
m_Filters.push_back(new FilterGroup());
|
|
||||||
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
if (ImGui::Button("Add filter", ImVec2(70, 0)))
|
|
||||||
m_Filters.push_back(new Filter());
|
|
||||||
|
|
||||||
}
|
|
||||||
ImGui::EndGroupPanel();
|
|
||||||
|
|
||||||
ImGui::PopID();
|
|
||||||
|
|
||||||
return removed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FilterGroup::Execute(const sniffer::PacketInfo& info)
|
|
||||||
{
|
|
||||||
if (m_Filters.empty())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
for (auto& filter : m_Filters)
|
|
||||||
{
|
|
||||||
bool result = filter->Execute(info);
|
|
||||||
if (m_Rule == Rule::AND && !result)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (m_Rule == Rule::NOT && result)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (m_Rule == Rule::OR && result)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return m_Rule != Rule::OR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nlohmann::json FilterGroup::Serialize()
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterGroup::FilterGroup() :
|
|
||||||
m_Rule(Rule::AND),
|
|
||||||
m_Filters()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterGroup::FilterGroup(nlohmann::json& object) : FilterGroup()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,109 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "PacketInfo.h"
|
|
||||||
|
|
||||||
namespace sniffer
|
|
||||||
{
|
|
||||||
|
|
||||||
class IFilter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual bool Draw(bool canBeRemoved = true) = 0;
|
|
||||||
virtual bool Execute(const sniffer::PacketInfo& info) = 0;
|
|
||||||
virtual nlohmann::json Serialize() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class Filter : public IFilter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum class CompareType
|
|
||||||
{
|
|
||||||
Regex, Equal, Contains, Less, LessEqual, More, MoreEqual
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class ObjectType
|
|
||||||
{
|
|
||||||
KeyValue, AnyKey, AnyValue, Name, PacketId
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual bool Draw(bool canBeRemoved = true) override;
|
|
||||||
virtual bool Execute(const sniffer::PacketInfo& info) override;
|
|
||||||
|
|
||||||
virtual nlohmann::json Serialize() override;
|
|
||||||
|
|
||||||
Filter();
|
|
||||||
Filter(nlohmann::json& object);
|
|
||||||
private:
|
|
||||||
|
|
||||||
bool FindAnyValue(const sniffer::PacketInfo& info);
|
|
||||||
bool FindAnyKey(const sniffer::PacketInfo& info);
|
|
||||||
bool FindKeyValue(const sniffer::PacketInfo& info);
|
|
||||||
std::vector<nlohmann::json> FindKeys(const sniffer::PacketInfo& info, bool onlyFirst = false);
|
|
||||||
|
|
||||||
CompareType m_CompareType;
|
|
||||||
ObjectType m_ObjectType;
|
|
||||||
|
|
||||||
std::string m_KeyPattern;
|
|
||||||
std::string m_ObjectPattern;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FilterGroup : public IFilter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
enum class Rule
|
|
||||||
{
|
|
||||||
AND, OR, NOT
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual bool Draw(bool canBeRemoved = true) override;
|
|
||||||
virtual bool Execute(const sniffer::PacketInfo& info) override;
|
|
||||||
|
|
||||||
virtual nlohmann::json Serialize() override;
|
|
||||||
|
|
||||||
FilterGroup();
|
|
||||||
FilterGroup(nlohmann::json& object);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Rule m_Rule;
|
|
||||||
std::list<IFilter*> m_Filters;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class SnifferWindow
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
config::Field<bool> m_Show;
|
|
||||||
|
|
||||||
SnifferWindow(SnifferWindow const&) = delete;
|
|
||||||
void operator=(SnifferWindow const&) = delete;
|
|
||||||
|
|
||||||
static SnifferWindow& GetInstance();
|
|
||||||
void OnPacketIO(const PacketInfo& info);
|
|
||||||
void Draw();
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum class SortValue
|
|
||||||
{
|
|
||||||
Time, Name, Size, Id, Type
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class SortType
|
|
||||||
{
|
|
||||||
Desc, Asc
|
|
||||||
};
|
|
||||||
|
|
||||||
SortValue m_SortValue;
|
|
||||||
SortType m_SortType;
|
|
||||||
|
|
||||||
std::list<sniffer::PacketInfo> m_CapturedPackets;
|
|
||||||
std::list<sniffer::PacketInfo> m_CachedPackets;
|
|
||||||
|
|
||||||
std::mutex m_CapturePacketLock;
|
|
||||||
|
|
||||||
FilterGroup m_FilterGroup;
|
|
||||||
|
|
||||||
SnifferWindow();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -5,36 +5,16 @@ void PacketData::Write(PipeTransfer* transfer)
|
|||||||
{
|
{
|
||||||
transfer->Write(blockModeEnabled);
|
transfer->Write(blockModeEnabled);
|
||||||
transfer->Write(ioType);
|
transfer->Write(ioType);
|
||||||
transfer->Write(dataType);
|
|
||||||
transfer->Write(valid);
|
|
||||||
transfer->Write(parentPacketID);
|
|
||||||
transfer->Write(messageID);
|
transfer->Write(messageID);
|
||||||
transfer->Write(headRawData);
|
transfer->Write(headRawData);
|
||||||
transfer->Write(messageRawData);
|
transfer->Write(messageRawData);
|
||||||
|
|
||||||
if (dataType == PacketDataType::Parsed)
|
|
||||||
{
|
|
||||||
transfer->Write(name);
|
|
||||||
transfer->Write(headJson);
|
|
||||||
transfer->Write(messageJson);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketData::Read(PipeTransfer* transfer)
|
void PacketData::Read(PipeTransfer* transfer)
|
||||||
{
|
{
|
||||||
transfer->Read(blockModeEnabled);
|
transfer->Read(blockModeEnabled);
|
||||||
transfer->Read(ioType);
|
transfer->Read(ioType);
|
||||||
transfer->Read(dataType);
|
|
||||||
transfer->Read(valid);
|
|
||||||
transfer->Read(parentPacketID);
|
|
||||||
transfer->Read(messageID);
|
transfer->Read(messageID);
|
||||||
transfer->Read(headRawData);
|
transfer->Read(headRawData);
|
||||||
transfer->Read(messageRawData);
|
transfer->Read(messageRawData);
|
||||||
|
|
||||||
if (dataType == PacketDataType::Parsed)
|
|
||||||
{
|
|
||||||
transfer->Read(name);
|
|
||||||
transfer->Read(headJson);
|
|
||||||
transfer->Read(messageJson);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,13 @@ namespace cheat::feature
|
|||||||
static Browser& GetInstance();
|
static Browser& GetInstance();
|
||||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||||
void DrawMain() override;
|
void DrawMain() override;
|
||||||
virtual bool NeedStatusDraw() const override;
|
bool NeedStatusDraw() const override;
|
||||||
void DrawStatus() override;
|
void DrawStatus() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SafeQueue<uint32_t> toBeUpdate;
|
SafeQueue<uint32_t> toBeUpdate;
|
||||||
SafeValue<int64_t> nextUpdate;
|
SafeValue<int64_t> nextUpdate;
|
||||||
int f_DelayUpdate = 20.f;
|
int f_DelayUpdate = 20;
|
||||||
void OnGameUpdate();
|
void OnGameUpdate();
|
||||||
Browser();
|
Browser();
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,7 @@ namespace cheat::feature
|
|||||||
private:
|
private:
|
||||||
SafeQueue<uint32_t> toBeUpdate;
|
SafeQueue<uint32_t> toBeUpdate;
|
||||||
SafeValue<int64_t> nextUpdate;
|
SafeValue<int64_t> nextUpdate;
|
||||||
int f_DelayUpdate = 100.f;
|
int f_DelayUpdate = 100;
|
||||||
|
|
||||||
void OnGameUpdate();
|
void OnGameUpdate();
|
||||||
PaimonFollow();
|
PaimonFollow();
|
||||||
|
@ -27,7 +27,7 @@ namespace cheat::feature
|
|||||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||||
void DrawMain() override;
|
void DrawMain() override;
|
||||||
|
|
||||||
virtual bool NeedStatusDraw() const override;
|
bool NeedStatusDraw() const override;
|
||||||
void DrawStatus() override;
|
void DrawStatus() override;
|
||||||
|
|
||||||
bool CheckFile(const std::string& name);
|
bool CheckFile(const std::string& name);
|
||||||
@ -35,7 +35,7 @@ namespace cheat::feature
|
|||||||
private:
|
private:
|
||||||
SafeQueue<uint32_t> toBeUpdate;
|
SafeQueue<uint32_t> toBeUpdate;
|
||||||
SafeValue<int64_t> nextUpdate;
|
SafeValue<int64_t> nextUpdate;
|
||||||
int f_DelayUpdate = 100.f;
|
int f_DelayUpdate = 100;
|
||||||
|
|
||||||
void OnGameUpdate();
|
void OnGameUpdate();
|
||||||
ProfileChanger();
|
ProfileChanger();
|
||||||
|
@ -74,18 +74,18 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\</OutDir>
|
||||||
<IntDir>$(SolutionDir)bin\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
<IntDir>$(SolutionDir)bin\$(Configuration)-$(PlatformShortName)\obj\$(ProjectName)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -99,6 +99,7 @@
|
|||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<SupportJustMyCode>false</SupportJustMyCode>
|
<SupportJustMyCode>false</SupportJustMyCode>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include/;$(SolutionDir)cheat-base/src;$(SolutionDir)cheat-base/vendor/simpleIni/</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)include/;$(SolutionDir)cheat-base/src;$(SolutionDir)cheat-base/vendor/simpleIni/</AdditionalIncludeDirectories>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -128,6 +129,7 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include/;$(SolutionDir)cheat-base/src;$(SolutionDir)cheat-base/vendor/simpleIni/</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)include/;$(SolutionDir)cheat-base/src;$(SolutionDir)cheat-base/vendor/simpleIni/</AdditionalIncludeDirectories>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -154,6 +156,7 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include/;$(SolutionDir)cheat-base/src;$(SolutionDir)cheat-base/vendor/simpleIni/</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)include/;$(SolutionDir)cheat-base/src;$(SolutionDir)cheat-base/vendor/simpleIni/</AdditionalIncludeDirectories>
|
||||||
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
@ -1,414 +1,14 @@
|
|||||||
#include "injector.h"
|
#include "injector.h"
|
||||||
|
|
||||||
#if defined(DISABLE_OUTPUT)
|
#include <cheat-base/inject/manual-map.h>
|
||||||
#define ILog(data, ...)
|
#include <cheat-base/inject/load-library.h>
|
||||||
#define IPrintError(text, ...)
|
|
||||||
#else
|
|
||||||
#define ILog(text, ...) printf(text, __VA_ARGS__)
|
|
||||||
#define ILogError(text, ...) ILog(text, __VA_ARGS__); std::cout << "Error: " << util::GetLastErrorAsString() << std::endl
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define CURRENT_ARCH IMAGE_FILE_MACHINE_AMD64
|
|
||||||
#else
|
|
||||||
#define CURRENT_ARCH IMAGE_FILE_MACHINE_I386
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool InjectDLL(HANDLE hProc, const std::string& filepath)
|
bool InjectDLL(HANDLE hProc, const std::string& filepath)
|
||||||
{
|
{
|
||||||
#ifndef MANUAL_MAP
|
#ifdef MANUAL_MAP
|
||||||
// Using LoadLibrary inject to be able to debug DLL in attached process.
|
bool result = ManualMapDLL(hProc, filepath);
|
||||||
// NOTE. For debug also needs disable mhyprot protection. (See protection-bypass.h in cheat-library)
|
|
||||||
// NOTE 2. Also need find way to disable antidebug.
|
|
||||||
bool result = LoadLibraryInject(hProc, filepath);
|
|
||||||
#else
|
#else
|
||||||
std::ifstream file(filepath, std::ios::in | std::ios::binary | std::ios::ate);
|
bool result = LoadLibraryDLL(hProc, filepath);
|
||||||
if (!file.is_open())
|
|
||||||
{
|
|
||||||
std::cout << "Error while reading DLL file!" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::streampos size = file.tellg();
|
|
||||||
auto memblock = new char[size];
|
|
||||||
file.seekg(0, std::ios::beg);
|
|
||||||
file.read(memblock, size);
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
BYTE* fileContent = (BYTE*)memblock;
|
|
||||||
|
|
||||||
// Manual map injection will help us to be like a assasin
|
|
||||||
bool result = ManualMapDll(hProc, fileContent, size);
|
|
||||||
|
|
||||||
delete[] memblock;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MANUAL_MAP
|
|
||||||
static bool LoadLibraryInject(HANDLE hProc, const std::string& dllpath)
|
|
||||||
{
|
|
||||||
HMODULE hKernel = GetModuleHandle("kernel32.dll");
|
|
||||||
if (hKernel == NULL) {
|
|
||||||
ILogError("[DLL Injection] Failed to get kernel32.dll module address.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LPVOID pLoadLibrary = (LPVOID)GetProcAddress(hKernel, "LoadLibraryA");
|
|
||||||
if (pLoadLibrary == NULL) {
|
|
||||||
ILogError("[DLL Injection] Failed to get LoadLibraryA address.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LPVOID pDLLPath = VirtualAllocEx(hProc, NULL, strlen(dllpath.c_str()) + 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
|
||||||
if (pDLLPath == NULL) {
|
|
||||||
ILogError("[DLL Injection] Failed to allocate memory for DLLPath in target process.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the string name of our DLL in the memory allocated
|
|
||||||
BOOL writeResult = WriteProcessMemory(hProc, pDLLPath, dllpath.c_str(), strlen(dllpath.c_str()), NULL);
|
|
||||||
if (writeResult == FALSE) {
|
|
||||||
ILogError("[DLL Injection] Failed to write remote process memory.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load our DLL by calling loadlibrary in the other process and passing our dll name
|
|
||||||
HANDLE hThread = CreateRemoteThread(hProc, NULL, NULL, (LPTHREAD_START_ROUTINE)pLoadLibrary, (LPVOID)pDLLPath, NULL, NULL);
|
|
||||||
if (hThread == NULL) {
|
|
||||||
ILogError("[DLL Injection] Failed to create remote thread.\n");
|
|
||||||
VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CloseHandle(hThread);
|
|
||||||
|
|
||||||
// TODO: Add waiting for thread end and release unneccessary data.
|
|
||||||
// VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
|
|
||||||
|
|
||||||
ILog("[DLL Injection] Successfully LoadLibraryA injection.\n");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
bool ManualMapDll(HANDLE hProc, BYTE* pSrcData, SIZE_T FileSize, bool ClearHeader, bool ClearNonNeededSections, bool AdjustProtections, bool SEHExceptionSupport, DWORD fdwReason) {
|
|
||||||
IMAGE_NT_HEADERS* pOldNtHeader = nullptr;
|
|
||||||
IMAGE_OPTIONAL_HEADER* pOldOptHeader = nullptr;
|
|
||||||
IMAGE_FILE_HEADER* pOldFileHeader = nullptr;
|
|
||||||
BYTE* pTargetBase = nullptr;
|
|
||||||
|
|
||||||
if (reinterpret_cast<IMAGE_DOS_HEADER*>(pSrcData)->e_magic != 0x5A4D) { //"MZ"
|
|
||||||
ILog("[DLL injection] Invalid file\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
pOldNtHeader = reinterpret_cast<IMAGE_NT_HEADERS*>(pSrcData + reinterpret_cast<IMAGE_DOS_HEADER*>(pSrcData)->e_lfanew);
|
|
||||||
pOldOptHeader = &pOldNtHeader->OptionalHeader;
|
|
||||||
pOldFileHeader = &pOldNtHeader->FileHeader;
|
|
||||||
|
|
||||||
if (pOldFileHeader->Machine != CURRENT_ARCH) {
|
|
||||||
ILog("[DLL injection] Invalid platform.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILog("[DLL injection] File ok\n");
|
|
||||||
|
|
||||||
pTargetBase = reinterpret_cast<BYTE*>(VirtualAllocEx(hProc, nullptr, pOldOptHeader->SizeOfImage, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
|
||||||
if (!pTargetBase) {
|
|
||||||
ILogError("[DLL injection] Target process memory allocation failed (ex)\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD oldp = 0;
|
|
||||||
VirtualProtectEx(hProc, pTargetBase, pOldOptHeader->SizeOfImage, PAGE_EXECUTE_READWRITE, &oldp);
|
|
||||||
|
|
||||||
MANUAL_MAPPING_DATA data{ 0 };
|
|
||||||
data.pLoadLibraryA = LoadLibraryA;
|
|
||||||
data.pGetProcAddress = GetProcAddress;
|
|
||||||
#ifdef _WIN64
|
|
||||||
data.pRtlAddFunctionTable = (f_RtlAddFunctionTable)RtlAddFunctionTable;
|
|
||||||
#else
|
|
||||||
SEHExceptionSupport = false;
|
|
||||||
#endif
|
|
||||||
data.pbase = pTargetBase;
|
|
||||||
data.fdwReasonParam = fdwReason;
|
|
||||||
data.SEHSupport = SEHExceptionSupport;
|
|
||||||
|
|
||||||
//File header
|
|
||||||
if (!WriteProcessMemory(hProc, pTargetBase, pSrcData, 0x1000, nullptr)) { //only first 0x1000 bytes for the header
|
|
||||||
ILogError("[DLL injection] Can't write file header.\n");
|
|
||||||
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IMAGE_SECTION_HEADER* pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
|
||||||
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
|
||||||
if (pSectionHeader->SizeOfRawData) {
|
|
||||||
if (!WriteProcessMemory(hProc, pTargetBase + pSectionHeader->VirtualAddress, pSrcData + pSectionHeader->PointerToRawData, pSectionHeader->SizeOfRawData, nullptr)) {
|
|
||||||
ILogError("[DLL injection] Can't map sections.\n");
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Mapping params
|
|
||||||
BYTE* MappingDataAlloc = reinterpret_cast<BYTE*>(VirtualAllocEx(hProc, nullptr, sizeof(MANUAL_MAPPING_DATA), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
|
||||||
if (!MappingDataAlloc) {
|
|
||||||
ILogError("[DLL injection] Target process mapping allocation failed (ex).\n");
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WriteProcessMemory(hProc, MappingDataAlloc, &data, sizeof(MANUAL_MAPPING_DATA), nullptr)) {
|
|
||||||
ILogError("[DLL injection] Can't write mapping.\n");
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Shell code
|
|
||||||
void* pShellcode = VirtualAllocEx(hProc, nullptr, 0x1000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
|
||||||
if (!pShellcode) {
|
|
||||||
ILogError("[DLL injection] Memory shellcode allocation failed (ex).\n");
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WriteProcessMemory(hProc, pShellcode, Shellcode, 0x1000, nullptr)) {
|
|
||||||
ILogError("[DLL injection] Can't write shellcode.\n");
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILog("[DLL injection] Mapped DLL at %p\n", pTargetBase);
|
|
||||||
ILog("[DLL injection] Mapping info at %p\n", MappingDataAlloc);
|
|
||||||
ILog("[DLL injection] Shell code at %p\n", pShellcode);
|
|
||||||
|
|
||||||
ILog("[DLL injection] Data allocated\n");
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
ILog("[DLL injection] My shellcode pointer %p\n", Shellcode);
|
|
||||||
ILog("[DLL injection] Target point %p\n", pShellcode);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HANDLE hThread = CreateRemoteThread(hProc, nullptr, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(pShellcode), MappingDataAlloc, 0, nullptr);
|
|
||||||
if (!hThread) {
|
|
||||||
ILogError("[DLL injection] Thread creation failed.\n");
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CloseHandle(hThread);
|
|
||||||
|
|
||||||
ILog("[DLL injection] Thread created at: %p, waiting for return...\n", pShellcode);
|
|
||||||
|
|
||||||
HINSTANCE hCheck = NULL;
|
|
||||||
while (!hCheck) {
|
|
||||||
DWORD exitcode = 0;
|
|
||||||
GetExitCodeProcess(hProc, &exitcode);
|
|
||||||
if (exitcode != STILL_ACTIVE) {
|
|
||||||
ILog("[DLL injection] Process crashed, exit code: 0x%x\n", exitcode);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MANUAL_MAPPING_DATA data_checked{ 0 };
|
|
||||||
ReadProcessMemory(hProc, MappingDataAlloc, &data_checked, sizeof(data_checked), nullptr);
|
|
||||||
hCheck = data_checked.hMod;
|
|
||||||
|
|
||||||
if (hCheck == (HINSTANCE)0x404040) {
|
|
||||||
ILog("[DLL injection] Wrong mapping ptr.\n");
|
|
||||||
VirtualFreeEx(hProc, pTargetBase, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE);
|
|
||||||
VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (hCheck == (HINSTANCE)0x505050) {
|
|
||||||
ILog("[DLL injection] WARNING: Exception support failed!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
BYTE* emptyBuffer = (BYTE*)malloc(1024 * 1024 * 20);
|
|
||||||
if (emptyBuffer == nullptr) {
|
|
||||||
ILog("[DLL injection] Unable to allocate memory\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset(emptyBuffer, 0, 1024 * 1024 * 20);
|
|
||||||
|
|
||||||
//CLEAR PE HEAD
|
|
||||||
if (ClearHeader) {
|
|
||||||
if (!WriteProcessMemory(hProc, pTargetBase, emptyBuffer, 0x1000, nullptr)) {
|
|
||||||
ILogError("[DLL injection] WARNING!: Can't clear HEADER\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//END CLEAR PE HEAD
|
|
||||||
|
|
||||||
|
|
||||||
if (ClearNonNeededSections) {
|
|
||||||
pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
|
||||||
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
|
||||||
if (pSectionHeader->Misc.VirtualSize) {
|
|
||||||
if ((SEHExceptionSupport ? 0 : strcmp((char*)pSectionHeader->Name, ".pdata") == 0) ||
|
|
||||||
strcmp((char*)pSectionHeader->Name, ".rsrc") == 0 ||
|
|
||||||
strcmp((char*)pSectionHeader->Name, ".reloc") == 0) {
|
|
||||||
ILog("[DLL injection] Processing %s removal\n", pSectionHeader->Name);
|
|
||||||
if (!WriteProcessMemory(hProc, pTargetBase + pSectionHeader->VirtualAddress, emptyBuffer, pSectionHeader->Misc.VirtualSize, nullptr)) {
|
|
||||||
ILogError("[DLL injection] Can't clear section %s.\n", pSectionHeader->Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AdjustProtections) {
|
|
||||||
pSectionHeader = IMAGE_FIRST_SECTION(pOldNtHeader);
|
|
||||||
for (UINT i = 0; i != pOldFileHeader->NumberOfSections; ++i, ++pSectionHeader) {
|
|
||||||
if (pSectionHeader->Misc.VirtualSize) {
|
|
||||||
DWORD old = 0;
|
|
||||||
DWORD newP = PAGE_READONLY;
|
|
||||||
|
|
||||||
if ((pSectionHeader->Characteristics & IMAGE_SCN_MEM_WRITE) > 0) {
|
|
||||||
newP = PAGE_READWRITE;
|
|
||||||
}
|
|
||||||
else if ((pSectionHeader->Characteristics & IMAGE_SCN_MEM_EXECUTE) > 0) {
|
|
||||||
newP = PAGE_EXECUTE_READ;
|
|
||||||
}
|
|
||||||
if (VirtualProtectEx(hProc, pTargetBase + pSectionHeader->VirtualAddress, pSectionHeader->Misc.VirtualSize, newP, &old)) {
|
|
||||||
ILog("[DLL injection] Section %s set as %lX\n", (char*)pSectionHeader->Name, newP);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ILog("[DLL injection] FAIL: section %s not set as %lX\n", (char*)pSectionHeader->Name, newP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DWORD old = 0;
|
|
||||||
VirtualProtectEx(hProc, pTargetBase, IMAGE_FIRST_SECTION(pOldNtHeader)->VirtualAddress, PAGE_READONLY, &old);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WriteProcessMemory(hProc, pShellcode, emptyBuffer, 0x1000, nullptr)) {
|
|
||||||
ILog("[DLL injection] WARNING: Can't clear shellcode\n");
|
|
||||||
}
|
|
||||||
if (!VirtualFreeEx(hProc, pShellcode, 0, MEM_RELEASE)) {
|
|
||||||
ILog("[DLL injection] WARNING: can't release shell code memory\n");
|
|
||||||
}
|
|
||||||
if (!VirtualFreeEx(hProc, MappingDataAlloc, 0, MEM_RELEASE)) {
|
|
||||||
ILog("[DLL injection] WARNING: can't release mapping data memory\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define RELOC_FLAG32(RelInfo) ((RelInfo >> 0x0C) == IMAGE_REL_BASED_HIGHLOW)
|
|
||||||
#define RELOC_FLAG64(RelInfo) ((RelInfo >> 0x0C) == IMAGE_REL_BASED_DIR64)
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define RELOC_FLAG RELOC_FLAG64
|
|
||||||
#else
|
|
||||||
#define RELOC_FLAG RELOC_FLAG32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma runtime_checks( "", off )
|
|
||||||
#pragma optimize( "", off )
|
|
||||||
void __stdcall Shellcode(MANUAL_MAPPING_DATA* pData) {
|
|
||||||
|
|
||||||
if (!pData) {
|
|
||||||
pData->hMod = (HINSTANCE)0x404040;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BYTE* pBase = pData->pbase;
|
|
||||||
auto* pOpt = &reinterpret_cast<IMAGE_NT_HEADERS*>(pBase + reinterpret_cast<IMAGE_DOS_HEADER*>((uintptr_t)pBase)->e_lfanew)->OptionalHeader;
|
|
||||||
|
|
||||||
auto _LoadLibraryA = pData->pLoadLibraryA;
|
|
||||||
auto _GetProcAddress = pData->pGetProcAddress;
|
|
||||||
#ifdef _WIN64
|
|
||||||
auto _RtlAddFunctionTable = pData->pRtlAddFunctionTable;
|
|
||||||
#endif
|
|
||||||
auto _DllMain = reinterpret_cast<f_DLL_ENTRY_POINT>(pBase + pOpt->AddressOfEntryPoint);
|
|
||||||
|
|
||||||
|
|
||||||
BYTE* LocationDelta = pBase - pOpt->ImageBase;
|
|
||||||
if (LocationDelta) {
|
|
||||||
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size) {
|
|
||||||
auto* pRelocData = reinterpret_cast<IMAGE_BASE_RELOCATION*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress);
|
|
||||||
const auto* pRelocEnd = reinterpret_cast<IMAGE_BASE_RELOCATION*>(reinterpret_cast<uintptr_t>(pRelocData) + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size);
|
|
||||||
while (pRelocData < pRelocEnd && pRelocData->SizeOfBlock) {
|
|
||||||
UINT AmountOfEntries = (pRelocData->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD);
|
|
||||||
WORD* pRelativeInfo = reinterpret_cast<WORD*>(pRelocData + 1);
|
|
||||||
|
|
||||||
for (UINT i = 0; i != AmountOfEntries; ++i, ++pRelativeInfo) {
|
|
||||||
if (RELOC_FLAG(*pRelativeInfo)) {
|
|
||||||
UINT_PTR* pPatch = reinterpret_cast<UINT_PTR*>(pBase + pRelocData->VirtualAddress + ((*pRelativeInfo) & 0xFFF));
|
|
||||||
*pPatch += reinterpret_cast<UINT_PTR>(LocationDelta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pRelocData = reinterpret_cast<IMAGE_BASE_RELOCATION*>(reinterpret_cast<BYTE*>(pRelocData) + pRelocData->SizeOfBlock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size) {
|
|
||||||
auto* pImportDescr = reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
|
|
||||||
while (pImportDescr->Name) {
|
|
||||||
char* szMod = reinterpret_cast<char*>(pBase + pImportDescr->Name);
|
|
||||||
HINSTANCE hDll = _LoadLibraryA(szMod);
|
|
||||||
|
|
||||||
ULONG_PTR* pThunkRef = reinterpret_cast<ULONG_PTR*>(pBase + pImportDescr->OriginalFirstThunk);
|
|
||||||
ULONG_PTR* pFuncRef = reinterpret_cast<ULONG_PTR*>(pBase + pImportDescr->FirstThunk);
|
|
||||||
|
|
||||||
if (!pThunkRef)
|
|
||||||
pThunkRef = pFuncRef;
|
|
||||||
|
|
||||||
for (; *pThunkRef; ++pThunkRef, ++pFuncRef) {
|
|
||||||
if (IMAGE_SNAP_BY_ORDINAL(*pThunkRef)) {
|
|
||||||
*pFuncRef = (ULONG_PTR)_GetProcAddress(hDll, reinterpret_cast<char*>(*pThunkRef & 0xFFFF));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
auto* pImport = reinterpret_cast<IMAGE_IMPORT_BY_NAME*>(pBase + (*pThunkRef));
|
|
||||||
*pFuncRef = (ULONG_PTR)_GetProcAddress(hDll, pImport->Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
++pImportDescr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].Size) {
|
|
||||||
auto* pTLS = reinterpret_cast<IMAGE_TLS_DIRECTORY*>(pBase + pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress);
|
|
||||||
auto* pCallback = reinterpret_cast<PIMAGE_TLS_CALLBACK*>(pTLS->AddressOfCallBacks);
|
|
||||||
for (; pCallback && *pCallback; ++pCallback)
|
|
||||||
(*pCallback)(pBase, DLL_PROCESS_ATTACH, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExceptionSupportFailed = false;
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
|
|
||||||
if (pData->SEHSupport) {
|
|
||||||
auto excep = pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION];
|
|
||||||
if (excep.Size) {
|
|
||||||
if (!_RtlAddFunctionTable(
|
|
||||||
reinterpret_cast<IMAGE_RUNTIME_FUNCTION_ENTRY*>(pBase + excep.VirtualAddress),
|
|
||||||
excep.Size / sizeof(IMAGE_RUNTIME_FUNCTION_ENTRY), (DWORD64)pBase)) {
|
|
||||||
ExceptionSupportFailed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_DllMain(pBase, pData->fdwReasonParam, nullptr);
|
|
||||||
|
|
||||||
if (ExceptionSupportFailed)
|
|
||||||
pData->hMod = reinterpret_cast<HINSTANCE>(0x505050);
|
|
||||||
else
|
|
||||||
pData->hMod = reinterpret_cast<HINSTANCE>(pBase);
|
|
||||||
}
|
|
||||||
#endif // MANUAL_MAP
|
|
@ -3,46 +3,10 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <TlHelp32.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
using f_LoadLibraryA = HINSTANCE(WINAPI*)(const char* lpLibFilename);
|
// #define MANUAL_MAP
|
||||||
using f_GetProcAddress = FARPROC(WINAPI*)(HMODULE hModule, LPCSTR lpProcName);
|
|
||||||
using f_DLL_ENTRY_POINT = BOOL(WINAPI*)(void* hDll, DWORD dwReason, void* pReserved);
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
using f_RtlAddFunctionTable = BOOL(WINAPIV*)(PRUNTIME_FUNCTION FunctionTable, DWORD EntryCount, DWORD64 BaseAddress);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct ConfigInfo {
|
|
||||||
bool disableMhyprot;
|
|
||||||
bool consoleLogging;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MANUAL_MAPPING_DATA
|
|
||||||
{
|
|
||||||
f_LoadLibraryA pLoadLibraryA;
|
|
||||||
f_GetProcAddress pGetProcAddress;
|
|
||||||
#ifdef _WIN64
|
|
||||||
f_RtlAddFunctionTable pRtlAddFunctionTable;
|
|
||||||
#endif
|
|
||||||
BYTE* pbase;
|
|
||||||
HINSTANCE hMod;
|
|
||||||
DWORD fdwReasonParam;
|
|
||||||
LPVOID reservedParam;
|
|
||||||
BOOL SEHSupport;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
bool InjectDLL(HANDLE hProc, const std::string& filepath);
|
bool InjectDLL(HANDLE hProc, const std::string& filepath);
|
||||||
|
|
||||||
#ifdef MANUAL_MAP
|
|
||||||
// Note: Exception support only x64 with build params /EHa or /EHc
|
|
||||||
bool ManualMapDll(HANDLE hProc, BYTE* pSrcData, SIZE_T FileSize, bool ClearHeader = false, bool ClearNonNeededSections = false, bool AdjustProtections = true, bool SEHExceptionSupport = false, DWORD fdwReason = DLL_PROCESS_ATTACH);
|
|
||||||
void __stdcall Shellcode(MANUAL_MAPPING_DATA* pData);
|
|
||||||
#else
|
|
||||||
static bool LoadLibraryInject(HANDLE hProc, const std::string& dllpath);
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user