Raised This Month: $32 Target: $400
 8% 

CVAR Hacker detection - my source


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anxiro
Member
Join Date: Jan 2005
Old 03-07-2005 , 05:07   CVAR Hacker detection - my source
Reply With Quote #1

Hi!

People asked me to share the code of my Hack-Detection.
Before there was a patch for filescanning I was able to scan for files on our server this took me for weeks to get it to work. Now this doesn't work anymore.

I found out I still can 'scan' for CVAR names on the client like Hack CVARs. For example the HLH_<cvar>. I searched on hackforums and downloads to get a lot of commands, which I could add in a text file.

I am a n00b if we talk about C++ Coding, but my scanner banned over 12 players on our server. So the piece of the code will look noobish and for some of you 'shit'. But who cares? It works, right?

I got a lot of questions and need some help for this coding.
Like the part I have:

if (some code) {
message or something
hacks++
}

if (some code) {
message etc.
hacks++
}

etc. etc.

I know this can be shorter with the 'for i =...' and 'next i'. But the code is yours! Look at the code and do some hudge major changes. It doesn't matter how you think about it, but thats why I share it -- to let you guys use and edit it.

My questions are:
- How to put it on Client-Connect?
- An easy'er way to scan?
- Anyone help for the textfile open/scan/close?
I think I sure do have a lot of more questions but those will come later.

Here is a piece of the code.
I used "-1" as standard value, but i dunno if this <still> works.
Just try/edit it.

Code:
char *target = engine->Cmd_Argv(1);
const char * name=playerinfo->GetName();
// HACK DETECTOR SIMPLE
// JUST LOOKS FOR SOME CVAR NAMES
// AND BANS THE MOFO
// COPYRIGHT FRANK WEIMA
// ********************************************
int hacks=0;
//const char * <something> =  engine->GetClientConVarValue(engine->IndexOfEdict(pEntity), "<cvar>" );
					// That will search for a CVAR.

					const char * test1 =  engine->GetClientConVarValue(engine->IndexOfEdict(pEntity), "hlh_box" );
					if (test1>="-1") // Dunno if -1 works. but test it.
									 // I used >="0", but most hacks use '0'.
					{
						hacks++;
					}

					const char * test2 =  engine->GetClientConVarValue(engine->IndexOfEdict(pEntity), "hlh_bunnyhop" );
					 if (test2>="-1")
					{
						hacks++;
					}


					const char * test3 =  engine->GetClientConVarValue(engine->IndexOfEdict(pEntity), "hlh_speed" );
					 if (test3>="-1")
					{
						hacks++;
					}
					 
					// I know this looks noobish, but i am not a pro.
					// Most ppl have an easy'er way. I removed the
					// part that the CVAR names will read from a text file.
					// Maybe other people can re-make that.
					

						if(hacks==0) {
						// Nothing found.
						// any code can put here like: "<name> is not a hacker".
					}
						else {
						// Most of the folowing might be 'n00bish' and 'shit'.
						// But this is the way I like it and how I use it.
						// And it Works, thats the point.
						// Im not a pro. So you're free to edit.
						


						// Just report it to everyone if he has hacks
						// I use my own CSAY command for this.
						// Center say. Fade in, Fade out.
						Q_snprintf( gBuffer, 128, "@csay [*RRMOD*] Cheater/Hacker: %s **\n",playerinfo->GetName());
						engine->ServerCommand(gBuffer);

						// Now let the player speak it himself:P 
						Q_snprintf(gBuffer, 128, "say **--** OMG! I am detected with %d hacks **-** \n",hacks); 
						engine->ClientCommand(pEntity,gBuffer1);
						
						// Kill him. Prevents for respawnhack. Tested!
						KillPlayer(pEntity,playerinfo,target);

						// Now, get the teamname.
						// It will be easyer to find player for other gamers? :)
						char *team;

						if(playerinfo->GetTeamIndex() == 0)
						{
							team="UnKnown";
						}
						
						if(playerinfo->GetTeamIndex() == 1)
						{
							team="Spect";
						}
				
						if(playerinfo->GetTeamIndex() == 2)
						{
							team="Terror";
						}

						if(playerinfo->GetTeamIndex() == 3)
						{
							team="CT";
						}

						// Bottomleft message, like the old: "(ADMIN): Hello everyone".
						// Print the name, and team
						Q_snprintf( gBuffer, 128, "@ssay [*RRMOD*] Name: %s (team: %s) \n",playerinfo->GetName(),team);
						engine->ServerCommand(gBuffer);
						// Total hacks.
						Q_snprintf( gBuffer, 128, "@ssay [*RRMOD*] Total hacks: %d \n",hacks);
						engine->ServerCommand(gBuffer);

						// Now after all the crappy things, just ban!!
						// Works with server command:
						//10:47:35 help admin_ban
						//10:47:35 "admin_ban"
						// - ban <partialTargetName> <minutes>0=permanant
						Q_snprintf( gBuffer, 128, "admin_ban %s 0",playerinfo->GetName());
						engine->ServerCommand(gBuffer);
					}
				}
					else
					{
					Q_snprintf( gBuffer, 128, "[RRMOD] Unknown Usage Message here:) \n"); 
					engine->ClientPrintf(pEntity, gBuffer ); 
					CreateAMessage(pEntity,"msg",gBuffer,engine->IndexOfEdict(pEntity));
					}
				}
		}
	return PLUGIN_STOP; // we handled this function so stop.
	}

