How to hack CS-GO with Python
Is it possible to hack games with python. Well yes, and here is how to hack CS-GO with python. Just a disclaimer, I do not support cheating and this is for educational purposes
What is CS-GO
CS-GO or Counter Strike Global Offensive is a game, released on 21st August 2012 CS-GO took the world by storm becoming one of the most played games ever. It is built on the Source engine that was also used in games like Half Life and GMOD.
What is python?
Python is an extremely versatile and configurable language. It allows for the user to do virtually anything provided the required modules and libaries are installed. Yesterdays project was made using python.
Quick Disclaimer
Some of the addresses down below may not work anymore as they are outdated. Please refer to Hazedumper as linked below. I do not condone or encourage any sort of cheating or hacking in games and this is purely for education. This may get you banned as I have not integrated the VAC bypass into the scripts below, Use at your own risk.
How can we “Hack CS-GO” with python?
The way we hack CS-GO with python is by hooking the game process and manipulating the value of certain memory adresses that are pre-determend.
import pymem
import pymem.process
def main():
print("Searching for process 'csgo.exe' \n")
pm = pymem.Pymem("csgo.exe")
print("csgo successfully linked with pymem")
client = pymem.process.module_from_name(pm.process_handle, "client.dll").lpBaseOfDll
print("Hack connected with client.dll")
if __name__ == '__main__':
main()
As you can see in the code above the pymem module is used. What first happens is we define the process that we want to hook. In this case we are looking for “csgo.exe” which is the name of the process. This does not contain the bypass to Valve Anti-Cheat. As you can see the Program searches for csgo.exe to try and hook it with pymem. If this succeds client is defined as the client.dll libary that is being called by csgo.exe.
How can we actually “Hack” it?
The script above is great although it doesn’t allow for us to actually hack and gain any sort of advantage over others. A script that would allow for us to gain an advantage is down below.
import pymem
import pymem.process
import keyboard
import time
m_bSpotted = (0x93D)
dwEntityList = (0x4DC179C)
def main():
print("Searching for process 'csgo.exe' \n")
pm = pymem.Pymem("csgo.exe")
print("csgo successfully linked with pymem")
client = pymem.process.module_from_name(pm.process_handle, "client.dll").lpBaseOfDll
print("Hack connected with client.dll")
try:
print("Hack Initiated")
while True:
if keyboard.is_pressed("*"):
print("Closing Hack")
exit(0)
for i in range(1, 32):
entity = pm.read_int(client + dwEntityList + i * 0x10)
if entity:
pm.write_uchar(entity + m_bSpotted, 1)
except Exception as e:
print(e)
if __name__ == '__main__':
main()
As you can see this script is similar to the above although there is a new “try” statement. Under the while True: statement we can see that when the key "*" is pressed the script will close. Otherwise we loop through the players in a lobby. This is set to a maximum of 32 as that is the limit to the amount of people in a lobby. For each player the same code runs. It save the player to a variable and offsets them. If they are an entity pymem them write the value m_bSpotted to one which effects the game by making a red dot visible on the players radar.
How do we figure out the address'?
To figure out our address’ we use a program called Hazedumper. The link there will take you to the output. Hazedumper is an open source and well known program that rips apart csgo.exe among other games and save all of their key data points’ hex address’. By using these adresses we can modify game data like we did in the previous script.
That’s It
Yep, that is it. With just 28 lines of code we can hook the game process. Open and save client.dll. Write to the process’ memory. Then Gain A competitive advantage. Check out some Examples for more.