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

Module: CS Hack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 12-06-2004 , 00:24   Module: CS Hack
Reply With Quote #1

CS Hack is an AMX Mod X module that adds even more Counter-Strike specific natives than the Cstrike and CSX modules. This goes beyond what is allowed by the Half-Life SDK and Metamod by using a technique that I like to call "memory hacking". It's a rather simple technique in reality. It's really just a matter of reading and patching bytes in memory. What this module does is read and patch values in the CS server binary (DLL or SO) while the server is running.

This has the potential to crash the server if the patching is incorrect. So any possible bugs in this module COULD crash your servers. I will warn you of that ahead of time. Also on the off chance that Counter-Strike gets an update, it's possible none of the natives will work due to offset changes.

The only hard part in creating this module was actually finding the right values that should be patched and/or read. There was the also the problem that executable code in memory cannot be overwritten by default. But that can be overcome fairly easily with a few functions in the Win32 API and Linux system calls.

I will be writing up a document/tutorial detailing the work I have done so that others might be able to find some useful memory values to change in the future. However, I want to make it clear that I will not be adding natives to this module. I will fix any possible bugs with the current set of natives though. Since I recently joined the SourceMod development team, I want to concentrate on doing anything I can to help that project and I don't really want to do any more work for games on the HL1 engine. I will be writing a similar version of this module for Counter-Strike: Source and SourceMod in the future.

This module has been released more as a proof of concept rather than a full and greatly usable module. I had been hoping to have more useful natives before I was going to release it. But you are all certainly welcome to use it in a plugin if you find some of these natives useful. I have not done any testing whatsoever on Condition Zero, so its possible this module will not work on that mod. The CS and CZ server binaries are quite similar, I have noticed. In fact they are the same size. So its also possible this will work. But I make no guarantees on CZ compatibilty.

The source code is available in the SVN (HERE). I feel that my memory code is a mess and could have been designed better. I'm really not that proud of the code overall, heh. But it should work. :-P But it surely will be rewritten for the CS:S version.

Known Issues
  • Changing the price of an HE grenade will also change the price of a smoke grenade and vice versa on an AMD64 machine. This appears it cannot be fixed very easily. If someone has a suggestion, I'm all ears.
  • Changing the minimum roundtime on an AMD64 machine can cause players to be virtually immobile if changed below 1.0. It could also cause a crash if set above 1.0. This also appears to be very difficult to fix.
  • The module doesn't seem to work on FreeBSD servers
If anyone finds any bugs, feel free to report them. I've tested all the natives on all platforms, but chances are I still missed something.

And much thanks goes to BAILOPAN, ghost_of_evilspy (AKA hullu), PM, JGHG, Ronkkrop, and BlueRaja for their help and support. Thanks for putting up with me on AIM, MSN, and IRC. I could not have completed this module without you guys.

EDIT: I am no longer supporting this module. I need to move on to HL2, CS:S, and SourceMod. If there's a bug you want fixed, just going to have to fix it yourself.

So without further ado, the download along with a sample plugin and the include files are provided below.
Attached Files
File Type: zip cshack_amxx.zip (60.0 KB, 7965 views)

Last edited by DS; 02-11-2008 at 12:03. Reason: Updated source code link to point to user SVN repository
DS is offline
BAILOPAN
Join Date: Jan 2004
Old 12-06-2004 , 00:26  
Reply With Quote #2

This is one of the coolest modules ever made, I watched DS working on this thing over IRC for what feels like a month now.

The dynamic memory hacking in this module are a GREAT resource for learning more about memory hacking and binary file formats.

Great work
__________________
egg
BAILOPAN is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 12-06-2004 , 00:36  
Reply With Quote #3

Great job
Freecode is offline
Ronkkrop
Member
Join Date: May 2004
Old 12-06-2004 , 00:39  
Reply With Quote #4

Great Great work DS. You tha man! I plan on using this module lots ;)

This module makes many many things possible to amxx scripters.

Not only that, but give DS shots. Ive never seen somebody with so much ambition to get this thing done. I seriously dont think he slept at all since he's been working on it. Every time i messaged the guy on msn, he was workin on it...

[22:23] Broken: Released
[22:23] Broken: http://forums.alliedmods.net/showthread.php?t=8230
[22:24] Broken: Now I think I'm going to go to sleep

lol...you deserve it. Sleep well, the amxx community salutes you on this one
__________________
"I refuse to join any club that would have me as a member."
--Groucho Marx
Ronkkrop is offline
Send a message via ICQ to Ronkkrop Send a message via AIM to Ronkkrop Send a message via MSN to Ronkkrop Send a message via Yahoo to Ronkkrop
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 12-06-2004 , 00:42  
Reply With Quote #5

Matter of fact this is proly the best module written in this and other communitites. Something so complex.......wow what a great job.
Freecode is offline
BlueRaja
Senior Member
Join Date: Nov 2004
Old 12-06-2004 , 00:43  
Reply With Quote #6

Kickass.

Can't wait to play around with this one ^_^ Great work!
BlueRaja is offline
Send a message via AIM to BlueRaja Send a message via MSN to BlueRaja
Bluepeace
Junior Member
Join Date: May 2004
Old 12-06-2004 , 00:43  
Reply With Quote #7

Very interesting. Very nice piece of work, too... a clean, simple, powerful tool for the fundamentals.
__________________
Shut up.
Bluepeace is offline
breaddawson
Senior Member
Join Date: Jul 2004
Location: Beijing,China
Old 12-06-2004 , 10:22  
Reply With Quote #8

great work!!
and congratulations to ds~
u finally got this!
i wonder when can i do the same work as u.....
ha,i need to work harder...
__________________
i'm bread dawson ,a chinese boy
wish u be happy~
breaddawson is offline
Send a message via ICQ to breaddawson Send a message via MSN to breaddawson
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 12-06-2004 , 10:25  
Reply With Quote #9

Omfg uber l33tness lololo 1337 ban

Really, nice work, I am looking forward to the release of this module for sourcemod =P
__________________
hello, i am pm
PM is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 12-06-2004 , 21:09  
Reply With Quote #10

Quote:
Originally Posted by PM
I am looking forward to the release of this module for sourcemod =P
Stop dreamig PM.
Freecode is offline
Reply


Thread Tools
Display Modes

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 01:03.


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