Anyone suggestions?
And why not post your piece of the code here and tell us your futures?

Let me know. it worked for me!
And this is always 'good enough' till VACē comes out, right!?


- Frank Weima
anxiro is offline
Send a message via ICQ to anxiro
Fruchtzwerg
Member
Join Date: Dec 2004
Old 03-07-2005 , 05:50   Re: CVAR Hacker detection - my source
Reply With Quote #2

Quote:
Originally Posted by anxiro
Code:
const char * test1 =  engine->GetClientConVarValue(engine->IndexOfEdict(pEntity), "hlh_box" );
if (test1>="-1")
ROFL! Do you really caught cheaters with this wrong code?
__________________
Fruchtzwerg is offline
anxiro
Member
Join Date: Jan 2005
Old 03-07-2005 , 06:01  
Reply With Quote #3

d00d, i removed a lot of things. and added "-1" in stead of the real code. just in case for noobies

And yes it worked. But used 0 for that.
I used the part like "if <bla> ==0 (...)" and ">=0". You should understand
anxiro is offline
Send a message via ICQ to anxiro
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 03-07-2005 , 06:06  
Reply With Quote #4

Vac2 is supposedly being released this week.

Mani
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
anxiro
Member
Join Date: Jan 2005
Old 03-07-2005 , 06:08  
Reply With Quote #5

Oh, isn't that wat they say since November?
anxiro is offline
Send a message via ICQ to anxiro
Fruchtzwerg
Member
Join Date: Dec 2004
Old 03-07-2005 , 06:11  
Reply With Quote #6

Quote:
Originally Posted by anxiro
d00d, i removed a lot of things. and added "-1" in stead of the real code. just in case for noobies

And yes it worked. But used 0 for that.
I used the part like "if <bla> ==0 (...)" and ">=0". You should understand
Then you should change the topic of this thread to: "An example for worst code - dont use it, just laugh about it"
__________________
Fruchtzwerg is offline
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 03-07-2005 , 06:17  
Reply With Quote #7

Quote:
Originally Posted by anxiro
Oh, isn't that wat they say since November?
It was reported on cs-nation, but not an official report from Valve themselves so who knows.

www.csnation.net
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 03-07-2005 , 06:40  
Reply With Quote #8

Quote:
Originally Posted by Fruchtzwerg
Then you should change the topic of this thread to: "An example for worst code - dont use it, just laugh about it"
Fruchtzwerg, what's your contribution to the coding community ??
anxiro, was asked to post his code-example... he did say he's not an expert and this is for others to get ideas to implement and improve... If the examples can result in getting any cheaters stopped then what's wrong about it??

Mani, even with the old VAC, it took a long time until hacks were blocked and in some cases not at all... IF this work (or could be modified to work) and you configure it with a file of hack-cvars, it could be a very fast way to find a lot of stupid cheaters (well smart cheaters aren't that common and don't cause a lot of problem as cheating as good player or beeing a good player is almost the same thing on a public server)...

/X
XAD is offline
Fruchtzwerg
Member
Join Date: Dec 2004
Old 03-07-2005 , 07:35  
Reply With Quote #9

Quote:
Originally Posted by XAD
If the examples can result in getting any cheaters stopped then what's wrong about it??
This code is very bad, it could caught cheaters and it will caught clean gamers. Thats all, only bad code.
__________________
Fruchtzwerg is offline
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 03-07-2005 , 08:09  
Reply With Quote #10

Quote:
Originally Posted by Fruchtzwerg
This code is very bad, it could caught cheaters and it will caught clean gamers. Thats all, only bad code.
OK, I agree with what you say but not how you say it...

anxiro:
Code:
const char * test1 =  engine->GetClientConVarValue(engine->IndexOfEdict(pEntity), "hlh_box" );
if (test1>="-1")
What happens is that "test1" is a pointer to a string, in this case the "const char" version the "GetClientConVarValue".

Code:
if (test1>="-1")
This part will test if the pointer to the string containing the value is greater or equal to the string "-1". This has nothing to do with the actual values of the strings but only the location of the strings in memory. I think this is what "Fruchtzwerg" is nagging about... and he is correct (but wasn't very helpfull)... The result is therefore useless as it is the content you want to compare not memory pointers.

BUT, the idea might work even though the code is wrong...

/X
XAD is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode