Source Code The worst l4d2 hack

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

r4z0r

Coder
Meme Tier VIP
Jul 21, 2016
246
1,678
13
I made this so I could learn some stuff about hacking, making this I learned lots of things so I'm here to share what i've done with my tests.

[video=youtube;dMLtAP1bitA]https://www.youtube.com/watch?v=dMLtAP1bitA&feature=youtu.be[/video]

Insert = z + 100
Delete = z - 100
Arrow Down = x - 100
Arrow Up = x + 100
Arrow Left = y - 100
Arrow Right = x 100
SUBTRACT = save you current position
MULTIPLY = go to the saved pos
Home = infinite health

C++:
#include <Windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <TlHelp32.h>
#include <tchar.h>
#include <math.h>

using namespace std;

struct vec2 {
	float x, y;
};

struct vec3 {
	float x, y, z;
};

DWORD_PTR dwGetModuleBaseAddress(DWORD dwProcID, TCHAR *szModuleName)
{
	DWORD_PTR dwModuleBaseAddress = 0;
	HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwProcID);
	if (hSnapshot != INVALID_HANDLE_VALUE)
	{
		MODULEENTRY32 ModuleEntry32;
		ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
		if (Module32First(hSnapshot, &ModuleEntry32))
		{
			do
			{
				if (_tcsicmp(ModuleEntry32.szModule, szModuleName) == 0)
				{
					dwModuleBaseAddress = (DWORD_PTR)ModuleEntry32.modBaseAddr;
					break;
				}
			} while (Module32Next(hSnapshot, &ModuleEntry32));
		}
		CloseHandle(hSnapshot);
	}
	return dwModuleBaseAddress;
}

class Player
{
public:
	char pad_0x0000[0xEC]; //0x0000
	__int32 iHealth; //0x00EC 
	char pad_0x00F0[0x154]; //0x00F0
	__int32 jumpingMaybe; //0x0244 
	char pad_0x0248[0x140]; //0x0248
	vec3 pos; //0x0388 
	char pad_0x0394[0x470]; //0x0394

}; //Size=0x0804

DWORD ProcessThread() {

	DWORD PID;
	GetWindowThreadProcessId(FindWindow(NULL, "Left 4 Dead 2"), &PID);
	bool healthHack = false;
	vec3 savePos = { 0 };
	while (1)
	{
		Player * localPlayer = (Player*)*(DWORD*)(dwGetModuleBaseAddress(PID, _T("server.dll")) + 0x7B4C4C);
		Player * localPlayer2 = (Player*)*(DWORD*)(dwGetModuleBaseAddress(PID, _T("server.dll")) + 0x7B4C5C);
		Player * localPlayer3 = (Player*)*(DWORD*)(dwGetModuleBaseAddress(PID, _T("server.dll")) + 0x7B4C6C);
		Player * localPlayer4 = (Player*)*(DWORD*)(dwGetModuleBaseAddress(PID, _T("server.dll")) + 0x7B4C7C);
		if (localPlayer != 0)
		{
			if(healthHack)
				localPlayer->iHealth = 101;

			if (GetAsyncKeyState(VK_INSERT))
				localPlayer->pos.z += 100.0;
			if (GetAsyncKeyState(VK_DELETE))
				localPlayer->pos.z -= 100.0;

			if (GetAsyncKeyState(VK_UP))
				localPlayer->pos.x += 100.0;
			if (GetAsyncKeyState(VK_DOWN))
				localPlayer->pos.x -= 100.0;

			if (GetAsyncKeyState(VK_RIGHT))
				localPlayer->pos.y += 100.0;
			if (GetAsyncKeyState(VK_LEFT))
				localPlayer->pos.y -= 100.0;

			if (GetAsyncKeyState(VK_HOME))
				healthHack = !healthHack;

			if (GetAsyncKeyState(VK_SUBTRACT))
			{
				savePos.y = localPlayer->pos.y;
				savePos.z = localPlayer->pos.z;
				savePos.x = localPlayer->pos.x;
			}

			if (GetAsyncKeyState(VK_MULTIPLY))
			{
				if (savePos.y == 0 || savePos.x == 0 || savePos.z == 0)
				{
					savePos.y = localPlayer->pos.y;
					savePos.z = localPlayer->pos.z;
					savePos.x = localPlayer->pos.x;
				} 
				else
				{
					localPlayer->pos.y = savePos.y;
					localPlayer->pos.z = savePos.z;
					localPlayer->pos.x = savePos.x;
				}			
			}
		}		
		Sleep(100);
	}
	return 0;
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved) {
	switch (reason) {
	case DLL_PROCESS_ATTACH:
		CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ProcessThread, 0, 0, 0);
	}
	return true;
}
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
Great video ending :p

Really nice job!

FYI when you're internal you don't need to use GetModuleBaseAddress, you can use DWORD baseAddress = (DWORD)GetModuleHandle("server.dll");

Alternatively for 64bit too you can use uintptr_t in place of DWORD :)

That will sexy up your code a bit :p If you have any questions or need help let me know. Have you been to our discord yet?
 

r4z0r

Coder
Meme Tier VIP
Jul 21, 2016
246
1,678
13
Rake;44063 said:
Great video ending :p

Really nice job!

FYI when you're internal you don't need to use GetModuleBaseAddress, you can use DWORD baseAddress = (DWORD)GetModuleHandle("server.dll");

Alternatively for 64bit too you can use uintptr_t in place of DWORD :)

That will sexy up your code a bit :p If you have any questions or need help let me know. Have you been to our discord yet?
That rly makes the code more sexy xD thxx!
And yes, I've been there a few times, it's a rly good place to share knowledge! Thanks for all the support and the invite to the discord.
 

PwndDepot

I has a status
Dank Tier VIP
Trump Tier Donator
Dank Tier Donator
Nov 5, 2014
239
7,748
19
Rake;44063 said:
Great video ending :p

Really nice job!

FYI when you're internal you don't need to use GetModuleBaseAddress, you can use DWORD baseAddress = (DWORD)GetModuleHandle("server.dll");

Alternatively for 64bit too you can use uintptr_t in place of DWORD :)

That will sexy up your code a bit :p If you have any questions or need help let me know. Have you been to our discord yet?
And I actually learned something today...
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Similar threads

Community Mods