diff --git a/README.md b/README.md index c08d5d5..8c5d5d9 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -[Get latest offset](https://github.com/frk1/hazedumper/blob/master/csgo.json) +# CSGOHACKS diff --git a/main.py b/main.py index b4dd3b9..44f8a40 100644 --- a/main.py +++ b/main.py @@ -8,17 +8,17 @@ from win32api import GetAsyncKeyState class Hack(): def __init__(self) -> None: - self.running = False - 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"]] + if func not in ["_find_process", "find_module"]] - def find_process(self, verbose: bool = False) -> Pymem: + self.pm = self._find_process(True) + + def _find_process(self, verbose: bool = False) -> Pymem: """Find game process""" process_found = False print("Looking for process...") if verbose else None @@ -38,24 +38,25 @@ class Hack(): return pm exit(1) - def bhop(self) -> None: - # Offsets - LOCAL_PLAYER = offset["dwLocalPlayer"] - HEALTH = offset["m_iHealth"] - FLAGS = offset["m_fFlags"] - FORCE_JUMP = offset["dwForceJump"] + def find_module(self, module: str): + found = None + for internal_module in list(self.pm.list_modules()): + if internal_module.name == module + ".dll": + found = internal_module.lpBaseOfDll - pm = self.find_process(True) + if found: + return found + else: + raise MemoryError + + def bhop(self) -> None: + mem = self.pm # Get module address - client = None - for module in list(pm.list_modules()): - if module.name == "client.dll": - client = module.lpBaseOfDll + client = self.find_module("client") # Hack loop - self.running = True - while self.running: + while True: # Reduce CPU usage sleep(0.01) @@ -64,19 +65,19 @@ class Hack(): continue # Get local player - local_player = pm.read_uint(client + LOCAL_PLAYER) + local_player = mem.read_uint(client + offset["dwLocalPlayer"]) if not local_player: continue # Check if player is alive - if not pm.read_int(local_player + HEALTH): + if not mem.read_int(local_player + offset["m_iHealth"]): continue # Check if player on ground - if pm.read_uint(local_player+FLAGS) & (1 << 0): - pm.write_uint(client + FORCE_JUMP, 5) + if mem.read_uint(local_player + offset["m_fFlags"]) & (1 << 0): + mem.write_uint(client + offset["dwForceJump"], 5) sleep(0.01) - pm.write_uint(client + FORCE_JUMP, 4) + mem.write_uint(client + offset["dwForceJump"], 4) if __name__ == "__main__":