diff options
Diffstat (limited to 'csgo-loader/csgo-client')
| -rw-r--r-- | csgo-loader/csgo-client/Client.cpp | 91 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/Client.hpp | 41 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/Login/RemoteLogin.cpp | 28 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/Login/RemoteLogin.hpp | 5 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.cpp | 37 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.hpp | 21 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.cpp | 42 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.hpp | 18 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp | 22 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/Security/RuntimeSecurity.cpp | 29 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/Security/RuntimeSecurity.hpp | 88 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/UserExperience/MoneybotShared/ui.h | 3 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/UserExperience/UserInterface.cpp | 98 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/csgo-client.vcxproj | 16 | ||||
| -rw-r--r-- | csgo-loader/csgo-client/csgo-client.vcxproj.filters | 7 |
15 files changed, 278 insertions, 268 deletions
diff --git a/csgo-loader/csgo-client/Client.cpp b/csgo-loader/csgo-client/Client.cpp index dc08da2..0f29f29 100644 --- a/csgo-loader/csgo-client/Client.cpp +++ b/csgo-loader/csgo-client/Client.cpp @@ -1,95 +1,58 @@ -#include <Networking/TCPClient.hpp>
-#include <Login/RemoteLogin.hpp>
-#include <Security/SyscallManager.hpp>
-#include <Security/FnvHash.hpp>
-#include <UserExperience/UserInterface.hpp>
-#include <RemoteCode/RemoteProcess.hpp>
-
-#define LOCAL_IP 0x0100007F // '127.0.0.1'
-#define SERVER_IP 0xE53CA523 // Hexadecimal representation of the server IP, obtained by inet_addr()
-#define SERVER_PORT 0xF2C // Hexadecimal representation of the server port.
-
-// hey nave just wanna let u know u r epic
-// yea
-#if 0
-void hhahahaha()
-{
- std::thread WindowThread([]
- {
- if(!UserInterface->Start())
- ERROR_ASSERT("[000F:00001B00] Failed to initialize. Please contact an administrator.");
-
- UserInterface->RunUiFrame();
- }); WindowThread.detach();
-
- UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_LOG_IN;
-
- while(UserInterface->m_Data.m_ExecutionState != UserExperience::EXECUTION_WAITING)
- Sleep(1);
-
- Login::RemoteLoginTransaction Transaction;
- Transaction.Start(UserInterface->m_Data.m_Username, UserInterface->m_Data.m_Password);
-
- ByteArray RawLoginHeader = Transaction.GetHeader();
- Client.SendBytes(RawLoginHeader);
-
- ByteArray RawServerResponse = Client.ReceiveBytes();
- if(!Transaction.TranslateResponse(RawServerResponse))
- {
- UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_ERROR;
- }
- else
- {
- UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_CHOOSE;
- }
-}
-#endif
-
-// is this loss/
-__forceinline void OpenConsole()
-{
-#ifdef DEBUG
- // ;ddDDDDdDDDd
- AllocConsole();
-
- // yo dude
- // get this handles
- FILE *file;
- freopen_s(&file, "CONOUT$", "w", stdout);
-#endif // DEBUG
-}
+#include <Client.hpp>
int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow)
{
- OpenConsole();
+ WRAP_IF_DEBUG(Utils::OpenConsole());
- Networking::TCPClient Client;
+ WRAP_IF_RELEASE(VM_DOLPHIN_BLACK_START);
+ WRAP_IF_RELEASE(STR_ENCRYPT_START);
+
+ // Initialize the runtime protection system.
+ if(!Protection->Start())
+ ERROR_ASSERT("[000F:00001A00] Failed to initialize. Please contact an administrator.");
// Initialize the syscall manager.
if(!Syscalls->Start())
ERROR_ASSERT("[000F:00001A00] Failed to initialize. Please contact an administrator.");
-
+
+ WRAP_IF_RELEASE(STR_ENCRYPT_END);
+ WRAP_IF_RELEASE(VM_DOLPHIN_BLACK_END);
+
// Wait for connection.
UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_WAITING;
// Create a thread to handle UI.
std::thread WindowThread([]
{
+ WRAP_IF_RELEASE(VM_SHARK_BLACK_START);
+ WRAP_IF_RELEASE(STR_ENCRYPT_START);
+
// Create a window, initialise DirectX context.
if(!UserInterface->Start())
ERROR_ASSERT("[000F:00001B00] Failed to initialize. Please contact an administrator.");
+ WRAP_IF_RELEASE(STR_ENCRYPT_END);
+ WRAP_IF_RELEASE(VM_SHARK_BLACK_END);
+
// Create a loop to draw our UI.
UserInterface->RunUiFrame();
}); WindowThread.detach();
+ WRAP_IF_RELEASE(VM_EAGLE_BLACK_START);
+
// Attempt to connect to the remote server.
+ Networking::TCPClient Client;
if(!Client.Start(LOCAL_IP, SERVER_PORT))
ERROR_ASSERT("[000F:0002A000] Server did not accept the connection.");
+
+ WRAP_IF_RELEASE(VM_EAGLE_BLACK_END);
+
// Allow the user to input their log-in data.
UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_LOG_IN;
- // TODO: Add game selection.
+ while(UserInterface->m_Data.m_ExecutionState != UserExperience::EXECUTION_WAITING)
+ Sleep(1);
+ // TODO: Add game selection.
while(1) { if(GetAsyncKeyState(VK_END) & 0x8000) break; Sleep(1); }
}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/Client.hpp b/csgo-loader/csgo-client/Client.hpp new file mode 100644 index 0000000..fb1f623 --- /dev/null +++ b/csgo-loader/csgo-client/Client.hpp @@ -0,0 +1,41 @@ +#pragma once
+
+// NOTE:
+// THE FOLLOWING MACROS ARE USED ONLY IN CLIENT.CPP
+// PLEASE UPDATE THEM ACCORDINGLY.
+#define LOCAL_IP 0x0100007F // '127.0.0.1'
+#define SERVER_IP 0xE53CA523 // Hexadecimal representation of the server IP, obtained by inet_addr()
+#define SERVER_PORT 0xF2C // Hexadecimal representation of the server port.
+
+// Security features (these will be initialised and ran
+// first, failure will terminate loader execution).
+#include <Security/RuntimeSecurity.hpp>
+#include <Security/SyscallManager.hpp>
+
+// Core functionality
+#include <Networking/TCPClient.hpp>
+#include <UserExperience/UserInterface.hpp>
+
+// Loader functionality
+#include <Login/RemoteLogin.hpp>
+
+#include <RemoteCode/RemoteProcess.hpp>
+#include <RemoteCode/RemoteInjectionClient.hpp>
+#include <RemoteCode/RemoteCodeClient.hpp>
+
+// It looked nasty in Client.cpp, so I'm putting it here.
+namespace Utils
+{
+ inline void OpenConsole()
+ {
+ // Create instance of console.
+ AllocConsole();
+
+ // Allow console to access output stream.
+ FILE *file;
+ freopen_s(&file, "CONOUT$", "w", stdout);
+
+ // :^)
+ SetConsoleTitleA("moneyclient $");
+ }
+}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/Login/RemoteLogin.cpp b/csgo-loader/csgo-client/Login/RemoteLogin.cpp index b6912d8..a725a6b 100644 --- a/csgo-loader/csgo-client/Login/RemoteLogin.cpp +++ b/csgo-loader/csgo-client/Login/RemoteLogin.cpp @@ -3,7 +3,7 @@ // Change this whenever a major client update is made.
// NOTE: You must change this on the server as well.
-#define CURRENT_CLIENT_HEADER 0xDEADBEEF
+#define CURRENT_CLIENT_HEADER 0x62746324
namespace Login
{
@@ -17,10 +17,11 @@ namespace Login strcpy_s< 128 >(m_Header.m_Password, Password);
// Initialise the header with the Hardware ID.
- m_Header.m_HardwareId = GetHardwareId();
+ m_Header.m_HardwareId = 0xFFFFFFFF;
// TODO: Verify integrity of system.
- m_Header.m_IntegrityBit1 = 0; // 0 for integrity passed, random bit for failure
+ // 0 for integrity passed, random bit for failure
+ m_Header.m_IntegrityBit1 = 0;
m_Header.m_IntegrityBit2 = 0;
m_Header.m_IntegrityBit3 = 0;
@@ -31,21 +32,10 @@ namespace Login }
// TODO: Hardware ID check.
- ByteArray RemoteLoginTransaction::DoWmiQuery(const char *Query)
- {
- ByteArray Response{};
-
- return Response;
- }
-
- uint32_t RemoteLoginTransaction::GetHardwareId()
- {
- return 123456789;
- }
bool RemoteLoginTransaction::TranslateResponse(ByteArray &RawResponse)
{
- RemoteLoginResponse ServerResponse = *reinterpret_cast<RemoteLoginResponse *>(&RawResponse[0]);
+ RemoteLoginResponse ServerResponse = *(RemoteLoginResponse *)&RawResponse[0];
switch(ServerResponse)
{
@@ -55,20 +45,20 @@ namespace Login case RemoteLoginResponse::ACCESS_AUTHORISED:
return true;
case RemoteLoginResponse::OUTDATED_CLIENT:
- INFO_ASSERT("[000A:%08x] Your client is outdated.\nPlease download the latest client at 'moneybot.cc'.", m_Header.m_HardwareId);
+ INFO_ASSERT("[000A:%08x] Your client is outdated.\nPlease download the latest client at 'moneybot.cc'.", m_Header.m_HardwareId ^ ServerResponse);
break;
case RemoteLoginResponse::USER_BANNED:
- INFO_ASSERT("[000D:%08x] Your account is banned.\nPlease contact 'admin@moneybot.cc' for additional information.", m_Header.m_HardwareId);
+ INFO_ASSERT("[000D:%08x] Your account is banned.\nPlease contact 'admin@moneybot.cc' for additional information.", m_Header.m_HardwareId ^ ServerResponse);
break;
case RemoteLoginResponse::INVALID_HARDWARE:
UserInterface->m_Data.m_Error = UserExperience::ERROR_INVALID_HWID;
break;
case RemoteLoginResponse::INVALID_CREDENTIALS:
- INFO_ASSERT("[000C:%08x] Your credentials are invalid. Please check your spelling and try again.", m_Header.m_HardwareId);
+ INFO_ASSERT("[000C:%08x] Your credentials are invalid. Please check your spelling and try again.", m_Header.m_HardwareId ^ ServerResponse);
break;
case RemoteLoginResponse::INTEGRITY_FAILURE:
case RemoteLoginResponse::NO_SUBSCRIPTION:
- INFO_ASSERT("[000G:%08x] No active subscription found.", m_Header.m_HardwareId);
+ INFO_ASSERT("[0005:%08x] No active subscription found.", m_Header.m_HardwareId ^ ServerResponse);
break;
}
diff --git a/csgo-loader/csgo-client/Login/RemoteLogin.hpp b/csgo-loader/csgo-client/Login/RemoteLogin.hpp index 31649c6..8e819fe 100644 --- a/csgo-loader/csgo-client/Login/RemoteLogin.hpp +++ b/csgo-loader/csgo-client/Login/RemoteLogin.hpp @@ -56,10 +56,7 @@ namespace Login void Start(const char *Username, const char *Password);
// Obtains the hardware ID of the current machine in use.
- uint32_t GetHardwareId();
-
- // Queries the WMI for data.
- ByteArray DoWmiQuery(const char *Query);
+ // TODO: HWID
// Translates server response, determines whether or not the
// user can access the client. NOTE: Server will drop the client if
diff --git a/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.cpp b/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.cpp index c62812b..5a42b6c 100644 --- a/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.cpp +++ b/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.cpp @@ -1,43 +1,6 @@ #include <RemoteCode/RemoteCodeClient.hpp>
-// i kinda stopped caring at this point
-
namespace RemoteCode
{
- RemoteCodeParameters RemoteCodeClient::Start(RemoteProcess &Process)
- {
- // Copy over process.
- m_Process = Process;
-
- // PSA: If the loader crashes CS:GO, this is most definitely the reason.
- HANDLE ShaderApi = Process.FindModule("shaderapidx9.dll");
- void *D3D_DevicePtr = (void *)((uintptr_t)ShaderApi + 0xA3FC0);
-
- // Read the VTable.
- // TODO: Check if process is 32-bit or 64-bit.... nah fuck that lol
- void *D3D_VtablePtr = Process.Read<void *>(D3D_DevicePtr);
- m_DirectX = Process.Read<uintptr_t>((void *)((uintptr_t)D3D_VtablePtr + 42 * 4));
-
- RemoteCodeParameters Parameters{
- (uintptr_t)D3D_VtablePtr,
- m_DirectX,
- 0x00000000,
- 0x00000000,
- (uintptr_t)VirtualProtect
- };
-
- m_DirectX = (uintptr_t)D3D_VtablePtr;
-
- return Parameters;
- }
-
- void RemoteCodeClient::Dispatch(ByteArray &Shellcode)
- {
- // Allocate and set-up shellcode.
- void *AllocationBase = m_Process.Allocate(Shellcode.size());
- m_Process.Write(AllocationBase, Shellcode.data(), Shellcode.size());
- // Hijack D3D thread.
- m_Process.Write<uintptr_t>((void *)(m_DirectX + 42 * 4), (uintptr_t)AllocationBase);
- }
}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.hpp b/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.hpp index 6794403..964d055 100644 --- a/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.hpp +++ b/csgo-loader/csgo-client/RemoteCode/RemoteCodeClient.hpp @@ -4,29 +4,8 @@ namespace RemoteCode
{
- struct RemoteCodeParameters
- {
- uintptr_t m_EndSceneVmt; // client
- uintptr_t m_OriginalEndScene; // client
- uintptr_t m_EntryPoint; // server
- uintptr_t m_CheatHeader; // server (this can also be constant but hey..)
- uintptr_t m_VirtualProtect; // client
- };
-
class RemoteCodeClient
{
- ByteArray m_Code;
- RemoteProcess m_Process;
- uintptr_t m_DirectX;
-
- public:
- RemoteCodeClient() = default;
-
- // Send server the allocation address.
- // This will also send the original and vmt address of endscene.
- RemoteCodeParameters Start(RemoteProcess &Process);
- // Allocate, write and then dispatch the shellcode.
- void Dispatch(ByteArray &Shellcode);
};
}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.cpp b/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.cpp index b8ff03d..01f52be 100644 --- a/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.cpp +++ b/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.cpp @@ -2,47 +2,5 @@ namespace RemoteCode
{
- // Select a game to inject the cheat for
- bool RemoteInjectionClient::Start(UserExperience::SelectedGame Game)
- {
- if(Game >= UserExperience::SelectedGame::GAME_MAX)
- return false;
- // TODO: Add any other games :-)
- switch(Game)
- {
- case UserExperience::SelectedGame::GAME_CSGO:
- case UserExperience::SelectedGame::GAME_CSGO_BETA:
- strcpy_s(m_ProcessName, "csgo.exe");
- break;
- }
-
- return true;
- }
-
- // Allocates a page in the game memory, which will be used to
- // write and execute the DLL.
- uintptr_t RemoteInjectionClient::AllocateImagePage(size_t SizeOfImage)
- {
- if(!m_Process)
- return uintptr_t{};
-
- // Allocate enough space to map the image
- m_AllocationBase = m_Process.Allocate(SizeOfImage);
-
- return (uintptr_t)m_AllocationBase;
- }
-
- // Initializes m_Process with the game process.
- bool RemoteInjectionClient::OpenGameHandle()
- {
- return m_Process.Start(m_ProcessName);
- }
-
- // Writes the cheat binary to the allocated page.
- void RemoteInjectionClient::WriteToMap(ByteArray &CheatBin)
- {
- // is this loss?
- m_Process.Write(m_AllocationBase, CheatBin.data(), CheatBin.size());
- }
}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.hpp b/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.hpp index 5880174..6699a9e 100644 --- a/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.hpp +++ b/csgo-loader/csgo-client/RemoteCode/RemoteInjectionClient.hpp @@ -7,24 +7,6 @@ namespace RemoteCode {
class RemoteInjectionClient
{
- ByteArray m_Data;
- RemoteProcess m_Process;
- char m_ProcessName[64];
- void *m_AllocationBase;
- public:
- RemoteInjectionClient() = default;
-
- // Select a game to inject the cheat for
- bool Start(UserExperience::SelectedGame Game);
-
- // Allocates a page in the game memory, which will be used to
- // write and execute the DLL.
- uintptr_t AllocateImagePage(size_t SizeOfImage);
-
- // Initializes m_Process with the game process.
- bool OpenGameHandle();
-
- void WriteToMap(ByteArray &CheatBin);
};
}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp b/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp index 8d2509f..6893498 100644 --- a/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp +++ b/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp @@ -29,6 +29,10 @@ namespace RemoteCode // swoo
m_ProcessId = ProcessEntry.th32ProcessID;
m_Process = OpenProcess(PROCESS_ALL_ACCESS, false, ProcessEntry.th32ProcessID);
+
+ if(!m_Process)
+ ERROR_ASSERT("[000G:%08x] There was an error with accessing a process.", GetLastError());
+
return true;
}
}
@@ -40,13 +44,19 @@ namespace RemoteCode void RemoteProcess::ReadMemoryWrapper_Internal(void *Address, void *Data, size_t SizeOfData)
{
static auto ZwReadVirtualMemory = Syscalls->Find<long(__stdcall *)(void *, void *, void *, size_t, void *)>(FNV("ZwReadVirtualMemory"));
- ZwReadVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+ NTSTATUS Status = ZwReadVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+
+ if(NT_ERROR(Status))
+ ERROR_ASSERT("[00DF:%08x] There was an error with accessing a process.", Status);
}
void RemoteProcess::WriteMemoryWrapper_Internal(void *Address, void *Data, size_t SizeOfData)
{
static auto ZwWriteVirtualMemory = Syscalls->Find<long(__stdcall *)(void *, void *, void *, size_t, void *)>(FNV("ZwWriteVirtualMemory"));
- ZwWriteVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+ NTSTATUS Status = ZwWriteVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+
+ if(NT_ERROR(Status))
+ ERROR_ASSERT("[00DF:%08x] There was an error with accessing a process.", Status);
}
void *RemoteProcess::Allocate(size_t AllocationSize)
@@ -64,8 +74,8 @@ namespace RemoteCode PAGE_EXECUTE_READWRITE
);
- if(!NT_SUCCESS(Status))
- return nullptr;
+ if(NT_ERROR(Status))
+ ERROR_ASSERT("[00DF:%08x] There was an error with accessing a process.", Status);
return AllocationAddress;
}
@@ -85,9 +95,11 @@ namespace RemoteCode while(Module32Next(Toolhelp, &ModuleEntry))
{
- //printf("%s\n", ModuleEntry.szModule);
if(strstr(ModuleEntry.szModule, ModuleName))
{
+ if(!ModuleEntry.hModule)
+ ERROR_ASSERT("[00DF:00001C00] An integrity check failed.");
+
CloseHandle(Toolhelp);
return RemoteModule(ModuleEntry.hModule);
}
diff --git a/csgo-loader/csgo-client/Security/RuntimeSecurity.cpp b/csgo-loader/csgo-client/Security/RuntimeSecurity.cpp new file mode 100644 index 0000000..305a44f --- /dev/null +++ b/csgo-loader/csgo-client/Security/RuntimeSecurity.cpp @@ -0,0 +1,29 @@ +#include <Security/RuntimeSecurity.hpp>
+#include <UserExperience/UserInterface.hpp>
+
+// Global accessor to security instance.
+Security::RuntimeSecurityPtr Protection = std::make_unique<Security::RuntimeSecurity>();
+
+namespace Security
+{
+ decltype(&MessageBoxA) oMessageBox;
+ int __stdcall Hooked_MessageBox(HWND Window, char *Message, char *Caption, uint32_t Type)
+ {
+ MEMORY_BASIC_INFORMATION Query;
+ if(!VirtualQuery(_ReturnAddress(), &Query, sizeof MEMORY_BASIC_INFORMATION))
+ ERROR_ASSERT("[00DF:00002C00] An integrity check failed.");
+
+ return oMessageBox(Window, Message, Caption, Type);
+ }
+
+ bool RuntimeSecurity::Start()
+ {
+ if(MH_Initialize() != MH_OK)
+ return false;
+
+ MH_CreateHook(&MessageBoxA, Hooked_MessageBox, (void **)&oMessageBox);
+ MH_EnableHook(&MessageBoxA);
+
+ return true;
+ }
+}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/Security/RuntimeSecurity.hpp b/csgo-loader/csgo-client/Security/RuntimeSecurity.hpp new file mode 100644 index 0000000..77ec94c --- /dev/null +++ b/csgo-loader/csgo-client/Security/RuntimeSecurity.hpp @@ -0,0 +1,88 @@ +#pragma once
+
+// std::unique_ptr
+#include <memory>
+
+// Intrinsics (_ReturnAddress)
+#include <intrin.h>
+
+// Required for the SDK from Themida which offers multiple
+// virtual machines and string encryption, as well as debug/VM checks.
+#include <ThemidaSDK.h>
+
+// Required for MinHook.
+#include <MinHook.h>
+#pragma comment(lib, "MinHook.lib")
+
+// Used for wrapping Themida's macros along with some other things.
+// e.g: WRAP_IF_RELEASE( VM_SHARK_BLACK_START ) will only trigger in Release mode.
+// Likewise, WRAP_IF_DEBUG( printf( "Error: %08x", GetLastError() ) ) will only
+// trigger in Debug mode.
+// Just a neat little feature that I decided to implement :-)
+#ifdef DEBUG
+ #define WRAP_IF_RELEASE( s )
+ #define WRAP_IF_DEBUG( s ) { s; }
+#else
+ #define WRAP_IF_RELEASE( s ) { s; }
+ #define WRAP_IF_DEBUG( s )
+
+ // Link against Themida's SecureEngine.
+ #pragma comment(lib, "SecureEngine.lib")
+#endif
+
+namespace Security
+{
+ // Hardware ID structure (this is hashed and sent to server, but it's easier to use it
+ // this way internally)
+ struct HardwareIdentifier
+ {
+ // Generic CPU information.
+ uint16_t m_CpuArchitecture;
+ uint32_t m_CpuCount;
+
+ // String-literal - contains list of CPU features.
+ char m_CpuFeatures[64];
+
+ // Hash of the hard disk serial identifier.
+ uint32_t m_HardDiskSerialHash;
+ };
+
+ // This class implements the runtime security system.
+ // In short, upon initialization, the system applies detours to numerous API functions
+ // which will be checked for integrity every time they are called.
+ // Also, a few threads are dispatched in the process in order to ensure that there are no
+ // forbidden programs/conditions being triggered.
+ // The class has an (inlined) security callback which can be used to phone home and infract/ban
+ // any potentially malicious actions from users.
+ class RuntimeSecurity
+ {
+ protected:
+ // Applies necessary API hooks.
+ void ApplyApiHooks_Internal();
+
+ // Patches common debugging functions to crash the program.
+ void PatchDebugFunctions_Internal();
+
+ // Dispatches security threads.
+ void DispatchSecurityThreads_Internal();
+
+ // The following functions are used in security threads to run checks.
+ bool CheckForVirtualMachine_Internal();
+
+ bool CheckForDebugger_Internal();
+
+ bool CheckForApiHooks_Internal();
+
+ public:
+ // Initializes the runtime security system.
+ bool Start();
+
+ // Retrieves the current Hardware ID for the system.
+
+ };
+
+ // Readability
+ using RuntimeSecurityPtr = std::unique_ptr<RuntimeSecurity>;
+}
+
+extern Security::RuntimeSecurityPtr Protection;
\ No newline at end of file diff --git a/csgo-loader/csgo-client/UserExperience/MoneybotShared/ui.h b/csgo-loader/csgo-client/UserExperience/MoneybotShared/ui.h index b061cd5..4d89936 100644 --- a/csgo-loader/csgo-client/UserExperience/MoneybotShared/ui.h +++ b/csgo-loader/csgo-client/UserExperience/MoneybotShared/ui.h @@ -42,9 +42,6 @@ namespace ui { auto error_form = menu->add_item(std::make_shared<ui::c_form>(120, 20, 190, 115, "error"));
{
- error_form->add_item(std::make_shared<ui::c_label>(25, 15, "contact an administrator."))->set_cond([] {
- return UserInterface->m_Data.m_Error == UserExperience::ERROR_SHADOW_BAN;
- });
error_form->add_item(std::make_shared<ui::c_label>(30, 15, "hardware id mismatch."))->set_cond([] {
return UserInterface->m_Data.m_Error == UserExperience::ERROR_INVALID_HWID;
});
diff --git a/csgo-loader/csgo-client/UserExperience/UserInterface.cpp b/csgo-loader/csgo-client/UserExperience/UserInterface.cpp index af1b384..75b79b2 100644 --- a/csgo-loader/csgo-client/UserExperience/UserInterface.cpp +++ b/csgo-loader/csgo-client/UserExperience/UserInterface.cpp @@ -11,65 +11,65 @@ namespace UserExperience {
void OnDirectXFrame()
{
- if(g_d3d.run_frame(g_window.m_d3d_device)) - { - g_d3d.begin(); - for(auto& it : d3d::sprites) - { - it->begin(g_window.m_d3d_device); - } - - static auto last_time = GetTickCount() * 0.001f; - auto cur_time = GetTickCount() * 0.001f; - - auto deltatime = cur_time - last_time; - - last_time = cur_time; - - constexpr float anim_step = 1.0f / 15.f; - static float anim_time = 0.f; - static bool flip = false; - if(anim_time == 1.0f) - { - flip = true; - } - if(anim_time == 0.f) - { - flip = false; - } - - if(flip) anim_time = std::clamp(anim_time - anim_step * deltatime, 0.f, 1.0f); - else anim_time = std::clamp(anim_time + anim_step * deltatime, 0.f, 1.0f); - - ui::set_animtime(anim_time); - ui::render(); - - RECT cur_rect{ }; - GetWindowRect(g_window.get_hwnd(), &cur_rect); - - g_d3d.end(); - for(auto& it : d3d::sprites) - { - it->end(); - } + if(g_d3d.run_frame(g_window.m_d3d_device))
+ {
+ g_d3d.begin();
+ for(auto& it : d3d::sprites)
+ {
+ it->begin(g_window.m_d3d_device);
+ }
+
+ static auto last_time = GetTickCount() * 0.001f;
+ auto cur_time = GetTickCount() * 0.001f;
+
+ auto deltatime = cur_time - last_time;
+
+ last_time = cur_time;
+
+ constexpr float anim_step = 1.0f / 15.f;
+ static float anim_time = 0.f;
+ static bool flip = false;
+ if(anim_time == 1.0f)
+ {
+ flip = true;
+ }
+ if(anim_time == 0.f)
+ {
+ flip = false;
+ }
+
+ if(flip) anim_time = std::clamp(anim_time - anim_step * deltatime, 0.f, 1.0f);
+ else anim_time = std::clamp(anim_time + anim_step * deltatime, 0.f, 1.0f);
+
+ ui::set_animtime(anim_time);
+ ui::render();
+
+ RECT cur_rect{ };
+ GetWindowRect(g_window.get_hwnd(), &cur_rect);
+
+ g_d3d.end();
+ for(auto& it : d3d::sprites)
+ {
+ it->end();
+ }
}
}
bool UserInterface::Start()
{
- bool result = g_window.create(); - - if(result) - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - g_window.add_on_frame(&OnDirectXFrame); + bool result = g_window.create();
+
+ if(result)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ g_window.add_on_frame(&OnDirectXFrame);
}
return result;
}
- void UserInterface::RunUiFrame() - { + void UserInterface::RunUiFrame()
+ {
g_window.on_frame();
}
}
\ No newline at end of file diff --git a/csgo-loader/csgo-client/csgo-client.vcxproj b/csgo-loader/csgo-client/csgo-client.vcxproj index 5c839dc..f3fa98f 100644 --- a/csgo-loader/csgo-client/csgo-client.vcxproj +++ b/csgo-loader/csgo-client/csgo-client.vcxproj @@ -26,6 +26,7 @@ <ClCompile Include="RemoteCode\RemoteInjectionClient.cpp" />
<ClCompile Include="RemoteCode\RemoteProcess.cpp" />
<ClCompile Include="Security\Encryption.cpp" />
+ <ClCompile Include="Security\RuntimeSecurity.cpp" />
<ClCompile Include="Security\SyscallManager.cpp" />
<ClCompile Include="UserExperience\MoneybotShared\d3d.cpp" />
<ClCompile Include="UserExperience\MoneybotShared\d3d_sprite.cpp" />
@@ -35,6 +36,7 @@ <ClCompile Include="UserExperience\UserInterface.cpp" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="Client.hpp" />
<ClInclude Include="Login\RemoteLogin.hpp" />
<ClInclude Include="Networking\TCPClient.hpp" />
<ClInclude Include="RemoteCode\RemoteCodeClient.hpp" />
@@ -42,6 +44,7 @@ <ClInclude Include="RemoteCode\RemoteProcess.hpp" />
<ClInclude Include="Security\Encryption.hpp" />
<ClInclude Include="Security\FnvHash.hpp" />
+ <ClInclude Include="Security\RuntimeSecurity.hpp" />
<ClInclude Include="Security\SyscallManager.hpp" />
<ClInclude Include="UserExperience\MoneybotShared\color.hpp" />
<ClInclude Include="UserExperience\MoneybotShared\d3d.hpp" />
@@ -124,15 +127,15 @@ <OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(Configuration)\Client\</IntDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
- <IncludePath>$(SolutionDir)themida-sdk\include;$(DXSDK_DIR)\Include;$(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
- <LibraryPath>$(SolutionDir)themida-sdk\lib;$(DXSDK_DIR)\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64</LibraryPath>
+ <IncludePath>$(SolutionDir)shared\include;$(DXSDK_DIR)\Include;$(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
+ <LibraryPath>$(SolutionDir)shared\lib;$(DXSDK_DIR)\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\$(Configuration)\Client\</IntDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
- <IncludePath>$(SolutionDir)themida-sdk\include;$(DXSDK_DIR)\Include;$(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
- <LibraryPath>$(SolutionDir)themida-sdk\lib;$(DXSDK_DIR)\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64</LibraryPath>
+ <IncludePath>$(SolutionDir)shared\include;$(DXSDK_DIR)\Include;$(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
+ <LibraryPath>$(SolutionDir)shared\lib;$(DXSDK_DIR)\Lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -151,7 +154,8 @@ <PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN;NOMINMAX;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
- <DisableSpecificWarnings>4100;4189;4244;4267;4522;4714;4838;</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4100;4189;4244;4267;4522;4714;4838;4307;4706;4702</DisableSpecificWarnings>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
@@ -184,7 +188,7 @@ <PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32_LEAN_AND_MEAN;NOMINMAX;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
- <DisableSpecificWarnings>4100;4189;4244;4267;4522;4714;4838;</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4100;4189;4244;4267;4522;4714;4838;4307;4706;4702</DisableSpecificWarnings>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
diff --git a/csgo-loader/csgo-client/csgo-client.vcxproj.filters b/csgo-loader/csgo-client/csgo-client.vcxproj.filters index 049be28..d6bb0c4 100644 --- a/csgo-loader/csgo-client/csgo-client.vcxproj.filters +++ b/csgo-loader/csgo-client/csgo-client.vcxproj.filters @@ -61,6 +61,9 @@ <ClCompile Include="RemoteCode\RemoteInjectionClient.cpp">
<Filter>RemoteCode</Filter>
</ClCompile>
+ <ClCompile Include="Security\RuntimeSecurity.cpp">
+ <Filter>Security</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Security\Encryption.hpp">
@@ -162,5 +165,9 @@ <ClInclude Include="RemoteCode\RemoteInjectionClient.hpp">
<Filter>RemoteCode</Filter>
</ClInclude>
+ <ClInclude Include="Client.hpp" />
+ <ClInclude Include="Security\RuntimeSecurity.hpp">
+ <Filter>Security</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file |
