Forums > cpp >

DeepPain's Guide To: Hooking


Posts: 183

Threads: 10

Joined: Jul, 2020

Reputation: 3

Posted

What is a hook?

A hook is essentially a piece of code that lets us take control of functions that we want to hook, for instance if we hooked the lua_pushstring function in roblox we could make it push whatever string we liked onto the stack instead of whatever was provided when lua_pushstring was called, we could change the string to anything we want with a hook, or we could use this as a way to log what strings are getting pushed onto the stack, we would have to remove this as roblox has a check in place to make sure this doesnt happen.


How do hooks work?

well its simple really, all we do is overwrite an instruction with a JMP instruction to our function, we need 5 bytes to do this and if we cannot get 5 bytes we cannot place a hook, we also cant leave any bytes left in the function so we need to overwrite them with a NOP instruction.


Coding our hook

Well first off we need to use VirtualProtect and change the protection of the area we want to write over to PAGE_EXECUTE_READWRITE then we need to set all the bytes in the function to NOP, this is essentially clearing the bytes so that we dont have to worry about any other bytes when we place our hook, then we need to find the relative address between the function we want to hook and the function we want it to JMP to and then we subtract 5 because thats how many bytes the JMP will be, then we set the first byte in the function we want to hook to 0xE9 which is the first opcode in a JMP instruction, then we go to the next byte and set it to the relative address.

And finally we set the function we want to hook back to the protection it was before.

And thats it!

Heres my hook that I made for this thread (if you skid this i will kill you): https://pastebin.com/MDVTNcc5

DeepPain - Exploit Dev - Stuck In The Past

Friends WIth Laxion

davidTube

Exploit Developer

Posts: 1499

Threads: 61

Joined: Dec, 2018

Reputation: 14

Replied

nice guide for noobies

FlamePlus™ OWNER  |  UI & C# DEV, C++ BEGINNER  |

Exploits I have:  |  Syn X  |

|  Discord Server  |  My Discord  |  Download Flame+  |

ZaphireHacks

Exploit Dev

Posts: 855

Threads: 62

Joined: May, 2020

Reputation: 5

Replied

Epic

 

 

 

 

 

epic epic

Discord Accounts : Lunar#6284,ZaphireAlt#7417,Necrotic#1254

Exploits I use: Synapse,JJsploit,Coco Z

I am C# Dev and learning CPP right now get close to be able to make my own basic trainers soon 

DoTheConga

Do The Conga!

Posts: 12

Threads: 0

Joined: Oct, 2020

Reputation: -21

Replied

i sense new users incoming time to add all these addys to th3ken

Posts: 183

Threads: 10

Joined: Jul, 2020

Reputation: 3

Replied

@DoTheConga

did you even read the thread?

DeepPain - Exploit Dev - Stuck In The Past

Friends WIth Laxion

DoTheConga

Do The Conga!

Posts: 12

Threads: 0

Joined: Oct, 2020

Reputation: -21

Replied

@DeepPainv please help me i need to get into the C++ working menu i trying make API th3ken but how do i design the api it keep taking me to c#

MyUserIsTaken

apppon

Posts: 568

Threads: 26

Joined: Sep, 2020

Reputation: 5

Replied

@DoTheConga

Its in c# skidd the api userinterfaces with the dll/main code 

| Normal shibe | Rep Goals : 12345678910, 11, 12, 13, 14, 15, 16 |  Discord: apppon#0001 |

DoTheConga

Do The Conga!

Posts: 12

Threads: 0

Joined: Oct, 2020

Reputation: -21

Replied

@MyUserIsTaken ill eat ur picture dog

Posts: 183

Threads: 10

Joined: Jul, 2020

Reputation: 3

Replied

@DoTheConga

why are you so toxic?

DeepPain - Exploit Dev - Stuck In The Past

Friends WIth Laxion

OpenGamerTips

Literal Computer Nerd.

Posts: 1166

Threads: 103

Joined: Feb, 2020

Reputation: 8

Replied

@DeepPain thx and ima reply to that one *hakf-toxic* post u made bc i cant find it:

im new to learning reverse engineering, I know a lot more about lua and C# than anything. no boly :(

i tried to learn cpp but i cant get handle of its dirty syntax

| BaconDevs Founder | C# and Lua Developer |

| 3 years of experience in programming |

| My GitHub | Contact |

Posts: 183

Threads: 10

Joined: Jul, 2020

Reputation: 3

Replied

@OpenGamerTips

C++ does not have a "dirty" syntax, its actually quite similair to C#

i understand that you are trying to learn reverse engineering and thats fine

the part that annoyed me is that you were passing off false information as if it was true

DeepPain - Exploit Dev - Stuck In The Past

Friends WIth Laxion

Posts: 90

Threads: 11

Joined: Apr, 2020

Reputation: 7

Replied

gib ur disc. i want private lessons :pepehappy:

ٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴٴ

Wabz

Winning.js

Posts: 2076

Threads: 169

Joined: Apr, 2020

Reputation: 16

Replied

@OpenGamerTips i actually really like C++'s syntax, well maybe theres the "::" thing instead of "." that is annoying sometimes but its not a big deal. only thing i dont like about c++ is that its not memory safe, otherwise its probably the best programming language on earth (imo).

Hey, i'm Wabz, and i know JavaScript, Python, and C#. I also know some C/C++.

Making key systems for many exploits like Drop, Zoid, Coco Z and Alantic. DM me for one.

Btw i use arch.