Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Shadow`'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    MN
    Posts
    643
    Reputation
    74
    Thanks
    3,004
    My Mood
    Relaxed

    An In-Depth Look at a Simple Hack

    Hello all, this is a thread that will show you an in-depth look at a simple hack. This thread will go farther under the surface than some regular tutorials, but will crack down on the basics of what the beginners need to know -but sometimes lack the knowledge of. Since this thread is going to be somewhat lengthy, I may have some mistakes, so please let me know of things to add or improvements to what I say here in the comments. So, lets get started.

    Section 1: An Overview

    This section will cover an overview of the hack, it's general purpose and how it works. I coded two memory hacks for this tutorial, Superbullets and Nametags, so that I can explain their differences, but that will come in a later section. The hack solution is given at the bottom of this thread, so download it now and continue. The general purpose of this hack is to initiate the hack commands by copying the given bytes to the given address defined inside the solution.

    How it works:

    1. The hack in injected, and all thread calls to the DllMain function are disabled.
    2. The dwThread thread is created, and it waits for the game to load the given modules defined in the IsGameReady() function.
    3. Once the game is ready, it calls the InitHacks() void, which initializes an infinite loop which is needed for the hacks inside to be called each cycle.
    4. When the user goes inside a game and presses one of the hotkeys (Numberpad 1 or 2), then the given hacks will be initialized by the WriteToMemory function.
    5. When one of the two things inside the "if" statement for lets say Superbullets for example are not true, then the hack jumps to the else statement, which will copy the default bytes of the game and place them on the address given.

    Now that the hack has been over-viewed, lets move on to more specific things inside.

    Section 2: Memory Editing

    This is a sort of fuzzy topic for some members on this forum, while others have it completely down. Because of this, I will go over it like I am explaining it to someone with just a little knowledge of C++ (knows about variables such as integers, booleans, etc).

    The memory function we will be using:

    Code:
    void WriteToMemory(PVOID address, void* val, int bytes)
    {
    	DWORD d, ds;
    	VirtualProtect(address, bytes, PAGE_EXECUTE_READWRITE, &d);
    	memcpy(address, val, bytes);
    	VirtualProtect(address, bytes, d, &ds);
    }
    At first glance, you may have seen a familiar function called "memcpy". This function has 3 parameters, destination (first), source (second), and size (third). What it does is the trick to how our memory functions work; it copies the number of bytes from the source and places them on the memory block of the address we described, or destination. Once we know exactly what memcpy does, this function of ours is easy to understand. The first virtualprotect call makes the memory writable, so we can access it with memcpy. When memcpy does its function, the next virtualprotect call re-protects the memory.

    Lets now look at some code from the hack, to explain what it does specifically.

    Code:
    WriteToMemory((PVOID)SuperbulletsAddress, "\x90\x90\x90", 3);
    We know how the memory function works, so this should be easy as well. Since we defined the address, but the function takes a type PVOID, we need to cast the address (which is an integer), which is why we have "(PVOID)" in front of the address we defined. The "\x90\x90\x90" are the bytes that will be placed on the address. The "3" is just the length of the bytes that will be placed. The "\x90" we have in the source code is just the NOP instruction, known as No Operation (Don't do anything at that place of memory). You may be wondering why the Nametags hack has two calls to the memory function, and it's because the result we want will not occur unless we edit the memory at those two specific address locations.

    Section 3: DllMain and the Connections

    Our DllMain function is pretty straight forward, so I won't go too in depth with it. It looks like this:

    Code:
    BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
    {
    	DisableThreadLibraryCalls(hModule);
    	if(dwReason == DLL_PROCESS_ATTACH)
    	{
    		MessageBoxA(NULL, "The hack has injected!", "A Simple Hack", MB_OK);
    		CreateThread(NULL, NULL, dwThread, NULL, NULL, NULL);
    	}
    	return TRUE;
    }
    When windows links a dll with a program, windows calls the library's DllMain function. This is why DllMain is so necessary in hacks. The APIENTRY in the function name is just something windows uses internally. The HMODULE hModule is just a handle for the library to use. the DWORD dwReason is what will be used to tell us if a new program has linked to the dll for the first time, which is why it is compared to DLL_PROCESS_ATTACH in the "if" statement. Inside the "if" statement is just a messagebox that displays text that you want, which also lets you know that dwReason did indeed equal DLL_PROCESS_ATTACH (The dll did link to the process). The CreateThread does just as is shows; it creates the dwThread thread which contains our void, which contains our hacks and such.

    Section 4: Variables and the Extras

    As you may have seen in the base, our variables are located inside a struct in Main.h. We can call our booleans like bSuperbullets and bNametags by creating an object of our struct, which is what "sVariables Variables" shows. To access the variable inside the struct, we use the dot operator (.) on the object we created.

    Since this would be a somewhat short section, I'll also go over some of the minor "extra" features that would also create a short section. One extra is the GetAsyncKeyState function. It's used for getting a current key's state on your keyboard, like if it's up or down at the time. In the hack, it's used for toggling our variables on or off, according to their state at the time.

    Section 5: Tips and Tricks

    Now that you know how this hack works, you should know how to work it if it becomes outdated. If the off bytes for a hack function change for some reason, then the simplest way to check for the new ones is to just locate the address in OllyDBG. Here are the steps to find the original bytes for any hack function (the on bytes will be hack specific, like NOPing a section).

    1. Open OllyDBG and have open a CA Dump. If you don't know how to get a CA dump, then look at this thread, which includes a cshell dumper and a brief overview on how to do it.

    2. Once the dumped cshell is open, press the "run" triangle located on the top bar of the program


    3. Once you press the blue triangle, press CTRL + G and enter your address (without the 0x).


    4. When you click "enter", it will bring you to the address that you entered. After the address is a line that shows "75 05", and those are the bytes located at that address.


    5. Congrats, you now have your new off bytes (\x75\x05).

    Section 6: Conclusion

    There are some comments inside the actual hack as well, but if you read this thread then you will know everything written down inside. I hope you enjoyed this information, and help me improve by commenting on your thoughts of this, what to add or remove, and other things.
    <b>Downloadable Files</b> Downloadable Files
    Last edited by Shadow`; 01-01-2013 at 12:37 PM.
    Currently coding applications in Java and C++.

    "It is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be." -Isaac Asimov

  2. The Following 15 Users Say Thank You to Shadow` For This Useful Post:

    ainslie (01-02-2013),Awcomenoutjr (01-11-2013),ballin19 (02-04-2013),captation (03-18-2013),ch1025 (07-09-2013),ctpsolo (01-01-2013),[MPGH]Flengo (01-01-2013),G1veItAll (01-01-2013),[MPGH]Genesis (01-08-2013),gibam761 (01-25-2013),GoldWhite (01-01-2013),merp. (01-01-2013),pDevice (01-01-2013),seifone01 (01-01-2013),teehee15 (01-01-2013)

  3. #2
    Ch40zz-C0d3r's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    839
    Reputation
    44
    Thanks
    400
    My Mood
    Twisted
    Thanks for the helping noobs
    I hope they'll learn something.
    Personally, I dont like tutorials, I learned all stuff by myself and Im happy about that :P

    Progress with my game - "Disbanded"
    • Fixed FPS lag on spawning entities due to the ent_preload buffer!
    • Edit the AI code to get some better pathfinding
    • Fixed the view bug within the sniper scope view. The mirror entity is invisible now!
    • Added a new silencer for ALL weapons. Also fixed the rotation bugs
    • Added a ton of new weapons and the choice to choose a silencer for every weapon
    • Created a simple AntiCheat, noobs will cry like hell xD
    • The name will be Disbanded, the alpha starts on the 18th august 2014



    Some new physics fun (Serversided, works on every client)



    My new AI
    http://www.youtube.com/watch?v=EMSB1GbBVl8

    And for sure my 8 months old gameplay with 2 friends
    http://www.youtube.com/watch?v=Na2kUdu4d_k

  4. #3
    merp.'s Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    147
    Reputation
    10
    Thanks
    301
    My Mood
    Bored
    Just skimming through this tutorial taught me something. Thank you!


    Quote Originally Posted by Ch40zz-C0d3r View Post
    Thanks for the helping noobs
    I hope they'll learn something.
    Personally, I dont like tutorials, I learned all stuff by myself and Im happy about that :P
    Well, I am a noob and I did learn something.

    I hope there can be more tutorials/explanations on specific things like this!

  5. #4
    ctpsolo's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    252
    Reputation
    10
    Thanks
    34
    My Mood
    Amused
    Quote Originally Posted by Ch40zz-C0d3r View Post
    Thanks for the helping noobs
    I hope they'll learn something.
    Personally, I dont like tutorials, I learned all stuff by myself and Im happy about that :P
    Imo it's a pretty vague line between using say a tutorial and looking at/using bases or code from other people, I think very few people can claim that they learned everything on their own without having gotten help one way or another with things along the way. And a lot of people on mpgh seems to be collaborating too with their projects. I don't mean any disrespect though and if you really accomplished the latter one, that's truly something to be proud of. My point was merely to say that in a way most of us are leechers one way or another, just some are less than others

    Anyway good tutorial. This is the kind of thing I would have appreciated reading two years ago when I started out with CA.

  6. #5
    nigger's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    224
    Reputation
    36
    Thanks
    93
    Why not just use Codernevers tutorial? All you did was explain what each function does. If you're going to create a tutorial on a simple hack at least use a menu because there are already 1000 other tutorials for hotkey/auto on bases.

  7. The Following 2 Users Say Thank You to nigger For This Useful Post:

    [MPGH]Flengo (01-01-2013),[MPGH]Genesis (01-08-2013)

  8. #6
    Shadow`'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    MN
    Posts
    643
    Reputation
    74
    Thanks
    3,004
    My Mood
    Relaxed
    Quote Originally Posted by nigger View Post
    Why not just use Codernevers tutorial? All you did was explain what each function does. If you're going to create a tutorial on a simple hack at least use a menu because there are already 1000 other tutorials for hotkey/auto on bases.
    This isn't really a tutorial, all it is is just me going in depth on how a simple hotkey hack functions, giving a more in depth look than other threads, and clearing up a lot of things that I would want explained when I began game hacking.
    Currently coding applications in Java and C++.

    "It is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be." -Isaac Asimov

  9. The Following User Says Thank You to Shadow` For This Useful Post:

    [MPGH]Flengo (01-01-2013)

  10. #7
    BACKD00R's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Brazil
    Posts
    10,710
    Reputation
    1814
    Thanks
    31,818
    My Mood
    Drunk
    @Shadow` We need 2 virus scans! Fix it



     

    Skype : BACKD00R-MPGH

     

    • Contributor: October, 31th 2011
    • CA BR Minion: January, 03th 2012
    • CF AL Minion: April, 07th 2012
    • CA Minion: April, 15th 2012
    • CF Minion: July, 03th 2012
    • PB Minion: January, 25th 2013
    • AVA Minion : February, 02th 2013
    • Arctic Combat minion: April, 03th 2013
    • Warface Minion: April, 03th 2013

    • Minion + : July 08th 2012
    • Moderator : January 21th 2013
    • Global Moderator : August 1st 2013







  11. #8
    nigger's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    224
    Reputation
    36
    Thanks
    93
    Quote Originally Posted by Shadow` View Post
    This isn't really a tutorial, all it is is just me going in depth on how a simple hotkey hack functions, giving a more in depth look than other threads, and clearing up a lot of things that I would want explained when I began game hacking.
    Oh okay. This is a great thread then. Good work Shadow!

  12. The Following User Says Thank You to nigger For This Useful Post:

    Shadow` (01-01-2013)

  13. #9
    Shadow`'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    MN
    Posts
    643
    Reputation
    74
    Thanks
    3,004
    My Mood
    Relaxed
    Quote Originally Posted by BACKD00R View Post
    @Shadow` We need 2 virus scans! Fix it
    Sorry :3

    Virus Scan 1
    Virus Scan 2
    Currently coding applications in Java and C++.

    "It is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be." -Isaac Asimov

  14. #10
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    Ontario, Canada
    Posts
    16,016
    Reputation
    3421
    Thanks
    11,332
    My Mood
    Happy
    Quote Originally Posted by Shadow` View Post
    Re-Upload the attachment that you had
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.
     
     
    VM | PM

    Publicist Since 04.04.2015
    Middleman Since Unknown - Unknown
    Global Moderator Since 08.01.2013
    Donator Since 05.29.2013

    Minion+ Since 04.18.2013

    District 187 Minion Since 04.04.2013
    Steam Minion Since 02.26.2013
    WarRock Minion Since 02.19.2013
    A.V.A Minion Since 02.13.2013
    DayZ Minion Since 01.21.2013
    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  15. #11
    Shadow`'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    MN
    Posts
    643
    Reputation
    74
    Thanks
    3,004
    My Mood
    Relaxed
    Quote Originally Posted by Flengo View Post


    Re-Upload the attachment that you had
    Done
    Currently coding applications in Java and C++.

    "It is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be." -Isaac Asimov

  16. #12
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    Ontario, Canada
    Posts
    16,016
    Reputation
    3421
    Thanks
    11,332
    My Mood
    Happy
    Quote Originally Posted by Shadow` View Post
    Done
    Attachment is safe and clean.

    Thanks for helping others out

    /Approved
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.
     
     
    VM | PM

    Publicist Since 04.04.2015
    Middleman Since Unknown - Unknown
    Global Moderator Since 08.01.2013
    Donator Since 05.29.2013

    Minion+ Since 04.18.2013

    District 187 Minion Since 04.04.2013
    Steam Minion Since 02.26.2013
    WarRock Minion Since 02.19.2013
    A.V.A Minion Since 02.13.2013
    DayZ Minion Since 01.21.2013
    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  17. #13
    ainslie's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    1,142
    Reputation
    111
    Thanks
    563
    My Mood
    Fine
    Lovely work and very well written If I had, had this when I started to code hacks it would have made my life a lot easier!
    Respect List
    Dave84311
    GAYape

    AVGN
    Jabuuty671
    Arch Enemy
    Sketchy
    .::SCHiM::.
    Liz
    Dreamer
    Houston
    R3dLine



  18. #14
    MadDogz's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Location
    Auckland, New Zealand
    Posts
    22
    Reputation
    10
    Thanks
    2
    Thanks this helped alot

  19. #15
    R4v0r's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Location
    London
    Posts
    234
    Reputation
    11
    Thanks
    141
    My Mood
    Amazed
    Thanks for this, it really help me understand the Engine more

Page 1 of 2 12 LastLast

Similar Threads

  1. [Visual Basics Tutorial] Simple Injection. An in-depth look.
    By Jason in forum Programming Tutorials
    Replies: 48
    Last Post: 08-02-2016, 10:55 PM
  2. [Detected] LOOK at a simple hack,
    By pakeke80 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 11
    Last Post: 02-12-2012, 03:03 PM
  3. looking for warrock undetected hack
    By minimater in forum WarRock - International Hacks
    Replies: 10
    Last Post: 09-03-2007, 01:13 AM
  4. Small simple hack for the cho0bs
    By Grim09 in forum WarRock - International Hacks
    Replies: 25
    Last Post: 07-16-2007, 10:30 PM
  5. All what we need simple hack for now.
    By sieko in forum WarRock - International Hacks
    Replies: 10
    Last Post: 05-24-2007, 11:08 AM