2023-03-30 12:25:09 +02:00
|
|
|
from json import loads
|
2023-03-30 11:26:52 +02:00
|
|
|
from time import sleep
|
|
|
|
|
|
|
|
from pymem import Pymem
|
2023-03-30 12:25:09 +02:00
|
|
|
from requests import get
|
2023-03-30 11:26:52 +02:00
|
|
|
from win32api import GetAsyncKeyState
|
|
|
|
|
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
class Hack():
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.running = False
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-30 12:53:37 +02:00
|
|
|
self.cheats_list = [func for func in dir(self)
|
|
|
|
# Function
|
|
|
|
if callable(getattr(self, func))
|
|
|
|
# User defined
|
|
|
|
if not (func.startswith("__") and func.endswith("__"))
|
|
|
|
# Blacklist
|
|
|
|
if func not in ["find_process"]]
|
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
def find_process(self, verbose: bool = False) -> Pymem:
|
|
|
|
"""Find game process"""
|
|
|
|
process_found = False
|
|
|
|
print("Looking for process...") if verbose else None
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
pm = None
|
|
|
|
while not process_found:
|
|
|
|
try:
|
|
|
|
pm = Pymem("csgo.exe")
|
|
|
|
except:
|
|
|
|
# Timeout
|
|
|
|
sleep(.5)
|
|
|
|
else:
|
|
|
|
print("Process found!") if verbose else None
|
|
|
|
process_found = True
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
if pm:
|
|
|
|
return pm
|
|
|
|
exit(1)
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
def bhop(self) -> None:
|
|
|
|
# Offsets
|
|
|
|
LOCAL_PLAYER = offset["dwLocalPlayer"]
|
|
|
|
HEALTH = offset["m_iHealth"]
|
|
|
|
FLAGS = offset["m_fFlags"]
|
|
|
|
FORCE_JUMP = offset["dwForceJump"]
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
pm = self.find_process(True)
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
# Get module address
|
|
|
|
client = None
|
|
|
|
for module in list(pm.list_modules()):
|
|
|
|
if module.name == "client.dll":
|
|
|
|
client = module.lpBaseOfDll
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-30 12:25:09 +02:00
|
|
|
# Hack loop
|
|
|
|
self.running = True
|
|
|
|
while self.running:
|
|
|
|
# Reduce CPU usage
|
2023-03-30 11:26:52 +02:00
|
|
|
sleep(0.01)
|
2023-03-30 12:25:09 +02:00
|
|
|
|
|
|
|
# Space bar detection
|
|
|
|
if not GetAsyncKeyState(ord(" ")):
|
|
|
|
continue
|
|
|
|
|
|
|
|
# Get local player
|
|
|
|
local_player = pm.read_uint(client + LOCAL_PLAYER)
|
|
|
|
if not local_player:
|
|
|
|
continue
|
|
|
|
|
|
|
|
# Check if player is alive
|
|
|
|
if not pm.read_int(local_player + HEALTH):
|
|
|
|
continue
|
|
|
|
|
|
|
|
# Check if player on ground
|
|
|
|
if pm.read_uint(local_player+FLAGS) & (1 << 0):
|
|
|
|
pm.write_uint(client + FORCE_JUMP, 5)
|
|
|
|
sleep(0.01)
|
|
|
|
pm.write_uint(client + FORCE_JUMP, 4)
|
2023-03-30 11:26:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-03-30 12:25:09 +02:00
|
|
|
# Loading offsets
|
|
|
|
hazedumper_data = get(
|
|
|
|
"https://raw.githubusercontent.com/frk1/hazedumper/master/csgo.min.json")
|
|
|
|
serial_data = loads(hazedumper_data.text)
|
|
|
|
offset = serial_data["signatures"] | serial_data["netvars"]
|
|
|
|
|
|
|
|
# Cheat
|
|
|
|
c = Hack()
|
|
|
|
|
2023-03-30 12:53:37 +02:00
|
|
|
print("Enter 0 to exit.")
|
|
|
|
print("Available cheats:")
|
|
|
|
for idx, cheat in enumerate(c.cheats_list):
|
|
|
|
print(f"#{idx + 1} - {cheat}")
|
|
|
|
|
|
|
|
# Select cheat
|
|
|
|
c_id = None
|
|
|
|
while c_id == None:
|
|
|
|
try:
|
|
|
|
match int(input("Enter ID: #")):
|
|
|
|
case 0:
|
|
|
|
exit(0)
|
|
|
|
case i if i > len(c.cheats_list):
|
|
|
|
raise IndexError
|
|
|
|
case _ as i:
|
|
|
|
c_id = i - 1
|
|
|
|
except:
|
|
|
|
print("Invalid ID.")
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Run cheat
|
|
|
|
getattr(c, c.cheats_list[c_id])()
|