OpenGL Hook + Counter Strike WallHack

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

WiTH

Jr.Coder
Full Member
Nobleman
May 24, 2012
58
458
1
Since many people are searching for an opengl hook, i thought about releasing this one :)

I included a DrawBox function so you have an idea how to draw in opengl. I also added XQZ wallhack, for the old cs 1.6: Protocol 48, Build 4554. I tested this hook in other games like assault cube and it works fine, but it doesn't work in the newest cs 1.6 steam version.
I didn't find a working opengl hook for the newest 1.6 in some time, but godly's engine hook is working for the steam version, so if you want to draw and code other stuff in the newest cs 1.6 you can download his base, just google it
I'm not really good with opengl, but if you need some help feel free to PM me, idk how to code wallhack or nosky for assault cube, but i have some snippets to code nosmoke and nosky for old cs :p Anyways here is the opengl hook

C++:
#pragma comment(lib,"OpenGL32.lib")
#pragma comment(lib,"GLu32.lib")

#include <windows.h>
#include <string>
#include <tlhelp32.h>
#include <iostream>
#include <gl\gl.h>
#include <gl\glu.h>

typedef void ( APIENTRY *glBegin_t )( GLenum );
typedef void ( APIENTRY *glEnd_t )( void );
typedef void ( APIENTRY *glClear_t )( GLbitfield );
typedef void ( APIENTRY *glVertex3fv_t )( const GLfloat *v );
typedef void ( APIENTRY *glVertex3f_t )( GLfloat x,  GLfloat y,  GLfloat z );
typedef void ( APIENTRY *glEnable_t )( GLenum );

glBegin_t pglBegin = NULL;
glEnd_t pglEnd = NULL;
glClear_t pglClear = NULL;
glVertex3fv_t pglVertex3fv = NULL;
glVertex3f_t pglVertex3f = NULL;
glEnable_t pglEnable = NULL;

bool wallhack = false;

void DrawBox(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) 
{ 
glBegin(GL_QUADS); 
glVertex3f(x,y,z); 
glVertex3f(x+width,y,z); 
glVertex3f(x+width,y+height,z); 
glVertex3f(x,y+height,z); 
glEnd(); 
} 


//=================================================================================
// ###################### Hooked OpenGL Functions #################################
//=================================================================================

void APIENTRY Hooked_glBegin( GLenum mode )
{
	if (GetAsyncKeyState(VK_F1)&1) wallhack = !wallhack;

	if (wallhack)
	{
		if(mode == GL_TRIANGLES || mode == GL_TRIANGLE_STRIP || mode == GL_TRIANGLE_FAN)
			glDepthRange(0, 0.5);
		else
			glDepthRange(0.5, 1);
	}

	if(pglBegin)
		(*pglBegin)(mode);
}

void APIENTRY Hooked_glEnd( void )
{
	(*pglEnd)();
}

void APIENTRY Hooked_glVertex3fv( GLfloat *v )
{	
	(*pglVertex3fv)( v );
}


void APIENTRY Hooked_glVertex3f ( GLfloat x,  GLfloat y,  GLfloat z )
{
	(*pglVertex3f)( x, y, z );
}

void APIENTRY Hooked_glClear( GLbitfield mask )
{
	(*pglClear)( mask );
}

void APIENTRY Hooked_glEnable (GLenum cap)
{
		/*if (GetAsyncKeyState(VK_F2))
			DrawBox(200,100,0,50,30);*/

	(*pglEnable)(cap);
}

