aboutsummaryrefslogtreecommitdiff
path: root/CSGO
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2019-07-29 23:32:28 +0200
committerToni Uhlig <matzeton@googlemail.com>2019-07-29 23:32:28 +0200
commit85f8a4da6221c0d42ff96602b62eed3522f3a9fe (patch)
tree4dacc7b86f5bd07fbff19b9bc28288cd29ad2dd6 /CSGO
parent44f877763004fb0eaa07b68c03c2d853ee9b523a (diff)
added CSGO project
Diffstat (limited to 'CSGO')
-rw-r--r--CSGO/CSGO.cpp155
-rw-r--r--CSGO/CSGO.vcxproj179
-rw-r--r--CSGO/CSGO.vcxproj.filters30
-rw-r--r--CSGO/pch.cpp5
-rw-r--r--CSGO/pch.h14
5 files changed, 383 insertions, 0 deletions
diff --git a/CSGO/CSGO.cpp b/CSGO/CSGO.cpp
new file mode 100644
index 0000000..9b6921c
--- /dev/null
+++ b/CSGO/CSGO.cpp
@@ -0,0 +1,155 @@
+#include "pch.h"
+#include "KMemDriver.h"
+#include "KInterface.h"
+
+#include <iostream>
+#include <iomanip>
+#include <windows.h>
+
+static BOOL running = false;
+static const wchar_t *wName = L"Counter-Strike: Global Offensive";
+
+typedef struct player_info_s
+{
+ __int64 unknown; //0x0000
+ union
+ {
+ __int64 steamID64; //0x0008 - SteamID64
+ struct
+ {
+ __int32 xuid_low;
+ __int32 xuid_high;
+ };
+ };
+ char szName[128]; //0x0010 - Player Name
+ int userId; //0x0090 - Unique Server Identifier
+ char szSteamID[20]; //0x0094 - STEAM_X:Y:Z
+ char pad_0x00A8[0x10]; //0x00A8
+ unsigned long iSteamID; //0x00B8 - SteamID
+ char szFriendsName[128];
+ bool fakeplayer;
+ bool ishltv;
+ unsigned int customfiles[4];
+ unsigned char filesdownloaded;
+} player_info_t;
+
+
+static bool consoleHandler(int signal) {
+ if (signal == CTRL_C_EVENT) {
+ if (!running)
+ exit(EXIT_FAILURE);
+ running = false;
+ std::wcout << L"Waiting for graceful shutdown .." << std::endl;
+ }
+ return true;
+}
+
+static BOOL CALLBACK enumWindowsProc(HWND hWnd, LPARAM lParam)
+{
+ int length = GetWindowTextLength(hWnd);
+ TCHAR* buffer;
+ buffer = new TCHAR[length + 1];
+ memset(buffer, 0, (length + 1) * sizeof(TCHAR));
+ GetWindowText(hWnd, buffer, length + 1);
+ //wprintf(L"Window: '%ls'\n", buffer);
+ if (!wcscmp(buffer, wName))
+ *(HWND *)lParam = hWnd;
+ delete[] buffer;
+ return TRUE;
+}
+
+int wmain(int argc, wchar_t **argv)
+{
+ HANDLE targetPID = 0;
+ PVOID buf;
+ HANDLE kevent;
+ HANDLE uevent;
+
+ KInterface &ki = KInterface::getInstance();
+ std::vector<MEMORY_BASIC_INFORMATION> pages;
+ std::vector<MODULE_DATA> modules;
+
+ std::wcout << L"Waiting for window title: '" << wName << L"'" << std::endl;
+
+ HWND targetHWND = NULL;
+ while (1) {
+ if (!EnumWindows(enumWindowsProc, (LPARAM)&targetHWND)) {
+ return 1;
+ }
+ if (targetHWND) {
+ std::wcout << L"Found window '" << wName << L"' with Handle 0x"
+ << std::hex << targetHWND << std::endl;
+ break;
+ }
+ Sleep(1000);
+ }
+ GetWindowThreadProcessId(targetHWND, (LPDWORD)&targetPID);
+
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)consoleHandler, TRUE);
+
+ if (!ki.Init()) {
+ std::wcout << L"Kernel Interface Init() failed" << std::endl;
+ return 1;
+ }
+
+ try {
+ buf = ki.getBuffer();
+ kevent = ki.getKHandle();
+ uevent = ki.getUHandle();
+ }
+ catch (std::runtime_error& err) {
+ std::wcout << err.what() << std::endl;
+ return 1;
+ }
+
+ std::wcout << L"Buffer.: " << buf << std::endl;
+ std::wcout << L"KHandle: " << kevent << std::endl;
+ std::wcout << L"UHandle: " << uevent << std::endl;
+
+ if (!ki.Handshake()) {
+ std::wcout << L"Kernel Interface Handshake() failed" << std::endl;
+ return 1;
+ }
+ if (targetPID) {
+ if (!ki.Modules(targetPID, modules))
+ std::wcout << L"Kernel Interface Modules() failed with 0x"
+ << std::hex << ki.getLastNtStatus() << std::endl;
+ else std::wcout << L"Got " << std::dec << modules.size() << L" modules for pid 0x"
+ << std::hex << targetPID << std::endl;
+ if (!ki.Pages(targetPID, pages))
+ std::wcout << L"Kernel Interface Pages() failed with 0x"
+ << std::hex << ki.getLastNtStatus() << std::endl;
+ else std::wcout << L"Got " << std::dec << pages.size() << L" mapped pages for pid 0x"
+ << std::hex << targetPID << std::endl;
+ }
+
+ for (MODULE_DATA& md : modules) {
+ std::wcout << md.BaseDllName << std::endl;
+ }
+
+ running = TRUE;
+ do {
+ if (ki.RecvWait() == SRR_TIMEOUT) {
+ std::wcout << L"Ping -> ";
+ if (!ki.Ping()) {
+ std::wcout << L"Got no valid PONG, abort!" << std::endl;
+ running = FALSE;
+ }
+ else std::wcout << L"PONG!" << std::endl;
+ }
+
+ if (!running)
+ break;
+
+ try {
+ if (targetPID) {
+ }
+ }
+ catch (std::runtime_error& err) {
+ std::wcout << err.what() << std::endl;
+ }
+ } while (running);
+
+ std::wcout << L"Driver shutdown .." << std::endl;
+ ki.Exit();
+} \ No newline at end of file
diff --git a/CSGO/CSGO.vcxproj b/CSGO/CSGO.vcxproj
new file mode 100644
index 0000000..315dcf6
--- /dev/null
+++ b/CSGO/CSGO.vcxproj
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{65C081C2-3A90-470C-BF06-AFF2EEB00C25}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>CSGO</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfMfc>Static</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <TargetName>$(ProjectName)-kmem</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ <AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(VCToolsInstallDir)lib\x64;$(OutputPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;MemDriverLib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="pch.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="CSGO.cpp" />
+ <ClCompile Include="pch.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\MemDriverLib\MemDriverLib.vcxproj">
+ <Project>{b6790a97-6995-46b6-ad73-ac5bc4ac76db}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/CSGO/CSGO.vcxproj.filters b/CSGO/CSGO.vcxproj.filters
new file mode 100644
index 0000000..1448a3f
--- /dev/null
+++ b/CSGO/CSGO.vcxproj.filters
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="pch.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="pch.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="CSGO.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/CSGO/pch.cpp b/CSGO/pch.cpp
new file mode 100644
index 0000000..3a3d12b
--- /dev/null
+++ b/CSGO/pch.cpp
@@ -0,0 +1,5 @@
+// pch.cpp: source file corresponding to pre-compiled header; necessary for compilation to succeed
+
+#include "pch.h"
+
+// In general, ignore this file, but keep it around if you are using pre-compiled headers.
diff --git a/CSGO/pch.h b/CSGO/pch.h
new file mode 100644
index 0000000..b04e71e
--- /dev/null
+++ b/CSGO/pch.h
@@ -0,0 +1,14 @@
+// Tips for Getting Started:
+// 1. Use the Solution Explorer window to add/manage files
+// 2. Use the Team Explorer window to connect to source control
+// 3. Use the Output window to see build output and other messages
+// 4. Use the Error List window to view errors
+// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
+// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
+
+#ifndef PCH_H
+#define PCH_H
+
+// TODO: add headers that you want to pre-compile here
+
+#endif //PCH_H