Raised This Month: $ Target: $400
 0% 

CVAR Hacker detection - my source


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 06:38.


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