void *DetourFunc( BYTE *src, const BYTE *dst, const int len )
{
	BYTE *jmp = (BYTE*)malloc( len + 5 );
	DWORD dwback;
	VirtualProtect( src, len, PAGE_READWRITE, &dwback );
	memcpy( jmp, src, len );
	jmp += len;
	jmp[0] = 0xE9;
	*(DWORD*)( jmp + 1 ) = (DWORD)( src + len - jmp ) - 5;
	src[0] = 0xE9;
	*(DWORD*)( src + 1 ) = (DWORD)( dst - src ) - 5;
	VirtualProtect( src, len, dwback, &dwback );
	return ( jmp - len );
}
void HookGL()
{
	HMODULE hOpenGL = GetModuleHandle("opengl32.dll");
	pglVertex3fv =   (glVertex3fv_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glVertex3fv" ), (LPBYTE)&Hooked_glVertex3fv, 6 );
	pglVertex3f  =   (glVertex3f_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glVertex3f" ), (LPBYTE)&Hooked_glVertex3f, 6);
	pglBegin     =   (glBegin_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glBegin"),(LPBYTE)&Hooked_glBegin,6);
	pglEnd       =   (glEnd_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glEnd" ), (LPBYTE)&Hooked_glEnd, 6 );
	pglClear     =   (glClear_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glClear" ), (LPBYTE)&Hooked_glClear, 7 );
	pglEnable    =   (glEnable_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glEnable"), (LPBYTE)&Hooked_glEnable, 6);
}
	

DWORD WINAPI dwMainThread( LPVOID )
{	
	HookGL();

	return TRUE;
}

BOOL WINAPI DllMain( HINSTANCE hInstDLL,DWORD dwReason,LPVOID lpReserved )
{
	if( dwReason==DLL_PROCESS_ATTACH )
		CreateThread(0,0,dwMainThread,0,0,0);

return TRUE;
}
You can copy and paste this, you shouldn't get any errors. Just make sure you use multi-byte character set and compile it as a dll, hf :D
Credits: Panzer/Blade/Random Pastebin
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Since many people are searching for an ogl hook, i thought about releasing this one :)

I included a DrawBox function so you have an idea how to draw in opengl. I also added XQZ wallhack, for the old cs 1.6: Protocol 48, Build 4554. I tested this hook in other games like assault cube and it works fine, but it doesn't work in the newest cs 1.6 steam version.
I didn't find a working opengl hook for the newest 1.6 in some time, but godly's engine hook is working for the steam version, so if you want to draw and code other stuff in the newest cs 1.6 you can download his base, just google it
I'm not really good with opengl, but if you need some help feel free to PM me, idk how to code wallhack or nosky for assault cube, but i have some snippets to code nosmoke and nosky for old cs :p

C++:
#pragma comment(lib,"OpenGL32.lib")
#pragma comment(lib,"GLu32.lib")

#include <windows.h>
#include <string>
#include <tlhelp32.h>
#include <iostream>
#include <gl\gl.h>
#include <gl\glu.h>

typedef void ( APIENTRY *glBegin_t )( GLenum );
typedef void ( APIENTRY *glEnd_t )( void );
typedef void ( APIENTRY *glClear_t )( GLbitfield );
typedef void ( APIENTRY *glVertex3fv_t )( const GLfloat *v );
typedef void ( APIENTRY *glVertex3f_t )( GLfloat x,  GLfloat y,  GLfloat z );
typedef void ( APIENTRY *glEnable_t )( GLenum );

glBegin_t pglBegin = NULL;
glEnd_t pglEnd = NULL;
glClear_t pglClear = NULL;
glVertex3fv_t pglVertex3fv = NULL;
glVertex3f_t pglVertex3f = NULL;
glEnable_t pglEnable = NULL;

bool wallhack = false;

void DrawBox(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) 
{ 
glBegin(GL_QUADS); 
glVertex3f(x,y,z); 
glVertex3f(x+width,y,z); 
glVertex3f(x+width,y+height,z); 
glVertex3f(x,y+height,z); 
glEnd(); 
} 


//=================================================================================
// ###################### Hooked OpenGL Functions #################################
//=================================================================================

void APIENTRY Hooked_glBegin( GLenum mode )
{
	if (GetAsyncKeyState(VK_F1)&1) wallhack = !wallhack;

	if (wallhack)
	{
		if(mode == GL_TRIANGLES || mode == GL_TRIANGLE_STRIP || mode == GL_TRIANGLE_FAN)
			glDepthRange(0, 0.5);
		else
			glDepthRange(0.5, 1);
	}

	if(pglBegin)
		(*pglBegin)(mode);
}

void APIENTRY Hooked_glEnd( void )
{
	(*pglEnd)();
}

void APIENTRY Hooked_glVertex3fv( GLfloat *v )
{	
	(*pglVertex3fv)( v );
}


void APIENTRY Hooked_glVertex3f ( GLfloat x,  GLfloat y,  GLfloat z )
{
	(*pglVertex3f)( x, y, z );
}

void APIENTRY Hooked_glClear( GLbitfield mask )
{
	(*pglClear)( mask );
}

void APIENTRY Hooked_glEnable (GLenum cap)
{
		/*if (GetAsyncKeyState(VK_F2))
			DrawBox(200,100,0,50,30);*/

	(*pglEnable)(cap);
}

void *DetourFunc( BYTE *src, const BYTE *dst, const int len )
{
	BYTE *jmp = (BYTE*)malloc( len + 5 );
	DWORD dwback;
	VirtualProtect( src, len, PAGE_READWRITE, &dwback );
	memcpy( jmp, src, len );
	jmp += len;
	jmp[0] = 0xE9;
	*(DWORD*)( jmp + 1 ) = (DWORD)( src + len - jmp ) - 5;
	src[0] = 0xE9;
	*(DWORD*)( src + 1 ) = (DWORD)( dst - src ) - 5;
	VirtualProtect( src, len, dwback, &dwback );
	return ( jmp - len );
}
void HookGL()
{
	HMODULE hOpenGL = GetModuleHandle("opengl32.dll");
	pglVertex3fv =   (glVertex3fv_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glVertex3fv" ), (LPBYTE)&Hooked_glVertex3fv, 6 );
	pglVertex3f  =   (glVertex3f_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glVertex3f" ), (LPBYTE)&Hooked_glVertex3f, 6);
	pglBegin     =   (glBegin_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glBegin"),(LPBYTE)&Hooked_glBegin,6);
	pglEnd       =   (glEnd_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glEnd" ), (LPBYTE)&Hooked_glEnd, 6 );
	pglClear     =   (glClear_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glClear" ), (LPBYTE)&Hooked_glClear, 7 );
	pglEnable    =   (glEnable_t)DetourFunc( (LPBYTE)GetProcAddress(hOpenGL, "glEnable"), (LPBYTE)&Hooked_glEnable, 6);
}
	

DWORD WINAPI dwMainThread( LPVOID )
{	
	HookGL();

	return TRUE;
}

BOOL WINAPI DllMain( HINSTANCE hInstDLL,DWORD dwReason,LPVOID lpReserved )
{
	if( dwReason==DLL_PROCESS_ATTACH )
		CreateThread(0,0,dwMainThread,0,0,0);

return TRUE;
}
You can copy and paste this, you shouldn't get any errors. Just make sure you use multi-byte character set and compile it as a dll, hf :D
Credits: Panzer/Blade/Random Pastebin


Wow this is really useful. Will it be possible to hook opengl and make Wallhack + Chams with this?:)
 
Last edited by a moderator:

WiTH

Jr.Coder
Full Member
Nobleman
May 24, 2012
58
458
1
Wow this is really useful. Will it be possible to make Wallhack + Chams with this?:)
i think it's possible, i saw chams for cs 1.6 some time ago but i never tried to code chams but i already coded wallhack :)
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
i think it's possible, i saw chams for cs 1.6 some time ago but i never tried to code chams but i already coded wallhack :)
Which hook would I have to use for Chams? I mean which function?:)
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
I guess I'll need OpenGL SDK. From where do I get it?:)
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
glDrawElements
Okay, but how do I hook it? Just the same thing like with glDrawElements and then DetourFunction? Is there any Model Logger or do I have to make my own?
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
19,938
76
Okay, but how do I hook it? Just the same thing like with glDrawElements and then DetourFunction? Is there any Model Logger or do I have to make my own?
Yes, you can do it the same way
 

WiTH

Jr.Coder
Full Member
Nobleman
May 24, 2012
58
458
1
Okay, but how do I hook it? Just the same thing like with glDrawElements and then DetourFunction? Is there any Model Logger or do I have to make my own?
I think you can hook that the same way i hooked the others, but im not sure about the model logger
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Okay.:) I'll try it out. Do I have to inject with AutoInject so at startup or at any time? I'll try it out now.
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
19,938
76
Okay.:) I'll try it out. Do I have to inject with AutoInject so at startup or at any time? I'll try it out now.
If you need to inject at startup, then the hook usually uses a function which gets called only once during runtime. For example directx createdevice - it's only called on device creation, which is normally done once. The functions we are talking about in this thread are normal rendering functions called one or more times per frame.
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
If you need to inject at startup, then the hook usually uses a function which gets called only once during runtime. For example directx createdevice - it's only called on device creation, which is normally done once. The functions we are talking about in this thread are normal rendering functions called one or more times per frame.
Ah okay I'll try it with AutoInject
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
I injected ingame, with Winject. Wallhack works. :) I can even shoot through walls. But this is also possible by just modifying ac_client.exe. I'll look for a chams tutorial:D


Btw: Thank you very much to share this I was looking for this a long time.:)
 

jamesst20

The Future Hacker
Dank Tier Donator
Nobleman
Apr 1, 2013
86
633
0
Hi :)

I improved a lot the code, well I added a lot of drawing fonctions (Empty Circle, Filled Circle, Empty Rectangle, Filled Rectangle, Drawing Pixel, Drawing empty triangle, Drawing filled Triangle, etc.....). I have done all my tests in Assault Cube and it works pretty well.

There is only a small bug where what I draw seems to be repeated.

Here is my full project if someone could take a look at it and tell me what is wrong, it would be really amazing!

Virus Scan : https://www.virustotal.com/fr/file/...d0471843aca2bb64ba5ebcb9/analysis/1365881064/
 

Attachments

You can download 0 Attachments

WiTH

Jr.Coder
Full Member
Nobleman
May 24, 2012
58
458
1
Hi :)

I improved a lot the code, well I added a lot of drawing fonctions (Empty Circle, Filled Circle, Empty Rectangle, Filled Rectangle, Drawing Pixel, Drawing empty triangle, Drawing filled Triangle, etc.....). I have done all my tests in Assault Cube and it works pretty well.

There is only a small bug where what I draw seems to be repeated.

Here is my full project if someone could take a look at it and tell me what is wrong, it would be really amazing!

Virus Scan : https://www.virustotal.com/fr/file/...d0471843aca2bb64ba5ebcb9/analysis/1365881064/
great, i'll take a look at it :D
 
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.

Community Mods